Search is not available for this dataset
chain_id
uint64
1
1
block_number
uint64
19.5M
20M
block_hash
stringlengths
64
64
transaction_hash
stringlengths
64
64
deployer_address
stringlengths
40
40
factory_address
stringlengths
40
40
contract_address
stringlengths
40
40
creation_bytecode
stringlengths
0
98.3k
runtime_bytecode
stringlengths
0
49.2k
creation_sourcecode
stringlengths
0
976k
1
20,290,486
970d1103468c0a3f575eb9b945131fc28baa88ec44c1977d05ce1456d1fd3fde
25554615faf284b734b0cc0022e54b3100ad6eee7a2a2f2858842f38ac72ed5a
a7fb5ca286fc3fd67525629048a4de3ba24cba2e
c77ad0a71008d7094a62cfbd250a2eb2afdf2776
1d11149ef039fc2a39f0291a9daec66ed1c5c2e5
608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe
1
20,290,487
cd61ed2042ec5e585b6c77563ee2166fb93e65889c6baf963466c0e239e1bf67
1c98356e3f75568de92cf11205ac2fcf3bb24330f895463b3ebb5259ecfac17e
849a02be4c2ec8bbd06052c5a0cd51147994ad96
39c40c8f040cf363fa3cc6ed379dced87f318c36
d493e3398322a707590a3980761730e93d52fa85
608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe
1
20,290,491
37c8798df3fcdb858a5c8a1c211a49ca19cdfc960cf7eb8403b2fa96a5b74d0c
1781958cf505c8df4088eabe3583e9aa281e374715120149c3a7f50e9f37b4d0
4e565f63257d90f988e5ec9d065bab00f94d2dfd
9fa5c5733b53814692de4fb31fd592070de5f5f0
aa1250cd58b0aebc73569f301b58946f5a0d5249
608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe
1
20,290,491
37c8798df3fcdb858a5c8a1c211a49ca19cdfc960cf7eb8403b2fa96a5b74d0c
987623045b2509f3747c4b5b9170ecd0328c38573e9ca8c25465e6613e13b1af
00bdb5699745f5b860228c8f939abf1b9ae374ed
ffa397285ce46fb78c588a9e993286aac68c37cd
799a63ae2f5ba51aee807471a297a82beb6b58d9
3d602d80600a3d3981f3363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3
pragma solidity 0.7.5; /* The MIT License (MIT) Copyright (c) 2018 Murray Software, LLC. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //solhint-disable max-line-length //solhint-disable no-inline-assembly contract CloneFactory { function createClone(address target, bytes32 salt) internal returns (address payable result) { bytes20 targetBytes = bytes20(target); assembly { // load the next free memory slot as a place to store the clone contract data let clone := mload(0x40) // The bytecode block below is responsible for contract initialization // during deployment, it is worth noting the proxied contract constructor will not be called during // the cloning procedure and that is why an initialization function needs to be called after the // clone is created mstore( clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000 ) // This stores the address location of the implementation contract // so that the proxy knows where to delegate call logic to mstore(add(clone, 0x14), targetBytes) // The bytecode block is the actual code that is deployed for each clone created. // It forwards all calls to the already deployed implementation via a delegatecall mstore( add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000 ) // deploy the contract using the CREATE2 opcode // this deploys the minimal proxy defined above, which will proxy all // calls to use the logic defined in the implementation contract `target` result := create2(0, clone, 0x37, salt) } } function isClone(address target, address query) internal view returns (bool result) { bytes20 targetBytes = bytes20(target); assembly { // load the next free memory slot as a place to store the comparison clone let clone := mload(0x40) // The next three lines store the expected bytecode for a miniml proxy // that targets `target` as its implementation contract mstore( clone, 0x363d3d373d3d3d363d7300000000000000000000000000000000000000000000 ) mstore(add(clone, 0xa), targetBytes) mstore( add(clone, 0x1e), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000 ) // the next two lines store the bytecode of the contract that we are checking in memory let other := add(clone, 0x40) extcodecopy(query, other, 0, 0x2d) // Check if the expected bytecode equals the actual bytecode and return the result result := and( eq(mload(clone), mload(other)), eq(mload(add(clone, 0xd)), mload(add(other, 0xd))) ) } } } /** * Contract that exposes the needed erc20 token functions */ abstract contract ERC20Interface { // Send _value amount of tokens to address _to function transfer(address _to, uint256 _value) public virtual returns (bool success); // Get the account balance of another account with address _owner function balanceOf(address _owner) public virtual view returns (uint256 balance); } // helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false library TransferHelper { function safeApprove( address token, address to, uint256 value ) internal { // bytes4(keccak256(bytes('approve(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::safeApprove: approve failed' ); } function safeTransfer( address token, address to, uint256 value ) internal { // bytes4(keccak256(bytes('transfer(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::safeTransfer: transfer failed' ); } function safeTransferFrom( address token, address from, address to, uint256 value ) internal { // bytes4(keccak256(bytes('transferFrom(address,address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::transferFrom: transferFrom failed' ); } function safeTransferETH(address to, uint256 value) internal { (bool success, ) = to.call{value: value}(new bytes(0)); require(success, 'TransferHelper::safeTransferETH: ETH transfer failed'); } } /** * Contract that will forward any incoming Ether to the creator of the contract * */ contract Forwarder { // Address to which any funds sent to this contract will be forwarded address public parentAddress; event ForwarderDeposited(address from, uint256 value, bytes data); /** * Initialize the contract, and sets the destination address to that of the creator */ function init(address _parentAddress) external onlyUninitialized { parentAddress = _parentAddress; uint256 value = address(this).balance; if (value == 0) { return; } (bool success, ) = parentAddress.call{ value: value }(''); require(success, 'Flush failed'); // NOTE: since we are forwarding on initialization, // we don't have the context of the original sender. // We still emit an event about the forwarding but set // the sender to the forwarder itself emit ForwarderDeposited(address(this), value, msg.data); } /** * Modifier that will execute internal code block only if the sender is the parent address */ modifier onlyParent { require(msg.sender == parentAddress, 'Only Parent'); _; } /** * Modifier that will execute internal code block only if the contract has not been initialized yet */ modifier onlyUninitialized { require(parentAddress == address(0x0), 'Already initialized'); _; } /** * Default function; Gets called when data is sent but does not match any other function */ fallback() external payable { flush(); } /** * Default function; Gets called when Ether is deposited with no data, and forwards it to the parent address */ receive() external payable { flush(); } /** * Execute a token transfer of the full balance from the forwarder token to the parent address * @param tokenContractAddress the address of the erc20 token contract */ function flushTokens(address tokenContractAddress) external onlyParent { ERC20Interface instance = ERC20Interface(tokenContractAddress); address forwarderAddress = address(this); uint256 forwarderBalance = instance.balanceOf(forwarderAddress); if (forwarderBalance == 0) { return; } TransferHelper.safeTransfer( tokenContractAddress, parentAddress, forwarderBalance ); } /** * Flush the entire balance of the contract to the parent address. */ function flush() public { uint256 value = address(this).balance; if (value == 0) { return; } (bool success, ) = parentAddress.call{ value: value }(''); require(success, 'Flush failed'); emit ForwarderDeposited(msg.sender, value, msg.data); } } contract ForwarderFactory is CloneFactory { address public implementationAddress; event ForwarderCreated(address newForwarderAddress, address parentAddress); constructor(address _implementationAddress) { implementationAddress = _implementationAddress; } function createForwarder(address parent, bytes32 salt) external { // include the signers in the salt so any contract deployed to a given address must have the same signers bytes32 finalSalt = keccak256(abi.encodePacked(parent, salt)); address payable clone = createClone(implementationAddress, finalSalt); Forwarder(clone).init(parent); emit ForwarderCreated(clone, parent); } }
1
20,290,495
0dd50989a82d9042c743656b80000cf85bec9790cd6c687f5081f41a31aebcf7
4584a82015c92f9d39abc70fcf152408dc5cc555167d4e2a11e9bea878062ade
93fbdae3e0ca5790af0840fe7b95b12d7efafbd0
91e677b07f7af907ec9a428aafa9fc14a0d3a338
35f7cf1d465c52e3346b54689004e27e87536d70
608060405260405161090e38038061090e83398101604081905261002291610460565b61002e82826000610035565b505061058a565b61003e83610100565b6040516001600160a01b038416907f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e90600090a260008251118061007f5750805b156100fb576100f9836001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e99190610520565b836102a360201b6100291760201c565b505b505050565b610113816102cf60201b6100551760201c565b6101725760405162461bcd60e51b815260206004820152602560248201527f455243313936373a206e657720626561636f6e206973206e6f74206120636f6e6044820152641d1c9858dd60da1b60648201526084015b60405180910390fd5b6101e6816001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d79190610520565b6102cf60201b6100551760201c565b61024b5760405162461bcd60e51b815260206004820152603060248201527f455243313936373a20626561636f6e20696d706c656d656e746174696f6e206960448201526f1cc81b9bdd08184818dbdb9d1c9858dd60821b6064820152608401610169565b806102827fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d5060001b6102de60201b6100641760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b60606102c883836040518060600160405280602781526020016108e7602791396102e1565b9392505050565b6001600160a01b03163b151590565b90565b6060600080856001600160a01b0316856040516102fe919061053b565b600060405180830381855af49150503d8060008114610339576040519150601f19603f3d011682016040523d82523d6000602084013e61033e565b606091505b5090925090506103508683838761035a565b9695505050505050565b606083156103c65782516103bf576001600160a01b0385163b6103bf5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610169565b50816103d0565b6103d083836103d8565b949350505050565b8151156103e85781518083602001fd5b8060405162461bcd60e51b81526004016101699190610557565b80516001600160a01b038116811461041957600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561044f578181015183820152602001610437565b838111156100f95750506000910152565b6000806040838503121561047357600080fd5b61047c83610402565b60208401519092506001600160401b038082111561049957600080fd5b818501915085601f8301126104ad57600080fd5b8151818111156104bf576104bf61041e565b604051601f8201601f19908116603f011681019083821181831017156104e7576104e761041e565b8160405282815288602084870101111561050057600080fd5b610511836020830160208801610434565b80955050505050509250929050565b60006020828403121561053257600080fd5b6102c882610402565b6000825161054d818460208701610434565b9190910192915050565b6020815260008251806020840152610576816040850160208701610434565b601f01601f19169190910160400192915050565b61034e806105996000396000f3fe60806040523661001357610011610017565b005b6100115b610027610022610067565b610100565b565b606061004e83836040518060600160405280602781526020016102f260279139610124565b9392505050565b6001600160a01b03163b151590565b90565b600061009a7fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50546001600160a01b031690565b6001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100fb9190610249565b905090565b3660008037600080366000845af43d6000803e80801561011f573d6000f35b3d6000fd5b6060600080856001600160a01b03168560405161014191906102a2565b600060405180830381855af49150503d806000811461017c576040519150601f19603f3d011682016040523d82523d6000602084013e610181565b606091505b50915091506101928683838761019c565b9695505050505050565b6060831561020d578251610206576001600160a01b0385163b6102065760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064015b60405180910390fd5b5081610217565b610217838361021f565b949350505050565b81511561022f5781518083602001fd5b8060405162461bcd60e51b81526004016101fd91906102be565b60006020828403121561025b57600080fd5b81516001600160a01b038116811461004e57600080fd5b60005b8381101561028d578181015183820152602001610275565b8381111561029c576000848401525b50505050565b600082516102b4818460208701610272565b9190910192915050565b60208152600082518060208401526102dd816040850160208701610272565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220d51e81d3bc5ed20a26aeb05dce7e825c503b2061aa78628027300c8d65b9d89a64736f6c634300080c0033416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c65640000000000000000000000005a2a4f2f3c18f09179b6703e63d9edd16590907300000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000
60806040523661001357610011610017565b005b6100115b610027610022610067565b610100565b565b606061004e83836040518060600160405280602781526020016102f260279139610124565b9392505050565b6001600160a01b03163b151590565b90565b600061009a7fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50546001600160a01b031690565b6001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100fb9190610249565b905090565b3660008037600080366000845af43d6000803e80801561011f573d6000f35b3d6000fd5b6060600080856001600160a01b03168560405161014191906102a2565b600060405180830381855af49150503d806000811461017c576040519150601f19603f3d011682016040523d82523d6000602084013e610181565b606091505b50915091506101928683838761019c565b9695505050505050565b6060831561020d578251610206576001600160a01b0385163b6102065760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064015b60405180910390fd5b5081610217565b610217838361021f565b949350505050565b81511561022f5781518083602001fd5b8060405162461bcd60e51b81526004016101fd91906102be565b60006020828403121561025b57600080fd5b81516001600160a01b038116811461004e57600080fd5b60005b8381101561028d578181015183820152602001610275565b8381111561029c576000848401525b50505050565b600082516102b4818460208701610272565b9190910192915050565b60208152600082518060208401526102dd816040850160208701610272565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220d51e81d3bc5ed20a26aeb05dce7e825c503b2061aa78628027300c8d65b9d89a64736f6c634300080c0033
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol) pragma solidity ^0.8.0; /** * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified * proxy whose upgrades are fully controlled by the current implementation. */ interface IERC1822Proxiable { /** * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation * address. * * 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. */ function proxiableUUID() external view returns (bytes32); } // OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol) pragma solidity ^0.8.2; // import "../beacon/IBeacon.sol"; // import "../../interfaces/draft-IERC1822.sol"; // import "../../utils/Address.sol"; // import "../../utils/StorageSlot.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. * * _Available since v4.1._ */ abstract contract ERC1967Upgrade { // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1 bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143; /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Returns the current implementation address. */ function _getImplementation() internal view returns (address) { return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Perform implementation upgrade * * Emits an {Upgraded} event. */ function _upgradeTo(address newImplementation) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Perform implementation upgrade with additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal { _upgradeTo(newImplementation); if (data.length > 0 || forceCall) { Address.functionDelegateCall(newImplementation, data); } } /** * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal { // Upgrades from old implementations will perform a rollback test. This test requires the new // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing // this special case will break upgrade paths from old UUPS implementation to new ones. if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) { _setImplementation(newImplementation); } else { try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) { require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID"); } catch { revert("ERC1967Upgrade: new implementation is not UUPS"); } _upgradeToAndCall(newImplementation, data, forceCall); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Returns the current admin. */ function _getAdmin() internal view returns (address) { return StorageSlot.getAddressSlot(_ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { require(newAdmin != address(0), "ERC1967: new admin is the zero address"); StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {AdminChanged} event. */ function _changeAdmin(address newAdmin) internal { emit AdminChanged(_getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor. */ bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Emitted when the beacon is upgraded. */ event BeaconUpgraded(address indexed beacon); /** * @dev Returns the current beacon. */ function _getBeacon() internal view returns (address) { return StorageSlot.getAddressSlot(_BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { require(Address.isContract(newBeacon), "ERC1967: new beacon is not a contract"); require( Address.isContract(IBeacon(newBeacon).implementation()), "ERC1967: beacon implementation is not a contract" ); StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon; } /** * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that). * * Emits a {BeaconUpgraded} event. */ function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0 || forceCall) { Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data); } } } // OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol) pragma solidity ^0.8.0; /** * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to * be specified by overriding the virtual {_implementation} function. * * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a * different contract through the {_delegate} function. * * The success and return data of the delegated call will be returned back to the caller of the proxy. */ abstract contract Proxy { /** * @dev Delegates the current call to `implementation`. * * This function does not return to its internal call site, it will return directly to the external caller. */ function _delegate(address implementation) internal virtual { assembly { // Copy msg.data. We take full control of memory in this inline assembly // block because it will not return to Solidity code. We overwrite the // Solidity scratch pad at memory position 0. calldatacopy(0, 0, calldatasize()) // Call the implementation. // out and outsize are 0 because we don't know the size yet. let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0) // Copy the returned data. returndatacopy(0, 0, returndatasize()) switch result // delegatecall returns 0 on error. case 0 { revert(0, returndatasize()) } default { return(0, returndatasize()) } } } /** * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function * and {_fallback} should delegate. */ function _implementation() internal view virtual returns (address); /** * @dev Delegates the current call to the address returned by `_implementation()`. * * This function does not return to its internal call site, it will return directly to the external caller. */ function _fallback() internal virtual { _beforeFallback(); _delegate(_implementation()); } /** * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other * function in the contract matches the call data. */ fallback() external payable virtual { _fallback(); } /** * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data * is empty. */ receive() external payable virtual { _fallback(); } /** * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback` * call, or as part of the Solidity `fallback` or `receive` functions. * * If overridden should call `super._beforeFallback()`. */ function _beforeFallback() internal virtual {} } // OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.0; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeacon { /** * @dev Must return an address that can be used as a delegate call target. * * {BeaconProxy} will check that this address is a contract. */ function implementation() external view returns (address); } // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } // OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol) // This file was procedurally generated from scripts/generate/templates/StorageSlot.js. pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ```solidity * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._ * _Available since v4.9 for `string`, `bytes`._ */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } struct StringSlot { string value; } struct BytesSlot { bytes value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` with member `value` located at `slot`. */ function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` representation of the string storage pointer `store`. */ function getStringSlot(string storage store) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } /** * @dev Returns an `BytesSlot` with member `value` located at `slot`. */ function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`. */ function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } } // OpenZeppelin Contracts (last updated v4.7.0) (proxy/beacon/BeaconProxy.sol) pragma solidity ^0.8.0; // import "./IBeacon.sol"; // import "../Proxy.sol"; // import "../ERC1967/ERC1967Upgrade.sol"; /** * @dev This contract implements a proxy that gets the implementation address for each call from an {UpgradeableBeacon}. * * The beacon address is stored in storage slot `uint256(keccak256('eip1967.proxy.beacon')) - 1`, so that it doesn't * conflict with the storage layout of the implementation behind the proxy. * * _Available since v3.4._ */ contract BeaconProxy is Proxy, ERC1967Upgrade { /** * @dev Initializes the proxy with `beacon`. * * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. This * will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity * constructor. * * Requirements: * * - `beacon` must be a contract with the interface {IBeacon}. */ constructor(address beacon, bytes memory data) payable { _upgradeBeaconToAndCall(beacon, data, false); } /** * @dev Returns the current beacon address. */ function _beacon() internal view virtual returns (address) { return _getBeacon(); } /** * @dev Returns the current implementation address of the associated beacon. */ function _implementation() internal view virtual override returns (address) { return IBeacon(_getBeacon()).implementation(); } /** * @dev Changes the proxy to use a new beacon. Deprecated: see {_upgradeBeaconToAndCall}. * * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. * * Requirements: * * - `beacon` must be a contract. * - The implementation returned by `beacon` must be a contract. */ function _setBeacon(address beacon, bytes memory data) internal virtual { _upgradeBeaconToAndCall(beacon, data, false); } }
1
20,290,495
0dd50989a82d9042c743656b80000cf85bec9790cd6c687f5081f41a31aebcf7
0bc54d05a00de76f67058845b7c889cdb34f0bcfc62dadfc4cf56503623e5f17
e9af0428143e4509df4379bd10c4850b223f2ecb
e9af0428143e4509df4379bd10c4850b223f2ecb
bd286df841ccfc66e41cd5b97ad59573738caf4a
6101606040523480156200001257600080fd5b506040516200253538038062002535833981016040819052620000359162000435565b6040518060400160405280600981526020016813195d995b081554d160ba1b81525080604051806040016040528060018152602001603160f81b8152506040518060400160405280600981526020016813195d995b081554d160ba1b815250604051806040016040528060068152602001651b1d9b1554d160d21b8152508160039081620000c491906200050c565b506004620000d382826200050c565b50620000e591508390506005620001f6565b61012052620000f6816006620001f6565b61014052815160208084019190912060e052815190820120610100524660a0526200018460e05161010051604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201529081019290925260608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b60805250503060c052506001600160a01b038116620001b657604051635919af9760e11b815260040160405180910390fd5b620001c36000826200022f565b620001ef7fd15a633a037a8cb1e45b365d4ebd232aae2a8d891c9de0523b8e2fe68362d066826200022f565b506200064d565b600060208351101562000216576200020e83620002c1565b905062000229565b816200022384826200050c565b5060ff90505b92915050565b81620002b157600a546040516001600160a01b038084169216907ff8ccb027dfcd135e000e9d45e6cc2d662578a8825d4c45b5e32e0adf67e79ec690600090a3600a5462000289906000906001600160a01b03166200030d565b600a80546001600160a01b0383166001600160a01b031991821617909155600b805490911690555b620002bd828262000391565b5050565b600080829050601f81511115620002f8578260405163305a27a960e01b8152600401620002ef9190620005d8565b60405180910390fd5b8051620003058262000628565b179392505050565b60008281526009602090815260408083206001600160a01b038516845290915290205460ff1615620002bd5760008281526009602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60008281526009602090815260408083206001600160a01b038516845290915290205460ff16620002bd5760008281526009602090815260408083206001600160a01b03851684529091529020805460ff19166001179055620003f13390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000602082840312156200044857600080fd5b81516001600160a01b03811681146200046057600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200049257607f821691505b602082108103620004b357634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200050757600081815260208120601f850160051c81016020861015620004e25750805b601f850160051c820191505b818110156200050357828155600101620004ee565b5050505b505050565b81516001600160401b0381111562000528576200052862000467565b62000540816200053984546200047d565b84620004b9565b602080601f8311600181146200057857600084156200055f5750858301515b600019600386901b1c1916600185901b17855562000503565b600085815260208120601f198616915b82811015620005a95788860151825594840194600190910190840162000588565b5085821015620005c85787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600060208083528351808285015260005b818110156200060757858101830151858201604001528201620005e9565b506000604082860101526040601f19601f8301168501019250505092915050565b80516020808301519190811015620004b35760001960209190910360031b1b16919050565b60805160a05160c05160e051610100516101205161014051611e8d620006a860003960006108ab015260006108800152600061110d015260006110e5015260006110400152600061106a015260006110940152611e8d6000f3fe608060405234801561001057600080fd5b50600436106102115760003560e01c806342966c6811610125578063a217fddf116100ad578063b13442711161007c578063b13442711461048c578063d505accf1461049f578063d547741f146104b2578063dd62ed3e146104c5578063fca3b5aa146104d857600080fd5b8063a217fddf1461044b578063a457c2d714610453578063a9059cbb14610466578063aabc24961461047957600080fd5b80637ecebe00116100f45780637ecebe00146103f157806384b0196e146104045780638da5cb5b1461041f57806391d148541461043057806395d89b411461044357600080fd5b806342966c681461038f57806370a08231146103a257806375829def146103cb57806379cc6790146103de57600080fd5b806323b872dd116101a8578063313ce56711610177578063313ce5671461033f5780633644e5151461034e57806336568abe14610356578063395093511461036957806340c10f191461037c57600080fd5b806323b872dd146102d3578063248a9ca3146102e65780632f2ff15d14610309578063300265421461031c57600080fd5b8063095ea7b3116101e4578063095ea7b3146102935780630e18b681146102a657806318160ddd146102ae578063228b547e146102c057600080fd5b806301ffc9a71461021657806302c52db01461023e57806306fdde03146102535780630754617214610268575b600080fd5b610229610224366004611a73565b6104eb565b60405190151581526020015b60405180910390f35b61025161024c366004611ab9565b610522565b005b61025b61056e565b6040516102359190611b24565b600d5461027b906001600160a01b031681565b6040516001600160a01b039091168152602001610235565b6102296102a1366004611b37565b610600565b610251610618565b6002545b604051908152602001610235565b6102516102ce366004611ab9565b610650565b6102296102e1366004611b61565b6106ca565b6102b26102f4366004611b9d565b60009081526009602052604090206001015490565b610251610317366004611bb6565b6106ee565b61022961032a366004611ab9565b600c6020526000908152604090205460ff1681565b60405160128152602001610235565b6102b2610728565b610251610364366004611bb6565b610737565b610229610377366004611b37565b610750565b61025161038a366004611b37565b610772565b61025161039d366004611b9d565b6107ab565b6102b26103b0366004611ab9565b6001600160a01b031660009081526020819052604090205490565b6102516103d9366004611ab9565b6107b8565b6102516103ec366004611b37565b61083f565b6102b26103ff366004611ab9565b610854565b61040c610872565b6040516102359796959493929190611be2565b600a546001600160a01b031661027b565b61022961043e366004611bb6565b6108fb565b61025b610926565b6102b2600081565b610229610461366004611b37565b610935565b610229610474366004611b37565b6109b5565b610251610487366004611ab9565b6109c3565b600e5461027b906001600160a01b031681565b6102516104ad366004611c78565b610a2c565b6102516104c0366004611bb6565b610b90565b6102b26104d3366004611ceb565b610bc4565b6102516104e6366004611ab9565b610bef565b60006001600160e01b03198216637965db0b60e01b148061051c57506301ffc9a760e01b6001600160e01b03198316145b92915050565b7fd15a633a037a8cb1e45b365d4ebd232aae2a8d891c9de0523b8e2fe68362d06661054c81610c58565b506001600160a01b03166000908152600c60205260409020805460ff19169055565b60606003805461057d90611d15565b80601f01602080910402602001604051908101604052809291908181526020018280546105a990611d15565b80156105f65780601f106105cb576101008083540402835291602001916105f6565b820191906000526020600020905b8154815290600101906020018083116105d957829003601f168201915b5050505050905090565b60003361060e818585610c62565b5060019392505050565b600b546001600160a01b031633146106435760405163058d9a1b60e01b815260040160405180910390fd5b61064e600033610d87565b565b7fd15a633a037a8cb1e45b365d4ebd232aae2a8d891c9de0523b8e2fe68362d06661067a81610c58565b816106866000826108fb565b156106a45760405163e4183cb160e01b815260040160405180910390fd5b50506001600160a01b03166000908152600c60205260409020805460ff19166001179055565b6000336106d8858285610e10565b6106e3858585610e84565b506001949350505050565b60006106f981610c58565b82806107185760405163318bd07d60e11b815260040160405180910390fd5b6107228484610d87565b50505050565b6000610732611033565b905090565b604051637a851da960e11b815260040160405180910390fd5b60003361060e8185856107638383610bc4565b61076d9190611d5f565b610c62565b600d546001600160a01b0316331461079d57604051639cdc2ed560e01b815260040160405180910390fd5b6107a7828261115e565b5050565b6107b53382611229565b50565b60006107c381610c58565b336001600160a01b038316036107ec5760405163318bd07d60e11b815260040160405180910390fd5b600b80546001600160a01b0319166001600160a01b03848116918217909255600a54604051919216907fefdcbba819467e00b0262c12892dda980bac68580b72178e57a162368b80876690600090a35050565b61084a823383610e10565b6107a78282611229565b6001600160a01b03811660009081526007602052604081205461051c565b6000606080828080836108a67f00000000000000000000000000000000000000000000000000000000000000006005611364565b6108d17f00000000000000000000000000000000000000000000000000000000000000006006611364565b60408051600080825260208201909252600f60f81b9b939a50919850469750309650945092509050565b60009182526009602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60606004805461057d90611d15565b600033816109438286610bc4565b9050838110156109a85760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084015b60405180910390fd5b6106e38286868403610c62565b60003361060e818585610e84565b60006109ce81610c58565b600e546040516001600160a01b03918216918416907fe0d49a54274423183dadecbdf239eaac6e06ba88320b26fe8cc5ec9d050a639590600090a350600e80546001600160a01b0319166001600160a01b0392909216919091179055565b83421115610a7c5760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e65000000604482015260640161099f565b60007f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9888888610aab8c61140f565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090506000610b0682611437565b90506000610b1682878787611464565b9050896001600160a01b0316816001600160a01b031614610b795760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e61747572650000604482015260640161099f565b610b848a8a8a610c62565b50505050505050505050565b6000610b9b81610c58565b8280610bba5760405163318bd07d60e11b815260040160405180910390fd5b610722848461148c565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6000610bfa81610c58565b600d546040516001600160a01b03918216918416907f1cf2de25c5bf439ac0287061c3a0fa69b3b02867d0ccfd2ded34e42577050b7390600090a350600d80546001600160a01b0319166001600160a01b0392909216919091179055565b6107b581336114f3565b6001600160a01b038316610cc45760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161099f565b6001600160a01b038216610d255760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161099f565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b81610e0657600a546040516001600160a01b038084169216907ff8ccb027dfcd135e000e9d45e6cc2d662578a8825d4c45b5e32e0adf67e79ec690600090a3600a54610dde906000906001600160a01b031661148c565b600a80546001600160a01b0383166001600160a01b031991821617909155600b805490911690555b6107a7828261154c565b6000610e1c8484610bc4565b905060001981146107225781811015610e775760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000604482015260640161099f565b6107228484848403610c62565b6001600160a01b038316610ee85760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161099f565b6001600160a01b038216610f4a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161099f565b610f558383836115d2565b6001600160a01b03831660009081526020819052604090205481811015610fcd5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b606482015260840161099f565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610722565b6000306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614801561108c57507f000000000000000000000000000000000000000000000000000000000000000046145b156110b657507f000000000000000000000000000000000000000000000000000000000000000090565b610732604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b6001600160a01b0382166111b45760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161099f565b6111c0600083836115d2565b80600260008282546111d29190611d5f565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b6001600160a01b0382166112895760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b606482015260840161099f565b611295826000836115d2565b6001600160a01b038216600090815260208190526040902054818110156113095760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b606482015260840161099f565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101610d7a565b505050565b606060ff831461137e5761137783611649565b905061051c565b81805461138a90611d15565b80601f01602080910402602001604051908101604052809291908181526020018280546113b690611d15565b80156114035780601f106113d857610100808354040283529160200191611403565b820191906000526020600020905b8154815290600101906020018083116113e657829003601f168201915b5050505050905061051c565b6001600160a01b03811660009081526007602052604090208054600181018255905b50919050565b600061051c611444611033565b8360405161190160f01b8152600281019290925260228201526042902090565b600080600061147587878787611688565b915091506114828161174c565b5095945050505050565b61149682826108fb565b156107a75760008281526009602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6114fd82826108fb565b6107a75761150a81611896565b6115158360206118a8565b604051602001611526929190611d88565b60408051601f198184030181529082905262461bcd60e51b825261099f91600401611b24565b61155682826108fb565b6107a75760008281526009602090815260408083206001600160a01b03851684529091529020805460ff1916600117905561158e3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6001600160a01b0383166000908152600c602052604090205460ff168061161157506001600160a01b0382166000908152600c602052604090205460ff165b8061162b5750336000908152600c602052604090205460ff165b1561135f5760405163445cd55760e01b815260040160405180910390fd5b6060600061165683611a4b565b604080516020808252818301909252919250600091906020820181803683375050509182525060208101929092525090565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156116bf5750600090506003611743565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015611713573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661173c57600060019250925050611743565b9150600090505b94509492505050565b600081600481111561176057611760611dfd565b036117685750565b600181600481111561177c5761177c611dfd565b036117c95760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161099f565b60028160048111156117dd576117dd611dfd565b0361182a5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161099f565b600381600481111561183e5761183e611dfd565b036107b55760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161099f565b606061051c6001600160a01b03831660145b606060006118b7836002611e13565b6118c2906002611d5f565b67ffffffffffffffff8111156118da576118da611d72565b6040519080825280601f01601f191660200182016040528015611904576020820181803683370190505b509050600360fc1b8160008151811061191f5761191f611e2a565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061194e5761194e611e2a565b60200101906001600160f81b031916908160001a9053506000611972846002611e13565b61197d906001611d5f565b90505b60018111156119f5576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106119b1576119b1611e2a565b1a60f81b8282815181106119c7576119c7611e2a565b60200101906001600160f81b031916908160001a90535060049490941c936119ee81611e40565b9050611980565b508315611a445760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161099f565b9392505050565b600060ff8216601f81111561051c57604051632cd44ac360e21b815260040160405180910390fd5b600060208284031215611a8557600080fd5b81356001600160e01b031981168114611a4457600080fd5b80356001600160a01b0381168114611ab457600080fd5b919050565b600060208284031215611acb57600080fd5b611a4482611a9d565b60005b83811015611aef578181015183820152602001611ad7565b50506000910152565b60008151808452611b10816020860160208601611ad4565b601f01601f19169290920160200192915050565b602081526000611a446020830184611af8565b60008060408385031215611b4a57600080fd5b611b5383611a9d565b946020939093013593505050565b600080600060608486031215611b7657600080fd5b611b7f84611a9d565b9250611b8d60208501611a9d565b9150604084013590509250925092565b600060208284031215611baf57600080fd5b5035919050565b60008060408385031215611bc957600080fd5b82359150611bd960208401611a9d565b90509250929050565b60ff60f81b881681526000602060e081840152611c0260e084018a611af8565b8381036040850152611c14818a611af8565b606085018990526001600160a01b038816608086015260a0850187905284810360c0860152855180825283870192509083019060005b81811015611c6657835183529284019291840191600101611c4a565b50909c9b505050505050505050505050565b600080600080600080600060e0888a031215611c9357600080fd5b611c9c88611a9d565b9650611caa60208901611a9d565b95506040880135945060608801359350608088013560ff81168114611cce57600080fd5b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215611cfe57600080fd5b611d0783611a9d565b9150611bd960208401611a9d565b600181811c90821680611d2957607f821691505b60208210810361143157634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561051c5761051c611d49565b634e487b7160e01b600052604160045260246000fd5b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611dc0816017850160208801611ad4565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351611df1816028840160208801611ad4565b01602801949350505050565b634e487b7160e01b600052602160045260246000fd5b808202811582820484141761051c5761051c611d49565b634e487b7160e01b600052603260045260246000fd5b600081611e4f57611e4f611d49565b50600019019056fea2646970667358221220d32ed0464673df19b8a0410b2493ef91bcdbe82b286a37027a75ed84329eb70e64736f6c63430008130033000000000000000000000000e9af0428143e4509df4379bd10c4850b223f2ecb
608060405234801561001057600080fd5b50600436106102115760003560e01c806342966c6811610125578063a217fddf116100ad578063b13442711161007c578063b13442711461048c578063d505accf1461049f578063d547741f146104b2578063dd62ed3e146104c5578063fca3b5aa146104d857600080fd5b8063a217fddf1461044b578063a457c2d714610453578063a9059cbb14610466578063aabc24961461047957600080fd5b80637ecebe00116100f45780637ecebe00146103f157806384b0196e146104045780638da5cb5b1461041f57806391d148541461043057806395d89b411461044357600080fd5b806342966c681461038f57806370a08231146103a257806375829def146103cb57806379cc6790146103de57600080fd5b806323b872dd116101a8578063313ce56711610177578063313ce5671461033f5780633644e5151461034e57806336568abe14610356578063395093511461036957806340c10f191461037c57600080fd5b806323b872dd146102d3578063248a9ca3146102e65780632f2ff15d14610309578063300265421461031c57600080fd5b8063095ea7b3116101e4578063095ea7b3146102935780630e18b681146102a657806318160ddd146102ae578063228b547e146102c057600080fd5b806301ffc9a71461021657806302c52db01461023e57806306fdde03146102535780630754617214610268575b600080fd5b610229610224366004611a73565b6104eb565b60405190151581526020015b60405180910390f35b61025161024c366004611ab9565b610522565b005b61025b61056e565b6040516102359190611b24565b600d5461027b906001600160a01b031681565b6040516001600160a01b039091168152602001610235565b6102296102a1366004611b37565b610600565b610251610618565b6002545b604051908152602001610235565b6102516102ce366004611ab9565b610650565b6102296102e1366004611b61565b6106ca565b6102b26102f4366004611b9d565b60009081526009602052604090206001015490565b610251610317366004611bb6565b6106ee565b61022961032a366004611ab9565b600c6020526000908152604090205460ff1681565b60405160128152602001610235565b6102b2610728565b610251610364366004611bb6565b610737565b610229610377366004611b37565b610750565b61025161038a366004611b37565b610772565b61025161039d366004611b9d565b6107ab565b6102b26103b0366004611ab9565b6001600160a01b031660009081526020819052604090205490565b6102516103d9366004611ab9565b6107b8565b6102516103ec366004611b37565b61083f565b6102b26103ff366004611ab9565b610854565b61040c610872565b6040516102359796959493929190611be2565b600a546001600160a01b031661027b565b61022961043e366004611bb6565b6108fb565b61025b610926565b6102b2600081565b610229610461366004611b37565b610935565b610229610474366004611b37565b6109b5565b610251610487366004611ab9565b6109c3565b600e5461027b906001600160a01b031681565b6102516104ad366004611c78565b610a2c565b6102516104c0366004611bb6565b610b90565b6102b26104d3366004611ceb565b610bc4565b6102516104e6366004611ab9565b610bef565b60006001600160e01b03198216637965db0b60e01b148061051c57506301ffc9a760e01b6001600160e01b03198316145b92915050565b7fd15a633a037a8cb1e45b365d4ebd232aae2a8d891c9de0523b8e2fe68362d06661054c81610c58565b506001600160a01b03166000908152600c60205260409020805460ff19169055565b60606003805461057d90611d15565b80601f01602080910402602001604051908101604052809291908181526020018280546105a990611d15565b80156105f65780601f106105cb576101008083540402835291602001916105f6565b820191906000526020600020905b8154815290600101906020018083116105d957829003601f168201915b5050505050905090565b60003361060e818585610c62565b5060019392505050565b600b546001600160a01b031633146106435760405163058d9a1b60e01b815260040160405180910390fd5b61064e600033610d87565b565b7fd15a633a037a8cb1e45b365d4ebd232aae2a8d891c9de0523b8e2fe68362d06661067a81610c58565b816106866000826108fb565b156106a45760405163e4183cb160e01b815260040160405180910390fd5b50506001600160a01b03166000908152600c60205260409020805460ff19166001179055565b6000336106d8858285610e10565b6106e3858585610e84565b506001949350505050565b60006106f981610c58565b82806107185760405163318bd07d60e11b815260040160405180910390fd5b6107228484610d87565b50505050565b6000610732611033565b905090565b604051637a851da960e11b815260040160405180910390fd5b60003361060e8185856107638383610bc4565b61076d9190611d5f565b610c62565b600d546001600160a01b0316331461079d57604051639cdc2ed560e01b815260040160405180910390fd5b6107a7828261115e565b5050565b6107b53382611229565b50565b60006107c381610c58565b336001600160a01b038316036107ec5760405163318bd07d60e11b815260040160405180910390fd5b600b80546001600160a01b0319166001600160a01b03848116918217909255600a54604051919216907fefdcbba819467e00b0262c12892dda980bac68580b72178e57a162368b80876690600090a35050565b61084a823383610e10565b6107a78282611229565b6001600160a01b03811660009081526007602052604081205461051c565b6000606080828080836108a67f4c6576656c2055534400000000000000000000000000000000000000000000096005611364565b6108d17f31000000000000000000000000000000000000000000000000000000000000016006611364565b60408051600080825260208201909252600f60f81b9b939a50919850469750309650945092509050565b60009182526009602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60606004805461057d90611d15565b600033816109438286610bc4565b9050838110156109a85760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084015b60405180910390fd5b6106e38286868403610c62565b60003361060e818585610e84565b60006109ce81610c58565b600e546040516001600160a01b03918216918416907fe0d49a54274423183dadecbdf239eaac6e06ba88320b26fe8cc5ec9d050a639590600090a350600e80546001600160a01b0319166001600160a01b0392909216919091179055565b83421115610a7c5760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e65000000604482015260640161099f565b60007f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9888888610aab8c61140f565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090506000610b0682611437565b90506000610b1682878787611464565b9050896001600160a01b0316816001600160a01b031614610b795760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e61747572650000604482015260640161099f565b610b848a8a8a610c62565b50505050505050505050565b6000610b9b81610c58565b8280610bba5760405163318bd07d60e11b815260040160405180910390fd5b610722848461148c565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6000610bfa81610c58565b600d546040516001600160a01b03918216918416907f1cf2de25c5bf439ac0287061c3a0fa69b3b02867d0ccfd2ded34e42577050b7390600090a350600d80546001600160a01b0319166001600160a01b0392909216919091179055565b6107b581336114f3565b6001600160a01b038316610cc45760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161099f565b6001600160a01b038216610d255760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161099f565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b81610e0657600a546040516001600160a01b038084169216907ff8ccb027dfcd135e000e9d45e6cc2d662578a8825d4c45b5e32e0adf67e79ec690600090a3600a54610dde906000906001600160a01b031661148c565b600a80546001600160a01b0383166001600160a01b031991821617909155600b805490911690555b6107a7828261154c565b6000610e1c8484610bc4565b905060001981146107225781811015610e775760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000604482015260640161099f565b6107228484848403610c62565b6001600160a01b038316610ee85760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161099f565b6001600160a01b038216610f4a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161099f565b610f558383836115d2565b6001600160a01b03831660009081526020819052604090205481811015610fcd5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b606482015260840161099f565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610722565b6000306001600160a01b037f000000000000000000000000bd286df841ccfc66e41cd5b97ad59573738caf4a1614801561108c57507f000000000000000000000000000000000000000000000000000000000000000146145b156110b657507fab25e74f604f8ef7f7e40239bf57f989640043124dd1636999c8a5f6e93d4a2790565b610732604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527fba319996c11b486d8c61c53a19137a98c5e1ab3030ca83be8063eb19a89b6b4f918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b6001600160a01b0382166111b45760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161099f565b6111c0600083836115d2565b80600260008282546111d29190611d5f565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b6001600160a01b0382166112895760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b606482015260840161099f565b611295826000836115d2565b6001600160a01b038216600090815260208190526040902054818110156113095760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b606482015260840161099f565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101610d7a565b505050565b606060ff831461137e5761137783611649565b905061051c565b81805461138a90611d15565b80601f01602080910402602001604051908101604052809291908181526020018280546113b690611d15565b80156114035780601f106113d857610100808354040283529160200191611403565b820191906000526020600020905b8154815290600101906020018083116113e657829003601f168201915b5050505050905061051c565b6001600160a01b03811660009081526007602052604090208054600181018255905b50919050565b600061051c611444611033565b8360405161190160f01b8152600281019290925260228201526042902090565b600080600061147587878787611688565b915091506114828161174c565b5095945050505050565b61149682826108fb565b156107a75760008281526009602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6114fd82826108fb565b6107a75761150a81611896565b6115158360206118a8565b604051602001611526929190611d88565b60408051601f198184030181529082905262461bcd60e51b825261099f91600401611b24565b61155682826108fb565b6107a75760008281526009602090815260408083206001600160a01b03851684529091529020805460ff1916600117905561158e3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6001600160a01b0383166000908152600c602052604090205460ff168061161157506001600160a01b0382166000908152600c602052604090205460ff165b8061162b5750336000908152600c602052604090205460ff165b1561135f5760405163445cd55760e01b815260040160405180910390fd5b6060600061165683611a4b565b604080516020808252818301909252919250600091906020820181803683375050509182525060208101929092525090565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156116bf5750600090506003611743565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015611713573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661173c57600060019250925050611743565b9150600090505b94509492505050565b600081600481111561176057611760611dfd565b036117685750565b600181600481111561177c5761177c611dfd565b036117c95760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161099f565b60028160048111156117dd576117dd611dfd565b0361182a5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161099f565b600381600481111561183e5761183e611dfd565b036107b55760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161099f565b606061051c6001600160a01b03831660145b606060006118b7836002611e13565b6118c2906002611d5f565b67ffffffffffffffff8111156118da576118da611d72565b6040519080825280601f01601f191660200182016040528015611904576020820181803683370190505b509050600360fc1b8160008151811061191f5761191f611e2a565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061194e5761194e611e2a565b60200101906001600160f81b031916908160001a9053506000611972846002611e13565b61197d906001611d5f565b90505b60018111156119f5576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106119b1576119b1611e2a565b1a60f81b8282815181106119c7576119c7611e2a565b60200101906001600160f81b031916908160001a90535060049490941c936119ee81611e40565b9050611980565b508315611a445760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161099f565b9392505050565b600060ff8216601f81111561051c57604051632cd44ac360e21b815260040160405180910390fd5b600060208284031215611a8557600080fd5b81356001600160e01b031981168114611a4457600080fd5b80356001600160a01b0381168114611ab457600080fd5b919050565b600060208284031215611acb57600080fd5b611a4482611a9d565b60005b83811015611aef578181015183820152602001611ad7565b50506000910152565b60008151808452611b10816020860160208601611ad4565b601f01601f19169290920160200192915050565b602081526000611a446020830184611af8565b60008060408385031215611b4a57600080fd5b611b5383611a9d565b946020939093013593505050565b600080600060608486031215611b7657600080fd5b611b7f84611a9d565b9250611b8d60208501611a9d565b9150604084013590509250925092565b600060208284031215611baf57600080fd5b5035919050565b60008060408385031215611bc957600080fd5b82359150611bd960208401611a9d565b90509250929050565b60ff60f81b881681526000602060e081840152611c0260e084018a611af8565b8381036040850152611c14818a611af8565b606085018990526001600160a01b038816608086015260a0850187905284810360c0860152855180825283870192509083019060005b81811015611c6657835183529284019291840191600101611c4a565b50909c9b505050505050505050505050565b600080600080600080600060e0888a031215611c9357600080fd5b611c9c88611a9d565b9650611caa60208901611a9d565b95506040880135945060608801359350608088013560ff81168114611cce57600080fd5b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215611cfe57600080fd5b611d0783611a9d565b9150611bd960208401611a9d565b600181811c90821680611d2957607f821691505b60208210810361143157634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561051c5761051c611d49565b634e487b7160e01b600052604160045260246000fd5b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611dc0816017850160208801611ad4565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351611df1816028840160208801611ad4565b01602801949350505050565b634e487b7160e01b600052602160045260246000fd5b808202811582820484141761051c5761051c611d49565b634e487b7160e01b600052603260045260246000fd5b600081611e4f57611e4f611d49565b50600019019056fea2646970667358221220d32ed0464673df19b8a0410b2493ef91bcdbe82b286a37027a75ed84329eb70e64736f6c63430008130033
{{ "language": "Solidity", "sources": { "src/lvlUSD.sol": { "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.8.19;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol\";\nimport \"@openzeppelin/contracts/access/Ownable2Step.sol\";\nimport \"./interfaces/IlvlUSDDefinitions.sol\";\nimport \"./SingleAdminAccessControl.sol\";\n\n/**\n * @title lvlUSD\n * @notice lvlUSD contract\n */\ncontract lvlUSD is\n ERC20Burnable,\n ERC20Permit,\n IlvlUSDDefinitions,\n SingleAdminAccessControl\n{\n /// @notice The role that is allowed to denylist and un-denylist addresses\n bytes32 private constant DENYLIST_MANAGER_ROLE =\n keccak256(\"DENYLIST_MANAGER_ROLE\");\n\n mapping(address => bool) public denylisted;\n\n address public minter;\n\n address public slasher;\n\n constructor(\n address admin\n ) ERC20(\"Level USD\", \"lvlUSD\") ERC20Permit(\"Level USD\") {\n if (admin == address(0)) revert ZeroAddressException();\n _grantRole(DEFAULT_ADMIN_ROLE, admin);\n _grantRole(DENYLIST_MANAGER_ROLE, admin);\n }\n\n modifier notOwner(address account) {\n if (hasRole(DEFAULT_ADMIN_ROLE, account)) revert IsOwner();\n _;\n }\n\n function setMinter(\n address newMinter\n ) external onlyRole(DEFAULT_ADMIN_ROLE) {\n emit MinterUpdated(newMinter, minter);\n minter = newMinter;\n }\n\n function setSlasher(\n address newSlasher\n ) external onlyRole(DEFAULT_ADMIN_ROLE) {\n emit SlasherUpdated(newSlasher, slasher);\n slasher = newSlasher;\n }\n\n function mint(address to, uint256 amount) external {\n if (msg.sender != minter) revert OnlyMinter();\n _mint(to, amount);\n }\n\n /**\n * @dev Remove renounce role access from AccessControl, to prevent users from resigning from roles.\n */\n function renounceRole(bytes32, address) public virtual override {\n revert OperationNotAllowed();\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning. Disables transfers from or to of addresses with the DENYLISTED_ROLE role.\n */\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256\n ) internal virtual override {\n if (denylisted[from] || denylisted[to] || denylisted[msg.sender]) {\n revert Denylisted();\n }\n }\n\n /**\n * @notice Allows the owner (DEFAULT_ADMIN_ROLE) and denylist managers to denylist addresses.\n * @param target The address to denylist.\n */\n function addToDenylist(\n address target\n ) external onlyRole(DENYLIST_MANAGER_ROLE) notOwner(target) {\n denylisted[target] = true;\n }\n\n /**\n * @notice Allows denylist managers to remove addresses from the denylist.\n * @param target The address to remove from the denylist.\n */\n function removeFromDenylist(\n address target\n ) external onlyRole(DENYLIST_MANAGER_ROLE) {\n denylisted[target] = false;\n }\n}\n" }, "lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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 * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\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 * 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 default value returned by this function, unless\n * it's 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(address from, address to, uint256 amount) 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(address from, address to, uint256 amount) 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(address owner, address spender, uint256 amount) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev 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(address owner, address spender, uint256 amount) 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(address from, address to, uint256 amount) 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(address from, address to, uint256 amount) internal virtual {}\n}\n" }, "lib/openzeppelin-contracts/contracts/token/ERC20/extensions/ERC20Burnable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Burnable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC20.sol\";\nimport \"../../../utils/Context.sol\";\n\n/**\n * @dev Extension of {ERC20} that allows token holders to destroy both their own\n * tokens and those that they have an allowance for, in a way that can be\n * recognized off-chain (via event analysis).\n */\nabstract contract ERC20Burnable is Context, ERC20 {\n /**\n * @dev Destroys `amount` tokens from the caller.\n *\n * See {ERC20-_burn}.\n */\n function burn(uint256 amount) public virtual {\n _burn(_msgSender(), amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, deducting from the caller's\n * allowance.\n *\n * See {ERC20-_burn} and {ERC20-allowance}.\n *\n * Requirements:\n *\n * - the caller must have allowance for ``accounts``'s tokens of at least\n * `amount`.\n */\n function burnFrom(address account, uint256 amount) public virtual {\n _spendAllowance(account, _msgSender(), amount);\n _burn(account, amount);\n }\n}\n" }, "lib/openzeppelin-contracts/contracts/token/ERC20/extensions/ERC20Permit.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/ERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./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" }, "lib/openzeppelin-contracts/contracts/access/Ownable2Step.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./Ownable.sol\";\n\n/**\n * @dev Contract module which provides 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} and {acceptOwnership}.\n *\n * This module is used through inheritance. It will make available all functions\n * from parent (Ownable).\n */\nabstract contract Ownable2Step is Ownable {\n address private _pendingOwner;\n\n event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Returns the address of the pending owner.\n */\n function pendingOwner() public view virtual returns (address) {\n return _pendingOwner;\n }\n\n /**\n * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual override onlyOwner {\n _pendingOwner = newOwner;\n emit OwnershipTransferStarted(owner(), newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual override {\n delete _pendingOwner;\n super._transferOwnership(newOwner);\n }\n\n /**\n * @dev The new owner accepts the ownership transfer.\n */\n function acceptOwnership() public virtual {\n address sender = _msgSender();\n require(pendingOwner() == sender, \"Ownable2Step: caller is not the new owner\");\n _transferOwnership(sender);\n }\n}\n" }, "src/interfaces/IlvlUSDDefinitions.sol": { "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.8.19;\n\n/// @dev Changelog: changed solidity version and name\ninterface IlvlUSDDefinitions {\n /// @notice This event is fired when the minter changes\n event MinterUpdated(address indexed newMinter, address indexed oldMinter);\n /// @notice This event is fired when the slasher changes\n event SlasherUpdated(\n address indexed newSlasher,\n address indexed oldSlasher\n );\n\n /// @notice Zero address not allowed\n error ZeroAddressException();\n /// @notice It's not possible to renounce the ownership\n error OperationNotAllowed();\n /// @notice Only the minter role can perform an action\n error OnlyMinter();\n /// @notice Address is denylisted\n error Denylisted();\n /// @notice Address is owner\n error IsOwner();\n}\n" }, "src/SingleAdminAccessControl.sol": { "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.8.19;\n\nimport \"@openzeppelin/contracts/access/AccessControl.sol\";\nimport \"@openzeppelin/contracts/interfaces/IERC5313.sol\";\nimport \"./interfaces/ISingleAdminAccessControl.sol\";\n\n/**\n * @title SingleAdminAccessControl\n * @notice SingleAdminAccessControl is a contract that provides a single admin role\n * @notice This contract is a simplified alternative to OpenZeppelin's AccessControlDefaultAdminRules\n * @dev Changelog: update solidity versions\n */\nabstract contract SingleAdminAccessControl is\n IERC5313,\n ISingleAdminAccessControl,\n AccessControl\n{\n address private _currentDefaultAdmin;\n address private _pendingDefaultAdmin;\n\n modifier notAdmin(bytes32 role) {\n if (role == DEFAULT_ADMIN_ROLE) revert InvalidAdminChange();\n _;\n }\n\n /// @notice Transfer the admin role to a new address\n /// @notice This can ONLY be executed by the current admin\n /// @param newAdmin address\n function transferAdmin(\n address newAdmin\n ) external onlyRole(DEFAULT_ADMIN_ROLE) {\n if (newAdmin == msg.sender) revert InvalidAdminChange();\n _pendingDefaultAdmin = newAdmin;\n emit AdminTransferRequested(_currentDefaultAdmin, newAdmin);\n }\n\n function acceptAdmin() external {\n if (msg.sender != _pendingDefaultAdmin) revert NotPendingAdmin();\n _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);\n }\n\n /// @notice grant a role\n /// @notice can only be executed by the current single admin\n /// @notice admin role cannot be granted externally\n /// @param role bytes32\n /// @param account address\n function grantRole(\n bytes32 role,\n address account\n ) public override onlyRole(DEFAULT_ADMIN_ROLE) notAdmin(role) {\n _grantRole(role, account);\n }\n\n /// @notice revoke a role\n /// @notice can only be executed by the current admin\n /// @notice admin role cannot be revoked\n /// @param role bytes32\n /// @param account address\n function revokeRole(\n bytes32 role,\n address account\n ) public override onlyRole(DEFAULT_ADMIN_ROLE) notAdmin(role) {\n _revokeRole(role, account);\n }\n\n /// @notice renounce the role of msg.sender\n /// @notice admin role cannot be renounced\n /// @param role bytes32\n /// @param account address\n function renounceRole(\n bytes32 role,\n address account\n ) public virtual override notAdmin(role) {\n super.renounceRole(role, account);\n }\n\n /**\n * @dev See {IERC5313-owner}.\n */\n function owner() public view virtual returns (address) {\n return _currentDefaultAdmin;\n }\n\n /**\n * @notice no way to change admin without removing old admin first\n */\n function _grantRole(bytes32 role, address account) internal override {\n if (role == DEFAULT_ADMIN_ROLE) {\n emit AdminTransferred(_currentDefaultAdmin, account);\n _revokeRole(DEFAULT_ADMIN_ROLE, _currentDefaultAdmin);\n _currentDefaultAdmin = account;\n delete _pendingDefaultAdmin;\n }\n super._grantRole(role, account);\n }\n}\n" }, "lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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(address from, address to, uint256 amount) external returns (bool);\n}\n" }, "lib/openzeppelin-contracts/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" }, "lib/openzeppelin-contracts/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" }, "lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Permit.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/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" }, "lib/openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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(bytes32 hash, bytes32 r, bytes32 vs) 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(bytes32 hash, bytes32 r, bytes32 vs) 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(bytes32 hash, uint8 v, bytes32 r, bytes32 s) 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(bytes32 hash, uint8 v, bytes32 r, bytes32 s) 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 message) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, \"\\x19Ethereum Signed Message:\\n32\")\n mstore(0x1c, hash)\n message := keccak256(0x00, 0x3c)\n }\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 data) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40)\n mstore(ptr, \"\\x19\\x01\")\n mstore(add(ptr, 0x02), domainSeparator)\n mstore(add(ptr, 0x22), structHash)\n data := keccak256(ptr, 0x42)\n }\n }\n\n /**\n * @dev Returns an Ethereum Signed Data with intended validator, created from a\n * `validator` and `data` according to the version 0 of EIP-191.\n *\n * See {recover}.\n */\n function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x00\", validator, data));\n }\n}\n" }, "lib/openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol)\n\npragma solidity ^0.8.8;\n\nimport \"./ECDSA.sol\";\nimport \"../ShortStrings.sol\";\nimport \"../../interfaces/IERC5267.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 * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain\n * separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the\n * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.\n *\n * _Available since v3.4._\n *\n * @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\n */\nabstract contract EIP712 is IERC5267 {\n using ShortStrings for *;\n\n bytes32 private constant _TYPE_HASH =\n keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n\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 _cachedDomainSeparator;\n uint256 private immutable _cachedChainId;\n address private immutable _cachedThis;\n\n bytes32 private immutable _hashedName;\n bytes32 private immutable _hashedVersion;\n\n ShortString private immutable _name;\n ShortString private immutable _version;\n string private _nameFallback;\n string private _versionFallback;\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 _name = name.toShortStringWithFallback(_nameFallback);\n _version = version.toShortStringWithFallback(_versionFallback);\n _hashedName = keccak256(bytes(name));\n _hashedVersion = keccak256(bytes(version));\n\n _cachedChainId = block.chainid;\n _cachedDomainSeparator = _buildDomainSeparator();\n _cachedThis = address(this);\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) == _cachedThis && block.chainid == _cachedChainId) {\n return _cachedDomainSeparator;\n } else {\n return _buildDomainSeparator();\n }\n }\n\n function _buildDomainSeparator() private view returns (bytes32) {\n return keccak256(abi.encode(_TYPE_HASH, _hashedName, _hashedVersion, 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 /**\n * @dev See {EIP-5267}.\n *\n * _Available since v4.9._\n */\n function eip712Domain()\n public\n view\n virtual\n override\n returns (\n bytes1 fields,\n string memory name,\n string memory version,\n uint256 chainId,\n address verifyingContract,\n bytes32 salt,\n uint256[] memory extensions\n )\n {\n return (\n hex\"0f\", // 01111\n _name.toStringWithFallback(_nameFallback),\n _version.toStringWithFallback(_versionFallback),\n block.chainid,\n address(this),\n bytes32(0),\n new uint256[](0)\n );\n }\n}\n" }, "lib/openzeppelin-contracts/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" }, "lib/openzeppelin-contracts/contracts/access/Ownable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling 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" }, "lib/openzeppelin-contracts/contracts/access/AccessControl.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControl.sol\";\nimport \"../utils/Context.sol\";\nimport \"../utils/Strings.sol\";\nimport \"../utils/introspection/ERC165.sol\";\n\n/**\n * @dev 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 * ```solidity\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 * ```solidity\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. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\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 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]{40}) is missing role (0x[0-9a-f]{64})$/\n *\n * _Available since v4.1._\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\n return _roles[role].members[account];\n }\n\n /**\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\n * Overriding this function changes the behavior of the {onlyRole} modifier.\n *\n * Format of the revert message is described in {_checkRole}.\n *\n * _Available since v4.6._\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\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]{40}) is missing role (0x[0-9a-f]{64})$/\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert(\n string(\n abi.encodePacked(\n \"AccessControl: account \",\n Strings.toHexString(account),\n \" is missing role \",\n Strings.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 virtual override 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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual override 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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual override 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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address account) public virtual override {\n require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\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 * May emit a {RoleGranted} event.\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 * NOTE: This function is deprecated in favor of {_grantRole}.\n */\n function _setupRole(bytes32 role, address account) internal virtual {\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 virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n emit RoleGranted(role, account, _msgSender());\n }\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n }\n }\n}\n" }, "lib/openzeppelin-contracts/contracts/interfaces/IERC5313.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5313.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface for the Light Contract Ownership Standard.\n *\n * A standardized minimal interface required to identify an account that controls a contract\n *\n * _Available since v4.9._\n */\ninterface IERC5313 {\n /**\n * @dev Gets the address of the owner.\n */\n function owner() external view returns (address);\n}\n" }, "src/interfaces/ISingleAdminAccessControl.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\ninterface ISingleAdminAccessControl {\n error InvalidAdminChange();\n error NotPendingAdmin();\n\n event AdminTransferred(address indexed oldAdmin, address indexed newAdmin);\n event AdminTransferRequested(\n address indexed oldAdmin,\n address indexed newAdmin\n );\n}\n" }, "lib/openzeppelin-contracts/contracts/utils/Strings.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\nimport \"./math/SignedMath.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 `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value))));\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 /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" }, "lib/openzeppelin-contracts/contracts/utils/ShortStrings.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/ShortStrings.sol)\n\npragma solidity ^0.8.8;\n\nimport \"./StorageSlot.sol\";\n\n// | string | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |\n// | length | 0x BB |\ntype ShortString is bytes32;\n\n/**\n * @dev This library provides functions to convert short memory strings\n * into a `ShortString` type that can be used as an immutable variable.\n *\n * Strings of arbitrary length can be optimized using this library if\n * they are short enough (up to 31 bytes) by packing them with their\n * length (1 byte) in a single EVM word (32 bytes). Additionally, a\n * fallback mechanism can be used for every other case.\n *\n * Usage example:\n *\n * ```solidity\n * contract Named {\n * using ShortStrings for *;\n *\n * ShortString private immutable _name;\n * string private _nameFallback;\n *\n * constructor(string memory contractName) {\n * _name = contractName.toShortStringWithFallback(_nameFallback);\n * }\n *\n * function name() external view returns (string memory) {\n * return _name.toStringWithFallback(_nameFallback);\n * }\n * }\n * ```\n */\nlibrary ShortStrings {\n // Used as an identifier for strings longer than 31 bytes.\n bytes32 private constant _FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF;\n\n error StringTooLong(string str);\n error InvalidShortString();\n\n /**\n * @dev Encode a string of at most 31 chars into a `ShortString`.\n *\n * This will trigger a `StringTooLong` error is the input string is too long.\n */\n function toShortString(string memory str) internal pure returns (ShortString) {\n bytes memory bstr = bytes(str);\n if (bstr.length > 31) {\n revert StringTooLong(str);\n }\n return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length));\n }\n\n /**\n * @dev Decode a `ShortString` back to a \"normal\" string.\n */\n function toString(ShortString sstr) internal pure returns (string memory) {\n uint256 len = byteLength(sstr);\n // using `new string(len)` would work locally but is not memory safe.\n string memory str = new string(32);\n /// @solidity memory-safe-assembly\n assembly {\n mstore(str, len)\n mstore(add(str, 0x20), sstr)\n }\n return str;\n }\n\n /**\n * @dev Return the length of a `ShortString`.\n */\n function byteLength(ShortString sstr) internal pure returns (uint256) {\n uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF;\n if (result > 31) {\n revert InvalidShortString();\n }\n return result;\n }\n\n /**\n * @dev Encode a string into a `ShortString`, or write it to storage if it is too long.\n */\n function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) {\n if (bytes(value).length < 32) {\n return toShortString(value);\n } else {\n StorageSlot.getStringSlot(store).value = value;\n return ShortString.wrap(_FALLBACK_SENTINEL);\n }\n }\n\n /**\n * @dev Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}.\n */\n function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) {\n if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) {\n return toString(value);\n } else {\n return store;\n }\n }\n\n /**\n * @dev Return the length of a string that was encoded to `ShortString` or written to storage using {setWithFallback}.\n *\n * WARNING: This will return the \"byte length\" of the string. This may not reflect the actual length in terms of\n * actual characters as the UTF-8 encoding of a single character can span over multiple bytes.\n */\n function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) {\n if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) {\n return byteLength(value);\n } else {\n return bytes(store).length;\n }\n }\n}\n" }, "lib/openzeppelin-contracts/contracts/interfaces/IERC5267.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol)\n\npragma solidity ^0.8.0;\n\ninterface IERC5267 {\n /**\n * @dev MAY be emitted to signal that the domain could have changed.\n */\n event EIP712DomainChanged();\n\n /**\n * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712\n * signature.\n */\n function eip712Domain()\n external\n view\n returns (\n bytes1 fields,\n string memory name,\n string memory version,\n uint256 chainId,\n address verifyingContract,\n bytes32 salt,\n uint256[] memory extensions\n );\n}\n" }, "lib/openzeppelin-contracts/contracts/access/IAccessControl.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControl {\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 {AccessControl-_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 Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) external view returns (bool);\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 {AccessControl-_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\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;\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;\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}\n" }, "lib/openzeppelin-contracts/contracts/utils/introspection/ERC165.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" }, "lib/openzeppelin-contracts/contracts/utils/math/Math.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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 256, 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 << 3) < value ? 1 : 0);\n }\n }\n}\n" }, "lib/openzeppelin-contracts/contracts/utils/math/SignedMath.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" }, "lib/openzeppelin-contracts/contracts/utils/StorageSlot.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\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 * ```solidity\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`, `uint256`._\n * _Available since v4.9 for `string`, `bytes`._\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 struct StringSlot {\n string value;\n }\n\n struct BytesSlot {\n bytes 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 /**\n * @dev Returns an `StringSlot` with member `value` located at `slot`.\n */\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\n */\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` with member `value` located at `slot`.\n */\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\n */\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n}\n" }, "lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" } }, "settings": { "remappings": [ "ds-test/=lib/ds-test/src/", "forge-std/=lib/forge-std/src/", "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "openzeppelin/=lib/openzeppelin-contracts/contracts/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "libraries": {} } }}
1
20,290,495
0dd50989a82d9042c743656b80000cf85bec9790cd6c687f5081f41a31aebcf7
03e205c45bfd4a9fa7826c4fe41494b43a532e8891ec090c2673d49115315e29
e9af0428143e4509df4379bd10c4850b223f2ecb
e9af0428143e4509df4379bd10c4850b223f2ecb
3f21a48cef6a2012330f2cec8896295e46e2df7f
60e06040523480156200001157600080fd5b5060405162003683380380620036838339810160408190526200003491620009a6565b60016003556001600160a01b03861662000061576040516319936d2560e01b815260040160405180910390fd5b845160000362000084576040516337791ce560e21b815260040160405180910390fd5b6001600160a01b038316620000ac5760405163f6b2911f60e01b815260040160405180910390fd5b6001600160a01b038616608052620000c66000336200027d565b60005b8551811015620001155762000100868281518110620000ec57620000ec62000a4e565b60200260200101516200030f60201b60201c565b806200010c8162000a7a565b915050620000c9565b5060005b84518110156200016557620001508582815181106200013c576200013c62000a4e565b6020026020010151620003b360201b60201c565b806200015c8162000a7a565b91505062000119565b50620001718262000457565b6200017c8162000490565b336001600160a01b038416146200019a576200019a6000846200027d565b4660a0818152604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6020808301919091527f2ca1b65876de036d7d1f964e87de7ed55488222b5385a8e54bc3e1a672c9cc6d828401527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060830152608082019490945230818401528151808203909301835260c0019052805191012060c0526040516001600160a01b038716907f5b8a6084ba8bfd086f0d61461ef7243827305e029ea7a7888d0eca78c7bd9da590600090a250505050505062000bb4565b81620002ff576001546040516001600160a01b038084169216907ff8ccb027dfcd135e000e9d45e6cc2d662578a8825d4c45b5e32e0adf67e79ec690600090a3600154620002d7906000906001600160a01b0316620004c9565b600180546001600160a01b0383166001600160a01b0319918216179091556002805490911690555b6200030b828262000549565b5050565b60006200031c81620005e9565b6001600160a01b03821615806200034657506080516001600160a01b0316826001600160a01b0316145b806200035c57506200035a600483620005f8565b155b156200037b57604051630ccd248560e21b815260040160405180910390fd5b6040516001600160a01b038316907f0e3c58ebfb2e7465fbb1c32e6b4f40c3c4f5ca77e8218a386aff8617831260d790600090a25050565b6000620003c081620005e9565b6001600160a01b0382161580620003ea57506080516001600160a01b0316826001600160a01b0316145b80620004005750620003fe600683620005f8565b155b156200041f5760405163565c062f60e11b815260040160405180910390fd5b6040516001600160a01b038316907ffbd30b5bdd51f5de989170dc23d65aac2de0a6099f5d9d200bc5779d883abcd490600090a25050565b600c805490829055604051829082907fb4a832eb73ba0066dc45acd0d1f4454cdee155b17bdb1ccbabb428cc39750ad190600090a35050565b600d805490829055604051829082907f6fd3eacad9328fdc902c323518cfef3a2f6a9da89c40a7b82428adc2370114c390600090a35050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16156200030b576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166200030b576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620005a53390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b620005f5813362000618565b50565b60006200060f836001600160a01b0384166200069d565b90505b92915050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166200030b576200064c81620006ef565b6200065983602062000702565b6040516020016200066c92919062000abc565b60408051601f198184030181529082905262461bcd60e51b8252620006949160040162000b35565b60405180910390fd5b6000818152600183016020526040812054620006e65750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000612565b50600062000612565b6060620006126001600160a01b03831660145b606060006200071383600262000b6a565b6200072090600262000b84565b6001600160401b038111156200073a576200073a620008d1565b6040519080825280601f01601f19166020018201604052801562000765576020820181803683370190505b509050600360fc1b8160008151811062000783576200078362000a4e565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110620007b557620007b562000a4e565b60200101906001600160f81b031916908160001a9053506000620007db84600262000b6a565b620007e890600162000b84565b90505b60018111156200086a576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811062000820576200082062000a4e565b1a60f81b82828151811062000839576200083962000a4e565b60200101906001600160f81b031916908160001a90535060049490941c93620008628162000b9a565b9050620007eb565b5083156200060f5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640162000694565b6001600160a01b0381168114620005f557600080fd5b634e487b7160e01b600052604160045260246000fd5b8051620008f481620008bb565b919050565b600082601f8301126200090b57600080fd5b815160206001600160401b03808311156200092a576200092a620008d1565b8260051b604051601f19603f83011681018181108482111715620009525762000952620008d1565b6040529384528581018301938381019250878511156200097157600080fd5b83870191505b848210156200099b576200098b82620008e7565b8352918301919083019062000977565b979650505050505050565b60008060008060008060c08789031215620009c057600080fd5b8651620009cd81620008bb565b60208801519096506001600160401b0380821115620009eb57600080fd5b620009f98a838b01620008f9565b9650604089015191508082111562000a1057600080fd5b5062000a1f89828a01620008f9565b945050606087015162000a3281620008bb565b809350506080870151915060a087015190509295509295509295565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006001820162000a8f5762000a8f62000a64565b5060010190565b60005b8381101562000ab357818101518382015260200162000a99565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835162000af681601785016020880162000a96565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835162000b2981602884016020880162000a96565b01602801949350505050565b602081526000825180602084015262000b5681604085016020870162000a96565b601f01601f19169190910160400192915050565b808202811582820484141762000612576200061262000a64565b8082018082111562000612576200061262000a64565b60008162000bac5762000bac62000a64565b506000190190565b60805160a05160c051612a8362000c0060003960006114ed015260006114c501526000818161039c01528181610b2201528181610e85015281816111cb01526116680152612a836000f3fe608060405234801561001057600080fd5b50600436106102275760003560e01c8063844452fa11610130578063c5ff38bd116100b8578063d8f065bd1161007c578063d8f065bd14610502578063e0f3fc9f14610522578063ed24911d14610535578063f4ee2a8b1461053d578063fac09e871461057257600080fd5b8063c5ff38bd14610493578063cf9cc7661461049b578063d48c03e5146104c9578063d547741f146104dc578063d8369d75146104ef57600080fd5b806395165e8b116100ff57806395165e8b146104325780639be918e6146104455780639cd2913614610458578063a217fddf1461046b578063b6c780631461047357600080fd5b8063844452fa146103fc5780638da5cb5b1461040557806391d1485414610416578063928907dd1461042957600080fd5b8063402a8d37116101b3578063532c3f8211610182578063532c3f821461037157806353863613146103845780635392e6d91461039757806354f1e126146103d657806375829def146103e957600080fd5b8063402a8d371461030e57806340e49216146103385780634ba87af91461034b5780634be7a64b1461035e57600080fd5b80631c46bc6f116101fa5780631c46bc6f14610292578063248a9ca3146102a55780632ba32991146102c85780632f2ff15d146102e857806336568abe146102fb57600080fd5b806301ffc9a71461022c578063068f3877146102545780630e18b6811461026757806319bfcdec14610271575b600080fd5b61023f61023a366004612484565b610585565b60405190151581526020015b60405180910390f35b61023f6102623660046124da565b6105bc565b61026f610758565b005b61028461027f36600461253b565b610790565b60405190815260200161024b565b61026f6102a036600461256f565b6107cc565b6102846102b336600461258a565b60009081526020819052604090206001015490565b6102846102d636600461258a565b60096020526000908152604090205481565b61026f6102f63660046125a3565b610837565b61026f6103093660046125a3565b610871565b61032161031c3660046125c6565b61089f565b60408051921515835260208301919091520161024b565b61026f61034636600461256f565b610a43565b61026f61035936600461256f565b610a99565b61026f61036c36600461256f565b610b04565b61026f61037f36600461256f565b610bbf565b61026f61039236600461256f565b610c17565b6103be7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161024b565b61026f6103e436600461256f565b610c70565b61026f6103f736600461256f565b610cc4565b610284600d5481565b6001546001600160a01b03166103be565b61023f6104243660046125a3565b610d4b565b610284600c5481565b61026f6104403660046125c6565b610d74565b61023f61045336600461256f565b610fe6565b61026f61046636600461258a565b610ff3565b610284600081565b61028461048136600461258a565b600a6020526000908152604090205481565b61026f611007565b61023f6104a9366004612617565b600b60209081526000928352604080842090915290825290205460ff1681565b61026f6104d7366004612641565b611048565b61026f6104ea3660046125a3565b6112fd565b61026f6104fd36600461258a565b611331565b61051561051036600461253b565b611345565b60405161024b9190612709565b61026f61053036600461271c565b6113e7565b6102846114c1565b61055061054b366004612758565b6115bc565b604080519415158552602085019390935291830152606082015260800161024b565b61026f61058036600461256f565b61164a565b60006001600160e01b03198216637965db0b60e01b14806105b657506301ffc9a760e01b6001600160e01b03198316145b92915050565b600060018260018111156105d2576105d2612782565b036105df575060016105b6565b60006105ee6020850185612798565b90506105fa8580612798565b90501461060b5760009150506105b6565b6106158480612798565b90506000036106285760009150506105b6565b60005b6106358580612798565b905081101561073a5761067861064b8680612798565b8381811061065b5761065b6127e2565b9050602002016020810190610670919061256f565b600690611705565b15806106bb5750600061068b8680612798565b8381811061069b5761069b6127e2565b90506020020160208101906106b0919061256f565b6001600160a01b0316145b806106e957506106ce6020860186612798565b828181106106de576106de6127e2565b905060200201356000145b156106f9576000925050506105b6565b6107066020860186612798565b82818110610716576107166127e2565b9050602002013582610728919061280e565b915061073381612821565b905061062b565b50806127101461074e5760009150506105b6565b5060019392505050565b6002546001600160a01b031633146107835760405163058d9a1b60e01b815260040160405180910390fd5b61078e60003361172a565b565b60006105b661079d6114c1565b6107a684611345565b8051906020012060405161190160f01b8152600281019290925260228201526042902090565b60006107d7816117b3565b6107e26004836117bd565b6107ff57604051630ccd248560e21b815260040160405180910390fd5b6040516001600160a01b038316907f37803e2125c48ee96c38ddf04e826daf335b0e1603579040fd275aba6d06b6fc90600090a25050565b6000610842816117b3565b82806108615760405163318bd07d60e11b815260040160405180910390fd5b61086b848461172a565b50505050565b81806108905760405163318bd07d60e11b815260040160405180910390fd5b61089a83836117d2565b505050565b60008060006108ad85610790565b905060006108fc826108c2602088018861283a565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061185192505050565b905061090e608087016060880161256f565b6001600160a01b0316816001600160a01b0316148061096f57506001600160a01b0381166000908152600b60205260408120906109516080890160608a0161256f565b6001600160a01b0316815260208101919091526040016000205460ff165b61098c57604051638baa579f60e01b815260040160405180910390fd5b600061099e60a088016080890161256f565b6001600160a01b0316036109c55760405163162908e360e11b815260040160405180910390fd5b8560c001356000036109ea5760405163162908e360e11b815260040160405180910390fd5b8560e00135600003610a0f5760405163162908e360e11b815260040160405180910390fd5b8560200135421115610a3457604051630819bdcd60e01b815260040160405180910390fd5b506001925090505b9250929050565b6001600160a01b0381166000818152600b60209081526040808320338085529252808320805460ff19169055519092917f97b59d736dc70ae61c6b68295c19a1311cc4a48cbb9eb25c4dabf18c7f650a8a91a350565b6000610aa4816117b3565b610aaf6006836117bd565b610acc5760405163565c062f60e11b815260040160405180910390fd5b6040516001600160a01b038316907f75567811df62a6b68bd5ee394d5808ad7282e19541858be466bc789cad9d4dfb90600090a25050565b6000610b0f816117b3565b6001600160a01b0382161580610b5657507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b0316145b80610b695750610b67600683611875565b155b15610b875760405163565c062f60e11b815260040160405180910390fd5b6040516001600160a01b038316907ffbd30b5bdd51f5de989170dc23d65aac2de0a6099f5d9d200bc5779d883abcd490600090a25050565b7f3c63e605be3290ab6b04cfc46c6e1516e626d43236b034f09d7ede1d017beb0c610be9816117b3565b610c137f44ac9762eec3a11893fefb11d028bb3102560094137c3ed4518712475b2577cc8361188a565b5050565b6001600160a01b0381166000818152600b60209081526040808320338085529252808320805460ff19166001179055519092917fed6a1f03e365a374bf7e9fe68b09cf74960528af699108cb461241efc5ded90991a350565b7f3c63e605be3290ab6b04cfc46c6e1516e626d43236b034f09d7ede1d017beb0c610c9a816117b3565b610c137f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a68361188a565b6000610ccf816117b3565b336001600160a01b03831603610cf85760405163318bd07d60e11b815260040160405180910390fd5b600280546001600160a01b0319166001600160a01b03848116918217909255600154604051919216907fefdcbba819467e00b0262c12892dda980bac68580b72178e57a162368b80876690600090a35050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b610d7c6118ef565b7f44ac9762eec3a11893fefb11d028bb3102560094137c3ed4518712475b2577cc610da6816117b3565b600d54436000908152600a602052604090205460e08501359190610dcb90839061280e565b1115610dea576040516326a753e760e11b815260040160405180910390fd5b6001610df96020860186612881565b6001811115610e0a57610e0a612782565b14610e285760405163af61069360e01b815260040160405180910390fd5b610e32848461089f565b50610e529050610e48608086016060870161256f565b8560400135611948565b50436000908152600a60205260408120805460e08701359290610e7690849061280e565b90915550506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166379cc6790610eba608087016060880161256f565b60405160e083811b6001600160e01b03191682526001600160a01b03929092166004820152908701356024820152604401600060405180830381600087803b158015610f0557600080fd5b505af1158015610f19573d6000803e3d6000fd5b50610f4c9250610f3291505060a086016080870161256f565b610f4260c0870160a0880161256f565b8660c0013561198f565b60e084013560c08501803590610f659060a0880161256f565b6001600160a01b03167f18fd144d7dbcbaa6f00fd47a84adc7dc3cc64a326ffa2dc7691a25e3837dba0333610fa060808a0160608b0161256f565b610fb060a08b0160808c0161256f565b604080516001600160a01b039485168152928416602084015292168183015290519081900360600190a45050610c136001600355565b60006105b6600483611705565b6000610ffe816117b3565b610c13826119cb565b7f3c63e605be3290ab6b04cfc46c6e1516e626d43236b034f09d7ede1d017beb0c611031816117b3565b61103b60006119cb565b6110456000611a04565b50565b6110506118ef565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a661107a816117b3565b600c544360009081526009602052604090205460e0860135919061109f90839061280e565b11156110be57604051630fbf0bc960e01b815260040160405180910390fd5b60006110cd6020870187612881565b60018111156110de576110de612782565b146110fc5760405163af61069360e01b815260040160405180910390fd5b611106858461089f565b5061111a9050846102626020880188612881565b6111375760405163427282e960e11b815260040160405180910390fd5b61115461114a608087016060880161256f565b8660400135611948565b50436000908152600960205260408120805460e0880135929061117890849061280e565b909155506111c1905060c086018035906111959060a0890161256f565b6111a56080890160608a0161256f565b6111af8880612798565b6111bc60208b018b612798565b611a3d565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166340c10f1961120060a088016080890161256f565b60405160e083811b6001600160e01b03191682526001600160a01b03929092166004820152908801356024820152604401600060405180830381600087803b15801561124b57600080fd5b505af115801561125f573d6000803e3d6000fd5b5050505060e085013560c0860180359061127c9060a0890161256f565b6001600160a01b03167ff114ca9eb82947af39f957fa726280fd3d5d81c3d7635a4aeb5c302962856eba336112b760808b0160608c0161256f565b6112c760a08c0160808d0161256f565b604080516001600160a01b039485168152928416602084015292168183015290519081900360600190a4505061089a6001600355565b6000611308816117b3565b82806113275760405163318bd07d60e11b815260040160405180910390fd5b61086b848461188a565b600061133c816117b3565b610c1382611a04565b60607fcf01f9b2d07c5e0679a7f97700240fe7bf2c828cab66850d13c62b02a869d1806113756020840184612881565b6020840135604085013561138f608087016060880161256f565b61139f60a088016080890161256f565b6113af60c0890160a08a0161256f565b8860c001358960e001356040516020016113d19998979695949392919061289c565b6040516020818303038152906040529050919050565b6113ef6118ef565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6611419816117b3565b6001600160a01b03841615806114375750611435600685611705565b155b156114555760405163e6c4247b60e01b815260040160405180910390fd5b6114696001600160a01b0384168584611b67565b826001600160a01b0316846001600160a01b03167f90c5d8794dcf7c60ab2d20912d5228389b28f74d32af01e40894a784a90b9ac2846040516114ae91815260200190565b60405180910390a35061089a6001600355565b60007f0000000000000000000000000000000000000000000000000000000000000000460361150f57507f000000000000000000000000000000000000000000000000000000000000000090565b6115b7604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f2ca1b65876de036d7d1f964e87de7ed55488222b5385a8e54bc3e1a672c9cc6d918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b905090565b600080600080846000036115e357604051633ab3447f60e11b815260040160405180910390fd5b6001600160a01b03861660009081526008602081815260408084209289901c8085529183905290922054600160ff89161b91908083161561163757604051633ab3447f60e11b815260040160405180910390fd5b60019a9399509750909550909350505050565b6000611655816117b3565b6001600160a01b038216158061169c57507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b0316145b806116af57506116ad600483611875565b155b156116cd57604051630ccd248560e21b815260040160405180910390fd5b6040516001600160a01b038316907f0e3c58ebfb2e7465fbb1c32e6b4f40c3c4f5ca77e8218a386aff8617831260d790600090a25050565b6001600160a01b038116600090815260018301602052604081205415155b9392505050565b816117a9576001546040516001600160a01b038084169216907ff8ccb027dfcd135e000e9d45e6cc2d662578a8825d4c45b5e32e0adf67e79ec690600090a3600154611781906000906001600160a01b031661188a565b600180546001600160a01b0383166001600160a01b0319918216179091556002805490911690555b610c138282611bca565b6110458133611c4e565b6000611723836001600160a01b038416611ca7565b6001600160a01b03811633146118475760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b610c13828261188a565b60008060006118608585611d9a565b9150915061186d81611ddc565b509392505050565b6000611723836001600160a01b038416611f26565b6118948282610d4b565b15610c13576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6002600354036119415760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161183e565b6002600355565b600080600080600061195a87876115bc565b6001600160a01b038b166000908152600860209081526040808320958352949052929092209117905594505050505092915050565b61199a600483611705565b6119b757604051630928045160e21b815260040160405180910390fd5b61089a6001600160a01b0383168483611b67565b600c805490829055604051829082907fb4a832eb73ba0066dc45acd0d1f4454cdee155b17bdb1ccbabb428cc39750ad190600090a35050565b600d805490829055604051829082907f6fd3eacad9328fdc902c323518cfef3a2f6a9da89c40a7b82428adc2370114c390600090a35050565b611a48600487611705565b611a6557604051630928045160e21b815260040160405180910390fd5b85600080805b611a7660018861290b565b811015611b0957612710868683818110611a9257611a926127e2565b905060200201358c611aa4919061291e565b611aae9190612935565b9150611aba828461280e565b9250611af989898984818110611ad257611ad26127e2565b9050602002016020810190611ae7919061256f565b6001600160a01b038716919085611f75565b611b0281612821565b9050611a6b565b50611b5b888888611b1b60018261290b565b818110611b2a57611b2a6127e2565b9050602002016020810190611b3f919061256f565b611b49858e61290b565b6001600160a01b038716929190611f75565b50505050505050505050565b6040516001600160a01b03831660248201526044810182905261089a90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611fad565b611bd48282610d4b565b610c13576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055611c0a3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b611c588282610d4b565b610c1357611c6581612082565b611c70836020612094565b604051602001611c81929190612957565b60408051601f198184030181529082905262461bcd60e51b825261183e91600401612709565b60008181526001830160205260408120548015611d90576000611ccb60018361290b565b8554909150600090611cdf9060019061290b565b9050818114611d44576000866000018281548110611cff57611cff6127e2565b9060005260206000200154905080876000018481548110611d2257611d226127e2565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080611d5557611d556129cc565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506105b6565b60009150506105b6565b6000808251604103611dd05760208301516040840151606085015160001a611dc487828585612230565b94509450505050610a3c565b50600090506002610a3c565b6000816004811115611df057611df0612782565b03611df85750565b6001816004811115611e0c57611e0c612782565b03611e595760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161183e565b6002816004811115611e6d57611e6d612782565b03611eba5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161183e565b6003816004811115611ece57611ece612782565b036110455760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161183e565b6000818152600183016020526040812054611f6d575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556105b6565b5060006105b6565b6040516001600160a01b038085166024830152831660448201526064810182905261086b9085906323b872dd60e01b90608401611b93565b6000612002826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166122f49092919063ffffffff16565b905080516000148061202357508080602001905181019061202391906129e2565b61089a5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161183e565b60606105b66001600160a01b03831660145b606060006120a383600261291e565b6120ae90600261280e565b67ffffffffffffffff8111156120c6576120c6612a04565b6040519080825280601f01601f1916602001820160405280156120f0576020820181803683370190505b509050600360fc1b8160008151811061210b5761210b6127e2565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061213a5761213a6127e2565b60200101906001600160f81b031916908160001a905350600061215e84600261291e565b61216990600161280e565b90505b60018111156121e1576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061219d5761219d6127e2565b1a60f81b8282815181106121b3576121b36127e2565b60200101906001600160f81b031916908160001a90535060049490941c936121da81612a1a565b905061216c565b5083156117235760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161183e565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561226757506000905060036122eb565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156122bb573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166122e4576000600192509250506122eb565b9150600090505b94509492505050565b6060612303848460008561230b565b949350505050565b60608247101561236c5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161183e565b600080866001600160a01b031685876040516123889190612a31565b60006040518083038185875af1925050503d80600081146123c5576040519150601f19603f3d011682016040523d82523d6000602084013e6123ca565b606091505b50915091506123db878383876123e6565b979650505050505050565b6060831561245557825160000361244e576001600160a01b0385163b61244e5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161183e565b5081612303565b612303838381511561246a5781518083602001fd5b8060405162461bcd60e51b815260040161183e9190612709565b60006020828403121561249657600080fd5b81356001600160e01b03198116811461172357600080fd5b6000604082840312156124c057600080fd5b50919050565b8035600281106124d557600080fd5b919050565b600080604083850312156124ed57600080fd5b823567ffffffffffffffff81111561250457600080fd5b612510858286016124ae565b92505061251f602084016124c6565b90509250929050565b600061010082840312156124c057600080fd5b6000610100828403121561254e57600080fd5b6117238383612528565b80356001600160a01b03811681146124d557600080fd5b60006020828403121561258157600080fd5b61172382612558565b60006020828403121561259c57600080fd5b5035919050565b600080604083850312156125b657600080fd5b8235915061251f60208401612558565b60008061012083850312156125da57600080fd5b6125e48484612528565b915061010083013567ffffffffffffffff81111561260157600080fd5b61260d858286016124ae565b9150509250929050565b6000806040838503121561262a57600080fd5b61263383612558565b915061251f60208401612558565b6000806000610140848603121561265757600080fd5b6126618585612528565b925061010084013567ffffffffffffffff8082111561267f57600080fd5b61268b878388016124ae565b93506101208601359150808211156126a257600080fd5b506126af868287016124ae565b9150509250925092565b60005b838110156126d45781810151838201526020016126bc565b50506000910152565b600081518084526126f58160208601602086016126b9565b601f01601f19169290920160200192915050565b60208152600061172360208301846126dd565b60008060006060848603121561273157600080fd5b61273a84612558565b925061274860208501612558565b9150604084013590509250925092565b6000806040838503121561276b57600080fd5b61277483612558565b946020939093013593505050565b634e487b7160e01b600052602160045260246000fd5b6000808335601e198436030181126127af57600080fd5b83018035915067ffffffffffffffff8211156127ca57600080fd5b6020019150600581901b3603821315610a3c57600080fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b808201808211156105b6576105b66127f8565b600060018201612833576128336127f8565b5060010190565b6000808335601e1984360301811261285157600080fd5b83018035915067ffffffffffffffff82111561286c57600080fd5b602001915036819003821315610a3c57600080fd5b60006020828403121561289357600080fd5b611723826124c6565b898152610120810160028a106128c257634e487b7160e01b600052602160045260246000fd5b6020820199909952604081019790975260608701959095526001600160a01b03938416608087015291831660a086015290911660c084015260e083015261010090910152919050565b818103818111156105b6576105b66127f8565b80820281158282048414176105b6576105b66127f8565b60008261295257634e487b7160e01b600052601260045260246000fd5b500490565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161298f8160178501602088016126b9565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516129c08160288401602088016126b9565b01602801949350505050565b634e487b7160e01b600052603160045260246000fd5b6000602082840312156129f457600080fd5b8151801515811461172357600080fd5b634e487b7160e01b600052604160045260246000fd5b600081612a2957612a296127f8565b506000190190565b60008251612a438184602087016126b9565b919091019291505056fea2646970667358221220057c69072c0cb5354b851333d617de84e727c583feb20b7b252a5a5cac1b9b6a64736f6c63430008130033000000000000000000000000bd286df841ccfc66e41cd5b97ad59573738caf4a00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000e9af0428143e4509df4379bd10c4850b223f2ecb00000000000000000000000000000000000000000000152d02c7e14af680000000000000000000000000000000000000000000000000152d02c7e14af68000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec70000000000000000000000000000000000000000000000000000000000000001000000000000000000000000e9af0428143e4509df4379bd10c4850b223f2ecb
608060405234801561001057600080fd5b50600436106102275760003560e01c8063844452fa11610130578063c5ff38bd116100b8578063d8f065bd1161007c578063d8f065bd14610502578063e0f3fc9f14610522578063ed24911d14610535578063f4ee2a8b1461053d578063fac09e871461057257600080fd5b8063c5ff38bd14610493578063cf9cc7661461049b578063d48c03e5146104c9578063d547741f146104dc578063d8369d75146104ef57600080fd5b806395165e8b116100ff57806395165e8b146104325780639be918e6146104455780639cd2913614610458578063a217fddf1461046b578063b6c780631461047357600080fd5b8063844452fa146103fc5780638da5cb5b1461040557806391d1485414610416578063928907dd1461042957600080fd5b8063402a8d37116101b3578063532c3f8211610182578063532c3f821461037157806353863613146103845780635392e6d91461039757806354f1e126146103d657806375829def146103e957600080fd5b8063402a8d371461030e57806340e49216146103385780634ba87af91461034b5780634be7a64b1461035e57600080fd5b80631c46bc6f116101fa5780631c46bc6f14610292578063248a9ca3146102a55780632ba32991146102c85780632f2ff15d146102e857806336568abe146102fb57600080fd5b806301ffc9a71461022c578063068f3877146102545780630e18b6811461026757806319bfcdec14610271575b600080fd5b61023f61023a366004612484565b610585565b60405190151581526020015b60405180910390f35b61023f6102623660046124da565b6105bc565b61026f610758565b005b61028461027f36600461253b565b610790565b60405190815260200161024b565b61026f6102a036600461256f565b6107cc565b6102846102b336600461258a565b60009081526020819052604090206001015490565b6102846102d636600461258a565b60096020526000908152604090205481565b61026f6102f63660046125a3565b610837565b61026f6103093660046125a3565b610871565b61032161031c3660046125c6565b61089f565b60408051921515835260208301919091520161024b565b61026f61034636600461256f565b610a43565b61026f61035936600461256f565b610a99565b61026f61036c36600461256f565b610b04565b61026f61037f36600461256f565b610bbf565b61026f61039236600461256f565b610c17565b6103be7f000000000000000000000000bd286df841ccfc66e41cd5b97ad59573738caf4a81565b6040516001600160a01b03909116815260200161024b565b61026f6103e436600461256f565b610c70565b61026f6103f736600461256f565b610cc4565b610284600d5481565b6001546001600160a01b03166103be565b61023f6104243660046125a3565b610d4b565b610284600c5481565b61026f6104403660046125c6565b610d74565b61023f61045336600461256f565b610fe6565b61026f61046636600461258a565b610ff3565b610284600081565b61028461048136600461258a565b600a6020526000908152604090205481565b61026f611007565b61023f6104a9366004612617565b600b60209081526000928352604080842090915290825290205460ff1681565b61026f6104d7366004612641565b611048565b61026f6104ea3660046125a3565b6112fd565b61026f6104fd36600461258a565b611331565b61051561051036600461253b565b611345565b60405161024b9190612709565b61026f61053036600461271c565b6113e7565b6102846114c1565b61055061054b366004612758565b6115bc565b604080519415158552602085019390935291830152606082015260800161024b565b61026f61058036600461256f565b61164a565b60006001600160e01b03198216637965db0b60e01b14806105b657506301ffc9a760e01b6001600160e01b03198316145b92915050565b600060018260018111156105d2576105d2612782565b036105df575060016105b6565b60006105ee6020850185612798565b90506105fa8580612798565b90501461060b5760009150506105b6565b6106158480612798565b90506000036106285760009150506105b6565b60005b6106358580612798565b905081101561073a5761067861064b8680612798565b8381811061065b5761065b6127e2565b9050602002016020810190610670919061256f565b600690611705565b15806106bb5750600061068b8680612798565b8381811061069b5761069b6127e2565b90506020020160208101906106b0919061256f565b6001600160a01b0316145b806106e957506106ce6020860186612798565b828181106106de576106de6127e2565b905060200201356000145b156106f9576000925050506105b6565b6107066020860186612798565b82818110610716576107166127e2565b9050602002013582610728919061280e565b915061073381612821565b905061062b565b50806127101461074e5760009150506105b6565b5060019392505050565b6002546001600160a01b031633146107835760405163058d9a1b60e01b815260040160405180910390fd5b61078e60003361172a565b565b60006105b661079d6114c1565b6107a684611345565b8051906020012060405161190160f01b8152600281019290925260228201526042902090565b60006107d7816117b3565b6107e26004836117bd565b6107ff57604051630ccd248560e21b815260040160405180910390fd5b6040516001600160a01b038316907f37803e2125c48ee96c38ddf04e826daf335b0e1603579040fd275aba6d06b6fc90600090a25050565b6000610842816117b3565b82806108615760405163318bd07d60e11b815260040160405180910390fd5b61086b848461172a565b50505050565b81806108905760405163318bd07d60e11b815260040160405180910390fd5b61089a83836117d2565b505050565b60008060006108ad85610790565b905060006108fc826108c2602088018861283a565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061185192505050565b905061090e608087016060880161256f565b6001600160a01b0316816001600160a01b0316148061096f57506001600160a01b0381166000908152600b60205260408120906109516080890160608a0161256f565b6001600160a01b0316815260208101919091526040016000205460ff165b61098c57604051638baa579f60e01b815260040160405180910390fd5b600061099e60a088016080890161256f565b6001600160a01b0316036109c55760405163162908e360e11b815260040160405180910390fd5b8560c001356000036109ea5760405163162908e360e11b815260040160405180910390fd5b8560e00135600003610a0f5760405163162908e360e11b815260040160405180910390fd5b8560200135421115610a3457604051630819bdcd60e01b815260040160405180910390fd5b506001925090505b9250929050565b6001600160a01b0381166000818152600b60209081526040808320338085529252808320805460ff19169055519092917f97b59d736dc70ae61c6b68295c19a1311cc4a48cbb9eb25c4dabf18c7f650a8a91a350565b6000610aa4816117b3565b610aaf6006836117bd565b610acc5760405163565c062f60e11b815260040160405180910390fd5b6040516001600160a01b038316907f75567811df62a6b68bd5ee394d5808ad7282e19541858be466bc789cad9d4dfb90600090a25050565b6000610b0f816117b3565b6001600160a01b0382161580610b5657507f000000000000000000000000bd286df841ccfc66e41cd5b97ad59573738caf4a6001600160a01b0316826001600160a01b0316145b80610b695750610b67600683611875565b155b15610b875760405163565c062f60e11b815260040160405180910390fd5b6040516001600160a01b038316907ffbd30b5bdd51f5de989170dc23d65aac2de0a6099f5d9d200bc5779d883abcd490600090a25050565b7f3c63e605be3290ab6b04cfc46c6e1516e626d43236b034f09d7ede1d017beb0c610be9816117b3565b610c137f44ac9762eec3a11893fefb11d028bb3102560094137c3ed4518712475b2577cc8361188a565b5050565b6001600160a01b0381166000818152600b60209081526040808320338085529252808320805460ff19166001179055519092917fed6a1f03e365a374bf7e9fe68b09cf74960528af699108cb461241efc5ded90991a350565b7f3c63e605be3290ab6b04cfc46c6e1516e626d43236b034f09d7ede1d017beb0c610c9a816117b3565b610c137f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a68361188a565b6000610ccf816117b3565b336001600160a01b03831603610cf85760405163318bd07d60e11b815260040160405180910390fd5b600280546001600160a01b0319166001600160a01b03848116918217909255600154604051919216907fefdcbba819467e00b0262c12892dda980bac68580b72178e57a162368b80876690600090a35050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b610d7c6118ef565b7f44ac9762eec3a11893fefb11d028bb3102560094137c3ed4518712475b2577cc610da6816117b3565b600d54436000908152600a602052604090205460e08501359190610dcb90839061280e565b1115610dea576040516326a753e760e11b815260040160405180910390fd5b6001610df96020860186612881565b6001811115610e0a57610e0a612782565b14610e285760405163af61069360e01b815260040160405180910390fd5b610e32848461089f565b50610e529050610e48608086016060870161256f565b8560400135611948565b50436000908152600a60205260408120805460e08701359290610e7690849061280e565b90915550506001600160a01b037f000000000000000000000000bd286df841ccfc66e41cd5b97ad59573738caf4a166379cc6790610eba608087016060880161256f565b60405160e083811b6001600160e01b03191682526001600160a01b03929092166004820152908701356024820152604401600060405180830381600087803b158015610f0557600080fd5b505af1158015610f19573d6000803e3d6000fd5b50610f4c9250610f3291505060a086016080870161256f565b610f4260c0870160a0880161256f565b8660c0013561198f565b60e084013560c08501803590610f659060a0880161256f565b6001600160a01b03167f18fd144d7dbcbaa6f00fd47a84adc7dc3cc64a326ffa2dc7691a25e3837dba0333610fa060808a0160608b0161256f565b610fb060a08b0160808c0161256f565b604080516001600160a01b039485168152928416602084015292168183015290519081900360600190a45050610c136001600355565b60006105b6600483611705565b6000610ffe816117b3565b610c13826119cb565b7f3c63e605be3290ab6b04cfc46c6e1516e626d43236b034f09d7ede1d017beb0c611031816117b3565b61103b60006119cb565b6110456000611a04565b50565b6110506118ef565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a661107a816117b3565b600c544360009081526009602052604090205460e0860135919061109f90839061280e565b11156110be57604051630fbf0bc960e01b815260040160405180910390fd5b60006110cd6020870187612881565b60018111156110de576110de612782565b146110fc5760405163af61069360e01b815260040160405180910390fd5b611106858461089f565b5061111a9050846102626020880188612881565b6111375760405163427282e960e11b815260040160405180910390fd5b61115461114a608087016060880161256f565b8660400135611948565b50436000908152600960205260408120805460e0880135929061117890849061280e565b909155506111c1905060c086018035906111959060a0890161256f565b6111a56080890160608a0161256f565b6111af8880612798565b6111bc60208b018b612798565b611a3d565b6001600160a01b037f000000000000000000000000bd286df841ccfc66e41cd5b97ad59573738caf4a166340c10f1961120060a088016080890161256f565b60405160e083811b6001600160e01b03191682526001600160a01b03929092166004820152908801356024820152604401600060405180830381600087803b15801561124b57600080fd5b505af115801561125f573d6000803e3d6000fd5b5050505060e085013560c0860180359061127c9060a0890161256f565b6001600160a01b03167ff114ca9eb82947af39f957fa726280fd3d5d81c3d7635a4aeb5c302962856eba336112b760808b0160608c0161256f565b6112c760a08c0160808d0161256f565b604080516001600160a01b039485168152928416602084015292168183015290519081900360600190a4505061089a6001600355565b6000611308816117b3565b82806113275760405163318bd07d60e11b815260040160405180910390fd5b61086b848461188a565b600061133c816117b3565b610c1382611a04565b60607fcf01f9b2d07c5e0679a7f97700240fe7bf2c828cab66850d13c62b02a869d1806113756020840184612881565b6020840135604085013561138f608087016060880161256f565b61139f60a088016080890161256f565b6113af60c0890160a08a0161256f565b8860c001358960e001356040516020016113d19998979695949392919061289c565b6040516020818303038152906040529050919050565b6113ef6118ef565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6611419816117b3565b6001600160a01b03841615806114375750611435600685611705565b155b156114555760405163e6c4247b60e01b815260040160405180910390fd5b6114696001600160a01b0384168584611b67565b826001600160a01b0316846001600160a01b03167f90c5d8794dcf7c60ab2d20912d5228389b28f74d32af01e40894a784a90b9ac2846040516114ae91815260200190565b60405180910390a35061089a6001600355565b60007f0000000000000000000000000000000000000000000000000000000000000001460361150f57507f199989cf473f49b02c36e94d87ed1928341ba79b4b1444ca064f26cb8705508090565b6115b7604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f2ca1b65876de036d7d1f964e87de7ed55488222b5385a8e54bc3e1a672c9cc6d918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b905090565b600080600080846000036115e357604051633ab3447f60e11b815260040160405180910390fd5b6001600160a01b03861660009081526008602081815260408084209289901c8085529183905290922054600160ff89161b91908083161561163757604051633ab3447f60e11b815260040160405180910390fd5b60019a9399509750909550909350505050565b6000611655816117b3565b6001600160a01b038216158061169c57507f000000000000000000000000bd286df841ccfc66e41cd5b97ad59573738caf4a6001600160a01b0316826001600160a01b0316145b806116af57506116ad600483611875565b155b156116cd57604051630ccd248560e21b815260040160405180910390fd5b6040516001600160a01b038316907f0e3c58ebfb2e7465fbb1c32e6b4f40c3c4f5ca77e8218a386aff8617831260d790600090a25050565b6001600160a01b038116600090815260018301602052604081205415155b9392505050565b816117a9576001546040516001600160a01b038084169216907ff8ccb027dfcd135e000e9d45e6cc2d662578a8825d4c45b5e32e0adf67e79ec690600090a3600154611781906000906001600160a01b031661188a565b600180546001600160a01b0383166001600160a01b0319918216179091556002805490911690555b610c138282611bca565b6110458133611c4e565b6000611723836001600160a01b038416611ca7565b6001600160a01b03811633146118475760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b610c13828261188a565b60008060006118608585611d9a565b9150915061186d81611ddc565b509392505050565b6000611723836001600160a01b038416611f26565b6118948282610d4b565b15610c13576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6002600354036119415760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161183e565b6002600355565b600080600080600061195a87876115bc565b6001600160a01b038b166000908152600860209081526040808320958352949052929092209117905594505050505092915050565b61199a600483611705565b6119b757604051630928045160e21b815260040160405180910390fd5b61089a6001600160a01b0383168483611b67565b600c805490829055604051829082907fb4a832eb73ba0066dc45acd0d1f4454cdee155b17bdb1ccbabb428cc39750ad190600090a35050565b600d805490829055604051829082907f6fd3eacad9328fdc902c323518cfef3a2f6a9da89c40a7b82428adc2370114c390600090a35050565b611a48600487611705565b611a6557604051630928045160e21b815260040160405180910390fd5b85600080805b611a7660018861290b565b811015611b0957612710868683818110611a9257611a926127e2565b905060200201358c611aa4919061291e565b611aae9190612935565b9150611aba828461280e565b9250611af989898984818110611ad257611ad26127e2565b9050602002016020810190611ae7919061256f565b6001600160a01b038716919085611f75565b611b0281612821565b9050611a6b565b50611b5b888888611b1b60018261290b565b818110611b2a57611b2a6127e2565b9050602002016020810190611b3f919061256f565b611b49858e61290b565b6001600160a01b038716929190611f75565b50505050505050505050565b6040516001600160a01b03831660248201526044810182905261089a90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611fad565b611bd48282610d4b565b610c13576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055611c0a3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b611c588282610d4b565b610c1357611c6581612082565b611c70836020612094565b604051602001611c81929190612957565b60408051601f198184030181529082905262461bcd60e51b825261183e91600401612709565b60008181526001830160205260408120548015611d90576000611ccb60018361290b565b8554909150600090611cdf9060019061290b565b9050818114611d44576000866000018281548110611cff57611cff6127e2565b9060005260206000200154905080876000018481548110611d2257611d226127e2565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080611d5557611d556129cc565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506105b6565b60009150506105b6565b6000808251604103611dd05760208301516040840151606085015160001a611dc487828585612230565b94509450505050610a3c565b50600090506002610a3c565b6000816004811115611df057611df0612782565b03611df85750565b6001816004811115611e0c57611e0c612782565b03611e595760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161183e565b6002816004811115611e6d57611e6d612782565b03611eba5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161183e565b6003816004811115611ece57611ece612782565b036110455760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161183e565b6000818152600183016020526040812054611f6d575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556105b6565b5060006105b6565b6040516001600160a01b038085166024830152831660448201526064810182905261086b9085906323b872dd60e01b90608401611b93565b6000612002826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166122f49092919063ffffffff16565b905080516000148061202357508080602001905181019061202391906129e2565b61089a5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161183e565b60606105b66001600160a01b03831660145b606060006120a383600261291e565b6120ae90600261280e565b67ffffffffffffffff8111156120c6576120c6612a04565b6040519080825280601f01601f1916602001820160405280156120f0576020820181803683370190505b509050600360fc1b8160008151811061210b5761210b6127e2565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061213a5761213a6127e2565b60200101906001600160f81b031916908160001a905350600061215e84600261291e565b61216990600161280e565b90505b60018111156121e1576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061219d5761219d6127e2565b1a60f81b8282815181106121b3576121b36127e2565b60200101906001600160f81b031916908160001a90535060049490941c936121da81612a1a565b905061216c565b5083156117235760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161183e565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561226757506000905060036122eb565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156122bb573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166122e4576000600192509250506122eb565b9150600090505b94509492505050565b6060612303848460008561230b565b949350505050565b60608247101561236c5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161183e565b600080866001600160a01b031685876040516123889190612a31565b60006040518083038185875af1925050503d80600081146123c5576040519150601f19603f3d011682016040523d82523d6000602084013e6123ca565b606091505b50915091506123db878383876123e6565b979650505050505050565b6060831561245557825160000361244e576001600160a01b0385163b61244e5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161183e565b5081612303565b612303838381511561246a5781518083602001fd5b8060405162461bcd60e51b815260040161183e9190612709565b60006020828403121561249657600080fd5b81356001600160e01b03198116811461172357600080fd5b6000604082840312156124c057600080fd5b50919050565b8035600281106124d557600080fd5b919050565b600080604083850312156124ed57600080fd5b823567ffffffffffffffff81111561250457600080fd5b612510858286016124ae565b92505061251f602084016124c6565b90509250929050565b600061010082840312156124c057600080fd5b6000610100828403121561254e57600080fd5b6117238383612528565b80356001600160a01b03811681146124d557600080fd5b60006020828403121561258157600080fd5b61172382612558565b60006020828403121561259c57600080fd5b5035919050565b600080604083850312156125b657600080fd5b8235915061251f60208401612558565b60008061012083850312156125da57600080fd5b6125e48484612528565b915061010083013567ffffffffffffffff81111561260157600080fd5b61260d858286016124ae565b9150509250929050565b6000806040838503121561262a57600080fd5b61263383612558565b915061251f60208401612558565b6000806000610140848603121561265757600080fd5b6126618585612528565b925061010084013567ffffffffffffffff8082111561267f57600080fd5b61268b878388016124ae565b93506101208601359150808211156126a257600080fd5b506126af868287016124ae565b9150509250925092565b60005b838110156126d45781810151838201526020016126bc565b50506000910152565b600081518084526126f58160208601602086016126b9565b601f01601f19169290920160200192915050565b60208152600061172360208301846126dd565b60008060006060848603121561273157600080fd5b61273a84612558565b925061274860208501612558565b9150604084013590509250925092565b6000806040838503121561276b57600080fd5b61277483612558565b946020939093013593505050565b634e487b7160e01b600052602160045260246000fd5b6000808335601e198436030181126127af57600080fd5b83018035915067ffffffffffffffff8211156127ca57600080fd5b6020019150600581901b3603821315610a3c57600080fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b808201808211156105b6576105b66127f8565b600060018201612833576128336127f8565b5060010190565b6000808335601e1984360301811261285157600080fd5b83018035915067ffffffffffffffff82111561286c57600080fd5b602001915036819003821315610a3c57600080fd5b60006020828403121561289357600080fd5b611723826124c6565b898152610120810160028a106128c257634e487b7160e01b600052602160045260246000fd5b6020820199909952604081019790975260608701959095526001600160a01b03938416608087015291831660a086015290911660c084015260e083015261010090910152919050565b818103818111156105b6576105b66127f8565b80820281158282048414176105b6576105b66127f8565b60008261295257634e487b7160e01b600052601260045260246000fd5b500490565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161298f8160178501602088016126b9565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516129c08160288401602088016126b9565b01602801949350505050565b634e487b7160e01b600052603160045260246000fd5b6000602082840312156129f457600080fd5b8151801515811461172357600080fd5b634e487b7160e01b600052604160045260246000fd5b600081612a2957612a296127f8565b506000190190565b60008251612a438184602087016126b9565b919091019291505056fea2646970667358221220057c69072c0cb5354b851333d617de84e727c583feb20b7b252a5a5cac1b9b6a64736f6c63430008130033
{{ "language": "Solidity", "sources": { "src/LevelMinting.sol": { "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.8.19;\n\n/**\n * solhint-disable private-vars-leading-underscore\n */\n\nimport \"./SingleAdminAccessControl.sol\";\nimport \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\n\nimport \"./interfaces/IlvlUSD.sol\";\nimport \"./interfaces/ILevelMinting.sol\";\n\n/**\n * @title Level Minting Contract\n * @notice This contract issues and redeems lvlUSD for/from other accepted stablecoins\n * @dev Changelog: change name to LevelMinting and lvlUSD, update solidity versions\n */\ncontract LevelMinting is\n ILevelMinting,\n SingleAdminAccessControl,\n ReentrancyGuard\n{\n using SafeERC20 for IERC20;\n using EnumerableSet for EnumerableSet.AddressSet;\n\n /* --------------- CONSTANTS --------------- */\n\n /// @notice EIP712 domain\n bytes32 private constant EIP712_DOMAIN =\n keccak256(\n \"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"\n );\n\n /// @notice order type\n bytes32 private constant ORDER_TYPE =\n keccak256(\n \"Order(uint8 order_type,uint256 expiry,uint256 nonce,address benefactor,address beneficiary,address collateral_asset,uint256 collateral_amount,uint256 lvlusd_amount)\"\n );\n\n /// @notice role enabling to invoke mint\n bytes32 private constant MINTER_ROLE = keccak256(\"MINTER_ROLE\");\n\n /// @notice role enabling to invoke redeem\n bytes32 private constant REDEEMER_ROLE = keccak256(\"REDEEMER_ROLE\");\n\n /// @notice role enabling to disable mint and redeem and remove minters and redeemers in an emergency\n bytes32 private constant GATEKEEPER_ROLE = keccak256(\"GATEKEEPER_ROLE\");\n\n /// @notice EIP712 name\n bytes32 private constant EIP_712_NAME = keccak256(\"LevelMinting\");\n\n /// @notice holds EIP712 revision\n bytes32 private constant EIP712_REVISION = keccak256(\"1\");\n\n /* --------------- STATE VARIABLES --------------- */\n\n /// @notice lvlusd stablecoin\n IlvlUSD public immutable lvlusd;\n\n /// @notice Supported assets\n EnumerableSet.AddressSet internal _supportedAssets;\n\n // @notice custodian addresses\n EnumerableSet.AddressSet internal _custodianAddresses;\n\n /// @notice holds computable chain id\n uint256 private immutable _chainId;\n\n /// @notice holds computable domain separator\n bytes32 private immutable _domainSeparator;\n\n /// @notice user deduplication\n mapping(address => mapping(uint256 => uint256)) private _orderBitmaps;\n\n /// @notice lvlUSD minted per block\n mapping(uint256 => uint256) public mintedPerBlock;\n /// @notice lvlUSD redeemed per block\n mapping(uint256 => uint256) public redeemedPerBlock;\n\n /// @notice For smart contracts to delegate signing to EOA address\n mapping(address => mapping(address => bool)) public delegatedSigner;\n\n /// @notice max minted lvlUSD allowed per block\n uint256 public maxMintPerBlock;\n /// @notice max redeemed lvlUSD allowed per block\n uint256 public maxRedeemPerBlock;\n\n /* --------------- MODIFIERS --------------- */\n\n /// @notice ensure that the already minted lvlUSD in the actual block plus the amount to be minted is below the maxMintPerBlock var\n /// @param mintAmount The lvlUSD amount to be minted\n modifier belowMaxMintPerBlock(uint256 mintAmount) {\n if (mintedPerBlock[block.number] + mintAmount > maxMintPerBlock)\n revert MaxMintPerBlockExceeded();\n _;\n }\n\n /// @notice ensure that the already redeemed lvlUSD in the actual block plus the amount to be redeemed is below the maxRedeemPerBlock var\n /// @param redeemAmount The lvlUSD amount to be redeemed\n modifier belowMaxRedeemPerBlock(uint256 redeemAmount) {\n if (redeemedPerBlock[block.number] + redeemAmount > maxRedeemPerBlock)\n revert MaxRedeemPerBlockExceeded();\n _;\n }\n\n /* --------------- CONSTRUCTOR --------------- */\n\n constructor(\n IlvlUSD _lvlusd,\n address[] memory _assets,\n address[] memory _custodians,\n address _admin,\n uint256 _maxMintPerBlock,\n uint256 _maxRedeemPerBlock\n ) {\n if (address(_lvlusd) == address(0)) revert InvalidlvlUSDAddress();\n if (_assets.length == 0) revert NoAssetsProvided();\n if (_admin == address(0)) revert InvalidZeroAddress();\n lvlusd = _lvlusd;\n\n _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);\n\n for (uint256 i = 0; i < _assets.length; i++) {\n addSupportedAsset(_assets[i]);\n }\n\n for (uint256 j = 0; j < _custodians.length; j++) {\n addCustodianAddress(_custodians[j]);\n }\n\n // Set the max mint/redeem limits per block\n _setMaxMintPerBlock(_maxMintPerBlock);\n _setMaxRedeemPerBlock(_maxRedeemPerBlock);\n\n if (msg.sender != _admin) {\n _grantRole(DEFAULT_ADMIN_ROLE, _admin);\n }\n\n _chainId = block.chainid;\n _domainSeparator = _computeDomainSeparator();\n\n emit lvlUSDSet(address(_lvlusd));\n }\n\n /* --------------- EXTERNAL --------------- */\n\n /**\n * @notice Mint stablecoins from assets\n * @param order struct containing order details and confirmation from server\n * @param signature signature of the taker\n * @param route the addresses to which the collateral should be sent (and ratios describing the amount to send to each address)\n */\n function mint(\n Order calldata order,\n Route calldata route,\n Signature calldata signature\n )\n external\n override\n nonReentrant\n onlyRole(MINTER_ROLE)\n belowMaxMintPerBlock(order.lvlusd_amount)\n {\n if (order.order_type != OrderType.MINT) revert InvalidOrder();\n verifyOrder(order, signature);\n if (!verifyRoute(route, order.order_type)) revert InvalidRoute();\n _deduplicateOrder(order.benefactor, order.nonce);\n // Add to the minted amount in this block\n mintedPerBlock[block.number] += order.lvlusd_amount;\n _transferCollateral(\n order.collateral_amount,\n order.collateral_asset,\n order.benefactor,\n route.addresses,\n route.ratios\n );\n lvlusd.mint(order.beneficiary, order.lvlusd_amount);\n emit Mint(\n msg.sender,\n order.benefactor,\n order.beneficiary,\n order.collateral_asset,\n order.collateral_amount,\n order.lvlusd_amount\n );\n }\n\n /**\n * @notice Redeem stablecoins for assets\n * @param order struct containing order details and confirmation from server\n * @param signature signature of the taker\n */\n function redeem(\n Order calldata order,\n Signature calldata signature\n )\n external\n override\n nonReentrant\n onlyRole(REDEEMER_ROLE)\n belowMaxRedeemPerBlock(order.lvlusd_amount)\n {\n if (order.order_type != OrderType.REDEEM) revert InvalidOrder();\n verifyOrder(order, signature);\n _deduplicateOrder(order.benefactor, order.nonce);\n // Add to the redeemed amount in this block\n redeemedPerBlock[block.number] += order.lvlusd_amount;\n lvlusd.burnFrom(order.benefactor, order.lvlusd_amount);\n _transferToBeneficiary(\n order.beneficiary,\n order.collateral_asset,\n order.collateral_amount\n );\n emit Redeem(\n msg.sender,\n order.benefactor,\n order.beneficiary,\n order.collateral_asset,\n order.collateral_amount,\n order.lvlusd_amount\n );\n }\n\n /// @notice Sets the max mintPerBlock limit\n function setMaxMintPerBlock(\n uint256 _maxMintPerBlock\n ) external onlyRole(DEFAULT_ADMIN_ROLE) {\n _setMaxMintPerBlock(_maxMintPerBlock);\n }\n\n /// @notice Sets the max redeemPerBlock limit\n function setMaxRedeemPerBlock(\n uint256 _maxRedeemPerBlock\n ) external onlyRole(DEFAULT_ADMIN_ROLE) {\n _setMaxRedeemPerBlock(_maxRedeemPerBlock);\n }\n\n /// @notice Disables the mint and redeem\n function disableMintRedeem() external onlyRole(GATEKEEPER_ROLE) {\n _setMaxMintPerBlock(0);\n _setMaxRedeemPerBlock(0);\n }\n\n /// @notice Enables smart contracts to delegate an address for signing\n function setDelegatedSigner(address _delegateTo) external {\n delegatedSigner[_delegateTo][msg.sender] = true;\n emit DelegatedSignerAdded(_delegateTo, msg.sender);\n }\n\n /// @notice Enables smart contracts to undelegate an address for signing\n function removeDelegatedSigner(address _removedSigner) external {\n delegatedSigner[_removedSigner][msg.sender] = false;\n emit DelegatedSignerRemoved(_removedSigner, msg.sender);\n }\n\n /// @notice transfers an asset to a custody wallet\n function transferToCustody(\n address wallet,\n address asset,\n uint256 amount\n ) external nonReentrant onlyRole(MINTER_ROLE) {\n if (wallet == address(0) || !_custodianAddresses.contains(wallet))\n revert InvalidAddress();\n IERC20(asset).safeTransfer(wallet, amount);\n emit CustodyTransfer(wallet, asset, amount);\n }\n\n /// @notice Removes an asset from the supported assets list\n function removeSupportedAsset(\n address asset\n ) external onlyRole(DEFAULT_ADMIN_ROLE) {\n if (!_supportedAssets.remove(asset)) revert InvalidAssetAddress();\n emit AssetRemoved(asset);\n }\n\n /// @notice Checks if an asset is supported.\n function isSupportedAsset(address asset) external view returns (bool) {\n return _supportedAssets.contains(asset);\n }\n\n /// @notice Removes an custodian from the custodian address list\n function removeCustodianAddress(\n address custodian\n ) external onlyRole(DEFAULT_ADMIN_ROLE) {\n if (!_custodianAddresses.remove(custodian))\n revert InvalidCustodianAddress();\n emit CustodianAddressRemoved(custodian);\n }\n\n /// @notice Removes the minter role from an account, this can ONLY be executed by the gatekeeper role\n /// @param minter The address to remove the minter role from\n function removeMinterRole(\n address minter\n ) external onlyRole(GATEKEEPER_ROLE) {\n _revokeRole(MINTER_ROLE, minter);\n }\n\n /// @notice Removes the redeemer role from an account, this can ONLY be executed by the gatekeeper role\n /// @param redeemer The address to remove the redeemer role from\n function removeRedeemerRole(\n address redeemer\n ) external onlyRole(GATEKEEPER_ROLE) {\n _revokeRole(REDEEMER_ROLE, redeemer);\n }\n\n /* --------------- PUBLIC --------------- */\n\n /// @notice Adds an asset to the supported assets list.\n function addSupportedAsset(\n address asset\n ) public onlyRole(DEFAULT_ADMIN_ROLE) {\n if (\n asset == address(0) ||\n asset == address(lvlusd) ||\n !_supportedAssets.add(asset)\n ) {\n revert InvalidAssetAddress();\n }\n emit AssetAdded(asset);\n }\n\n /// @notice Adds an custodian to the supported custodians list.\n function addCustodianAddress(\n address custodian\n ) public onlyRole(DEFAULT_ADMIN_ROLE) {\n if (\n custodian == address(0) ||\n custodian == address(lvlusd) ||\n !_custodianAddresses.add(custodian)\n ) {\n revert InvalidCustodianAddress();\n }\n emit CustodianAddressAdded(custodian);\n }\n\n /// @notice Get the domain separator for the token\n /// @dev Return cached value if chainId matches cache, otherwise recomputes separator, to prevent replay attack across forks\n /// @return The domain separator of the token at current chain\n function getDomainSeparator() public view returns (bytes32) {\n if (block.chainid == _chainId) {\n return _domainSeparator;\n }\n return _computeDomainSeparator();\n }\n\n /// @notice hash an Order struct\n function hashOrder(\n Order calldata order\n ) public view override returns (bytes32) {\n return\n ECDSA.toTypedDataHash(\n getDomainSeparator(),\n keccak256(encodeOrder(order))\n );\n }\n\n function encodeOrder(\n Order calldata order\n ) public pure returns (bytes memory) {\n return\n abi.encode(\n ORDER_TYPE,\n order.order_type,\n order.expiry,\n order.nonce,\n order.benefactor,\n order.beneficiary,\n order.collateral_asset,\n order.collateral_amount,\n order.lvlusd_amount\n );\n }\n\n /// @notice assert validity of signed order\n function verifyOrder(\n Order calldata order,\n Signature calldata signature\n ) public view override returns (bool, bytes32) {\n bytes32 taker_order_hash = hashOrder(order);\n address signer = ECDSA.recover(\n taker_order_hash,\n signature.signature_bytes\n );\n if (\n !(signer == order.benefactor ||\n delegatedSigner[signer][order.benefactor])\n ) revert InvalidSignature();\n if (order.beneficiary == address(0)) revert InvalidAmount();\n if (order.collateral_amount == 0) revert InvalidAmount();\n if (order.lvlusd_amount == 0) revert InvalidAmount();\n if (block.timestamp > order.expiry) revert SignatureExpired();\n return (true, taker_order_hash);\n }\n\n /// @notice assert validity of route object per type\n function verifyRoute(\n Route calldata route,\n OrderType orderType\n ) public view override returns (bool) {\n // routes only used to mint\n if (orderType == OrderType.REDEEM) {\n return true;\n }\n uint256 totalRatio = 0;\n if (route.addresses.length != route.ratios.length) {\n return false;\n }\n if (route.addresses.length == 0) {\n return false;\n }\n for (uint256 i = 0; i < route.addresses.length; ++i) {\n if (\n !_custodianAddresses.contains(route.addresses[i]) ||\n route.addresses[i] == address(0) ||\n route.ratios[i] == 0\n ) {\n return false;\n }\n totalRatio += route.ratios[i];\n }\n if (totalRatio != 10_000) {\n return false;\n }\n return true;\n }\n\n /// @notice verify validity of nonce by checking its presence\n function verifyNonce(\n address sender,\n uint256 nonce\n ) public view override returns (bool, uint256, uint256, uint256) {\n if (nonce == 0) revert InvalidNonce();\n uint256 invalidatorSlot = nonce >> 8;\n uint256 invalidatorBit = 1 << uint8(nonce);\n mapping(uint256 => uint256) storage invalidatorStorage = _orderBitmaps[\n sender\n ];\n uint256 invalidator = invalidatorStorage[invalidatorSlot];\n if (invalidator & invalidatorBit != 0) revert InvalidNonce();\n\n return (true, invalidatorSlot, invalidator, invalidatorBit);\n }\n\n /* --------------- PRIVATE --------------- */\n\n /// @notice deduplication of taker order\n function _deduplicateOrder(\n address sender,\n uint256 nonce\n ) private returns (bool) {\n (\n bool valid,\n uint256 invalidatorSlot,\n uint256 invalidator,\n uint256 invalidatorBit\n ) = verifyNonce(sender, nonce);\n mapping(uint256 => uint256) storage invalidatorStorage = _orderBitmaps[\n sender\n ];\n invalidatorStorage[invalidatorSlot] = invalidator | invalidatorBit;\n return valid;\n }\n\n /* --------------- INTERNAL --------------- */\n\n /// @notice transfer supported asset to beneficiary address\n function _transferToBeneficiary(\n address beneficiary,\n address asset,\n uint256 amount\n ) internal {\n if (!_supportedAssets.contains(asset)) revert UnsupportedAsset();\n IERC20(asset).safeTransfer(beneficiary, amount);\n }\n\n /// @notice transfer supported asset to array of custody addresses per defined ratio\n function _transferCollateral(\n uint256 amount,\n address asset,\n address benefactor,\n address[] calldata addresses,\n uint256[] calldata ratios\n ) internal {\n // cannot mint using unsupported asset or native ETH even if it is supported for redemptions\n if (!_supportedAssets.contains(asset)) revert UnsupportedAsset();\n IERC20 token = IERC20(asset);\n uint256 totalTransferred;\n uint256 amountToTransfer;\n for (uint256 i = 0; i < addresses.length - 1; ++i) {\n amountToTransfer = (amount * ratios[i]) / 10_000;\n totalTransferred += amountToTransfer;\n token.safeTransferFrom(benefactor, addresses[i], amountToTransfer);\n }\n token.safeTransferFrom(\n benefactor,\n addresses[addresses.length - 1],\n amount - totalTransferred\n );\n }\n\n /// @notice Sets the max mintPerBlock limit\n function _setMaxMintPerBlock(uint256 _maxMintPerBlock) internal {\n uint256 oldMaxMintPerBlock = maxMintPerBlock;\n maxMintPerBlock = _maxMintPerBlock;\n emit MaxMintPerBlockChanged(oldMaxMintPerBlock, maxMintPerBlock);\n }\n\n /// @notice Sets the max redeemPerBlock limit\n function _setMaxRedeemPerBlock(uint256 _maxRedeemPerBlock) internal {\n uint256 oldMaxRedeemPerBlock = maxRedeemPerBlock;\n maxRedeemPerBlock = _maxRedeemPerBlock;\n emit MaxRedeemPerBlockChanged(oldMaxRedeemPerBlock, maxRedeemPerBlock);\n }\n\n /// @notice Compute the current domain separator\n /// @return The domain separator for the token\n function _computeDomainSeparator() internal view returns (bytes32) {\n return\n keccak256(\n abi.encode(\n EIP712_DOMAIN,\n EIP_712_NAME,\n EIP712_REVISION,\n block.chainid,\n address(this)\n )\n );\n }\n}\n" }, "src/SingleAdminAccessControl.sol": { "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.8.19;\n\nimport \"@openzeppelin/contracts/access/AccessControl.sol\";\nimport \"@openzeppelin/contracts/interfaces/IERC5313.sol\";\nimport \"./interfaces/ISingleAdminAccessControl.sol\";\n\n/**\n * @title SingleAdminAccessControl\n * @notice SingleAdminAccessControl is a contract that provides a single admin role\n * @notice This contract is a simplified alternative to OpenZeppelin's AccessControlDefaultAdminRules\n * @dev Changelog: update solidity versions\n */\nabstract contract SingleAdminAccessControl is\n IERC5313,\n ISingleAdminAccessControl,\n AccessControl\n{\n address private _currentDefaultAdmin;\n address private _pendingDefaultAdmin;\n\n modifier notAdmin(bytes32 role) {\n if (role == DEFAULT_ADMIN_ROLE) revert InvalidAdminChange();\n _;\n }\n\n /// @notice Transfer the admin role to a new address\n /// @notice This can ONLY be executed by the current admin\n /// @param newAdmin address\n function transferAdmin(\n address newAdmin\n ) external onlyRole(DEFAULT_ADMIN_ROLE) {\n if (newAdmin == msg.sender) revert InvalidAdminChange();\n _pendingDefaultAdmin = newAdmin;\n emit AdminTransferRequested(_currentDefaultAdmin, newAdmin);\n }\n\n function acceptAdmin() external {\n if (msg.sender != _pendingDefaultAdmin) revert NotPendingAdmin();\n _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);\n }\n\n /// @notice grant a role\n /// @notice can only be executed by the current single admin\n /// @notice admin role cannot be granted externally\n /// @param role bytes32\n /// @param account address\n function grantRole(\n bytes32 role,\n address account\n ) public override onlyRole(DEFAULT_ADMIN_ROLE) notAdmin(role) {\n _grantRole(role, account);\n }\n\n /// @notice revoke a role\n /// @notice can only be executed by the current admin\n /// @notice admin role cannot be revoked\n /// @param role bytes32\n /// @param account address\n function revokeRole(\n bytes32 role,\n address account\n ) public override onlyRole(DEFAULT_ADMIN_ROLE) notAdmin(role) {\n _revokeRole(role, account);\n }\n\n /// @notice renounce the role of msg.sender\n /// @notice admin role cannot be renounced\n /// @param role bytes32\n /// @param account address\n function renounceRole(\n bytes32 role,\n address account\n ) public virtual override notAdmin(role) {\n super.renounceRole(role, account);\n }\n\n /**\n * @dev See {IERC5313-owner}.\n */\n function owner() public view virtual returns (address) {\n return _currentDefaultAdmin;\n }\n\n /**\n * @notice no way to change admin without removing old admin first\n */\n function _grantRole(bytes32 role, address account) internal override {\n if (role == DEFAULT_ADMIN_ROLE) {\n emit AdminTransferred(_currentDefaultAdmin, account);\n _revokeRole(DEFAULT_ADMIN_ROLE, _currentDefaultAdmin);\n _currentDefaultAdmin = account;\n delete _pendingDefaultAdmin;\n }\n super._grantRole(role, account);\n }\n}\n" }, "lib/openzeppelin-contracts/contracts/security/ReentrancyGuard.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\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 ReentrancyGuard {\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 constructor() {\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 Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n * `nonReentrant` function in the call stack.\n */\n function _reentrancyGuardEntered() internal view returns (bool) {\n return _status == _ENTERED;\n }\n}\n" }, "lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/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 /**\n * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n /**\n * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\n * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\n */\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(IERC20 token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n 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 /**\n * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n uint256 oldAllowance = token.allowance(address(this), spender);\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));\n }\n\n /**\n * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful.\n */\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));\n }\n }\n\n /**\n * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\n * non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to\n * 0 before setting it to a non-zero value.\n */\n function forceApprove(IERC20 token, address spender, uint256 value) internal {\n bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);\n\n if (!_callOptionalReturnBool(token, approvalCall)) {\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));\n _callOptionalReturn(token, approvalCall);\n }\n }\n\n /**\n * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.\n * Revert on invalid signature.\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 require(returndata.length == 0 || abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation 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 * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\n */\n function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\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 cannot use {Address-functionCall} here since this should return false\n // and not revert is the subcall reverts.\n\n (bool success, bytes memory returndata) = address(token).call(data);\n return\n success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));\n }\n}\n" }, "lib/openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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(bytes32 hash, bytes32 r, bytes32 vs) 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(bytes32 hash, bytes32 r, bytes32 vs) 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(bytes32 hash, uint8 v, bytes32 r, bytes32 s) 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(bytes32 hash, uint8 v, bytes32 r, bytes32 s) 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 message) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, \"\\x19Ethereum Signed Message:\\n32\")\n mstore(0x1c, hash)\n message := keccak256(0x00, 0x3c)\n }\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 data) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40)\n mstore(ptr, \"\\x19\\x01\")\n mstore(add(ptr, 0x02), domainSeparator)\n mstore(add(ptr, 0x22), structHash)\n data := keccak256(ptr, 0x42)\n }\n }\n\n /**\n * @dev Returns an Ethereum Signed Data with intended validator, created from a\n * `validator` and `data` according to the version 0 of EIP-191.\n *\n * See {recover}.\n */\n function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x00\", validator, data));\n }\n}\n" }, "lib/openzeppelin-contracts/contracts/utils/structs/EnumerableSet.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```solidity\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastValue;\n // Update the index for the moved value\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n" }, "src/interfaces/IlvlUSD.sol": { "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.8.19;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol\";\n\ninterface IlvlUSD is IERC20, IERC20Permit, IERC20Metadata {\n function mint(address _to, uint256 _amount) external;\n\n function burn(uint256 _amount) external;\n\n function burnFrom(address account, uint256 amount) external;\n\n function grantRole(bytes32 role, address account) external;\n\n function setMinter(address newMinter) external;\n\n function slasher() external returns (address);\n}\n" }, "src/interfaces/ILevelMinting.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"./ILevelMintingEvents.sol\";\n\ninterface ILevelMinting is ILevelMintingEvents {\n enum Role {\n Minter,\n Redeemer\n }\n\n enum OrderType {\n MINT,\n REDEEM\n }\n\n enum SignatureType {\n EIP712\n }\n\n struct Signature {\n SignatureType signature_type;\n bytes signature_bytes;\n }\n\n struct Route {\n address[] addresses;\n uint256[] ratios;\n }\n\n struct Order {\n OrderType order_type;\n uint256 expiry;\n uint256 nonce;\n address benefactor;\n address beneficiary;\n address collateral_asset;\n uint256 collateral_amount;\n uint256 lvlusd_amount;\n }\n\n error Duplicate();\n error InvalidAddress();\n error InvalidlvlUSDAddress();\n error InvalidZeroAddress();\n error InvalidAssetAddress();\n error InvalidCustodianAddress();\n error InvalidOrder();\n error InvalidAffirmedAmount();\n error InvalidAmount();\n error InvalidRoute();\n error UnsupportedAsset();\n error NoAssetsProvided();\n error InvalidSignature();\n error InvalidNonce();\n error SignatureExpired();\n error TransferFailed();\n error MaxMintPerBlockExceeded();\n error MaxRedeemPerBlockExceeded();\n\n function hashOrder(Order calldata order) external view returns (bytes32);\n\n function verifyOrder(\n Order calldata order,\n Signature calldata signature\n ) external view returns (bool, bytes32);\n\n function verifyRoute(\n Route calldata route,\n OrderType order_type\n ) external view returns (bool);\n\n function verifyNonce(\n address sender,\n uint256 nonce\n ) external view returns (bool, uint256, uint256, uint256);\n\n function mint(\n Order calldata order,\n Route calldata route,\n Signature calldata signature\n ) external;\n\n function redeem(\n Order calldata order,\n Signature calldata signature\n ) external;\n}\n" }, "lib/openzeppelin-contracts/contracts/access/AccessControl.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControl.sol\";\nimport \"../utils/Context.sol\";\nimport \"../utils/Strings.sol\";\nimport \"../utils/introspection/ERC165.sol\";\n\n/**\n * @dev 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 * ```solidity\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 * ```solidity\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. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\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 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]{40}) is missing role (0x[0-9a-f]{64})$/\n *\n * _Available since v4.1._\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\n return _roles[role].members[account];\n }\n\n /**\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\n * Overriding this function changes the behavior of the {onlyRole} modifier.\n *\n * Format of the revert message is described in {_checkRole}.\n *\n * _Available since v4.6._\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\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]{40}) is missing role (0x[0-9a-f]{64})$/\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert(\n string(\n abi.encodePacked(\n \"AccessControl: account \",\n Strings.toHexString(account),\n \" is missing role \",\n Strings.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 virtual override 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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual override 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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual override 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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address account) public virtual override {\n require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\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 * May emit a {RoleGranted} event.\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 * NOTE: This function is deprecated in favor of {_grantRole}.\n */\n function _setupRole(bytes32 role, address account) internal virtual {\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 virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n emit RoleGranted(role, account, _msgSender());\n }\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n }\n }\n}\n" }, "lib/openzeppelin-contracts/contracts/interfaces/IERC5313.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5313.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface for the Light Contract Ownership Standard.\n *\n * A standardized minimal interface required to identify an account that controls a contract\n *\n * _Available since v4.9._\n */\ninterface IERC5313 {\n /**\n * @dev Gets the address of the owner.\n */\n function owner() external view returns (address);\n}\n" }, "src/interfaces/ISingleAdminAccessControl.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\ninterface ISingleAdminAccessControl {\n error InvalidAdminChange();\n error NotPendingAdmin();\n\n event AdminTransferred(address indexed oldAdmin, address indexed newAdmin);\n event AdminTransferRequested(\n address indexed oldAdmin,\n address indexed newAdmin\n );\n}\n" }, "lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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(address from, address to, uint256 amount) external returns (bool);\n}\n" }, "lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Permit.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/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" }, "lib/openzeppelin-contracts/contracts/utils/Address.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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 * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\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://consensys.net/diligence/blog/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.8.0/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(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\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" }, "lib/openzeppelin-contracts/contracts/utils/Strings.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\nimport \"./math/SignedMath.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 `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value))));\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 /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" }, "lib/openzeppelin-contracts/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" }, "src/interfaces/ILevelMintingEvents.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\ninterface ILevelMintingEvents {\n /// @notice Event emitted when contract receives ETH\n event Received(address, uint256);\n\n /// @notice Event emitted when lvlUSD is minted\n event Mint(\n address minter,\n address benefactor,\n address beneficiary,\n address indexed collateral_asset,\n uint256 indexed collateral_amount,\n uint256 indexed lvlusd_amount\n );\n\n /// @notice Event emitted when funds are redeemed\n event Redeem(\n address redeemer,\n address benefactor,\n address beneficiary,\n address indexed collateral_asset,\n uint256 indexed collateral_amount,\n uint256 indexed lvlusd_amount\n );\n\n /// @notice Event emitted when custody wallet is added\n event CustodyWalletAdded(address wallet);\n\n /// @notice Event emitted when a custody wallet is removed\n event CustodyWalletRemoved(address wallet);\n\n /// @notice Event emitted when a supported asset is added\n event AssetAdded(address indexed asset);\n\n /// @notice Event emitted when a supported asset is removed\n event AssetRemoved(address indexed asset);\n\n // @notice Event emitted when a custodian address is added\n event CustodianAddressAdded(address indexed custodian);\n\n // @notice Event emitted when a custodian address is removed\n event CustodianAddressRemoved(address indexed custodian);\n\n /// @notice Event emitted when assets are moved to custody provider wallet\n event CustodyTransfer(\n address indexed wallet,\n address indexed asset,\n uint256 amount\n );\n\n /// @notice Event emitted when lvlUSD is set\n event lvlUSDSet(address indexed lvlUSD);\n\n /// @notice Event emitted when the max mint per block is changed\n event MaxMintPerBlockChanged(\n uint256 indexed oldMaxMintPerBlock,\n uint256 indexed newMaxMintPerBlock\n );\n\n /// @notice Event emitted when the max redeem per block is changed\n event MaxRedeemPerBlockChanged(\n uint256 indexed oldMaxRedeemPerBlock,\n uint256 indexed newMaxRedeemPerBlock\n );\n\n /// @notice Event emitted when a delegated signer is added, enabling it to sign orders on behalf of another address\n event DelegatedSignerAdded(\n address indexed signer,\n address indexed delegator\n );\n\n /// @notice Event emitted when a delegated signer is removed\n event DelegatedSignerRemoved(\n address indexed signer,\n address indexed delegator\n );\n}\n" }, "lib/openzeppelin-contracts/contracts/access/IAccessControl.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControl {\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 {AccessControl-_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 Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) external view returns (bool);\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 {AccessControl-_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\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;\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;\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}\n" }, "lib/openzeppelin-contracts/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" }, "lib/openzeppelin-contracts/contracts/utils/introspection/ERC165.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" }, "lib/openzeppelin-contracts/contracts/utils/math/Math.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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 256, 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 << 3) < value ? 1 : 0);\n }\n }\n}\n" }, "lib/openzeppelin-contracts/contracts/utils/math/SignedMath.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" }, "lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" } }, "settings": { "remappings": [ "ds-test/=lib/ds-test/src/", "forge-std/=lib/forge-std/src/", "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "openzeppelin/=lib/openzeppelin-contracts/contracts/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "libraries": {} } }}
1
20,290,497
1479926cee33826f445ee6d21f657acbd4c6e01ca2b71f70e152388e9deab33a
d5fd1abadd6afe7fae181bf9da0d44b99c4fa366c83f5f1a2b9c58607c585f78
77f9f371db3f1779384f0e0936241599e27f3583
ffa397285ce46fb78c588a9e993286aac68c37cd
7c41d90adcf95b9bfd435a2ee6510e35b527e4a4
3d602d80600a3d3981f3363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3
pragma solidity 0.7.5; /* The MIT License (MIT) Copyright (c) 2018 Murray Software, LLC. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //solhint-disable max-line-length //solhint-disable no-inline-assembly contract CloneFactory { function createClone(address target, bytes32 salt) internal returns (address payable result) { bytes20 targetBytes = bytes20(target); assembly { // load the next free memory slot as a place to store the clone contract data let clone := mload(0x40) // The bytecode block below is responsible for contract initialization // during deployment, it is worth noting the proxied contract constructor will not be called during // the cloning procedure and that is why an initialization function needs to be called after the // clone is created mstore( clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000 ) // This stores the address location of the implementation contract // so that the proxy knows where to delegate call logic to mstore(add(clone, 0x14), targetBytes) // The bytecode block is the actual code that is deployed for each clone created. // It forwards all calls to the already deployed implementation via a delegatecall mstore( add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000 ) // deploy the contract using the CREATE2 opcode // this deploys the minimal proxy defined above, which will proxy all // calls to use the logic defined in the implementation contract `target` result := create2(0, clone, 0x37, salt) } } function isClone(address target, address query) internal view returns (bool result) { bytes20 targetBytes = bytes20(target); assembly { // load the next free memory slot as a place to store the comparison clone let clone := mload(0x40) // The next three lines store the expected bytecode for a miniml proxy // that targets `target` as its implementation contract mstore( clone, 0x363d3d373d3d3d363d7300000000000000000000000000000000000000000000 ) mstore(add(clone, 0xa), targetBytes) mstore( add(clone, 0x1e), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000 ) // the next two lines store the bytecode of the contract that we are checking in memory let other := add(clone, 0x40) extcodecopy(query, other, 0, 0x2d) // Check if the expected bytecode equals the actual bytecode and return the result result := and( eq(mload(clone), mload(other)), eq(mload(add(clone, 0xd)), mload(add(other, 0xd))) ) } } } /** * Contract that exposes the needed erc20 token functions */ abstract contract ERC20Interface { // Send _value amount of tokens to address _to function transfer(address _to, uint256 _value) public virtual returns (bool success); // Get the account balance of another account with address _owner function balanceOf(address _owner) public virtual view returns (uint256 balance); } // helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false library TransferHelper { function safeApprove( address token, address to, uint256 value ) internal { // bytes4(keccak256(bytes('approve(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::safeApprove: approve failed' ); } function safeTransfer( address token, address to, uint256 value ) internal { // bytes4(keccak256(bytes('transfer(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::safeTransfer: transfer failed' ); } function safeTransferFrom( address token, address from, address to, uint256 value ) internal { // bytes4(keccak256(bytes('transferFrom(address,address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::transferFrom: transferFrom failed' ); } function safeTransferETH(address to, uint256 value) internal { (bool success, ) = to.call{value: value}(new bytes(0)); require(success, 'TransferHelper::safeTransferETH: ETH transfer failed'); } } /** * Contract that will forward any incoming Ether to the creator of the contract * */ contract Forwarder { // Address to which any funds sent to this contract will be forwarded address public parentAddress; event ForwarderDeposited(address from, uint256 value, bytes data); /** * Initialize the contract, and sets the destination address to that of the creator */ function init(address _parentAddress) external onlyUninitialized { parentAddress = _parentAddress; uint256 value = address(this).balance; if (value == 0) { return; } (bool success, ) = parentAddress.call{ value: value }(''); require(success, 'Flush failed'); // NOTE: since we are forwarding on initialization, // we don't have the context of the original sender. // We still emit an event about the forwarding but set // the sender to the forwarder itself emit ForwarderDeposited(address(this), value, msg.data); } /** * Modifier that will execute internal code block only if the sender is the parent address */ modifier onlyParent { require(msg.sender == parentAddress, 'Only Parent'); _; } /** * Modifier that will execute internal code block only if the contract has not been initialized yet */ modifier onlyUninitialized { require(parentAddress == address(0x0), 'Already initialized'); _; } /** * Default function; Gets called when data is sent but does not match any other function */ fallback() external payable { flush(); } /** * Default function; Gets called when Ether is deposited with no data, and forwards it to the parent address */ receive() external payable { flush(); } /** * Execute a token transfer of the full balance from the forwarder token to the parent address * @param tokenContractAddress the address of the erc20 token contract */ function flushTokens(address tokenContractAddress) external onlyParent { ERC20Interface instance = ERC20Interface(tokenContractAddress); address forwarderAddress = address(this); uint256 forwarderBalance = instance.balanceOf(forwarderAddress); if (forwarderBalance == 0) { return; } TransferHelper.safeTransfer( tokenContractAddress, parentAddress, forwarderBalance ); } /** * Flush the entire balance of the contract to the parent address. */ function flush() public { uint256 value = address(this).balance; if (value == 0) { return; } (bool success, ) = parentAddress.call{ value: value }(''); require(success, 'Flush failed'); emit ForwarderDeposited(msg.sender, value, msg.data); } } contract ForwarderFactory is CloneFactory { address public implementationAddress; event ForwarderCreated(address newForwarderAddress, address parentAddress); constructor(address _implementationAddress) { implementationAddress = _implementationAddress; } function createForwarder(address parent, bytes32 salt) external { // include the signers in the salt so any contract deployed to a given address must have the same signers bytes32 finalSalt = keccak256(abi.encodePacked(parent, salt)); address payable clone = createClone(implementationAddress, finalSalt); Forwarder(clone).init(parent); emit ForwarderCreated(clone, parent); } }
1
20,290,501
5731a6167040a6de0cd61859070aadbe63dc5a35bf12c55e546a0aa91428e7b1
c255f1ffbfe2392861610b5e453415a888dbe3e69e660f99c23b11ce55ff4d82
c9aad2fc90eddacf02bd11fa690e3b44e318aa9b
a2a1bf5a83f9daec2dc364e1c561e937163cb613
3ddf8f4e6fe3e5316af756fc6f46bdbb0a636a09
3d602d80600a3d3981f3363d3d373d3d3d363d7387ae9be718aa310323042ab9806bd6692c1129b75af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7387ae9be718aa310323042ab9806bd6692c1129b75af43d82803e903d91602b57fd5bf3
1
20,290,502
47098f596c3e606f0e171c0d0f058bc5a89cf08840c680bf8a8ce55dee3616a0
1dacda24ae06515f8e40df25908fc8df8e1f5427d2c76638c291d25d7f214194
e04415142de52c30bc014b74c43a65adb41759b5
0cde500e6940931ed190ded77bb48640c9486392
c2ef48132d1436c2a8c94791781e66d9f3f17088
3d602d80600a3d3981f3363d3d373d3d3d363d737c245a2d29b88cb7c5fb118518fc7f03e85f2e995af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d737c245a2d29b88cb7c5fb118518fc7f03e85f2e995af43d82803e903d91602b57fd5bf3
{{ "language": "Solidity", "sources": { "contracts/interface/IERC20.sol": { "content": "/**\r\n * SPDX-License-Identifier: MIT\r\n *\r\n * Copyright (c) 2016-2019 zOS Global Limited\r\n *\r\n */\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Interface of the ERC20 standard as defined in the EIP. Does not include\r\n * the optional functions; to access them see `ERC20Detailed`.\r\n */\r\n\r\ninterface IERC20 {\r\n function name() external view returns (string memory);\r\n\r\n function symbol() external view returns (string memory);\r\n\r\n function decimals() external view returns (uint8);\r\n\r\n /**\r\n * @dev Returns the amount of tokens in existence.\r\n */\r\n function totalSupply() external view returns (uint256);\r\n\r\n /**\r\n * @dev Returns the amount of tokens owned by `account`.\r\n */\r\n function balanceOf(address account) external view returns (uint256);\r\n\r\n /**\r\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\r\n *\r\n * Returns always true. Throws error on failure.\r\n *\r\n * Emits a `Transfer` event.\r\n */\r\n function transfer(address recipient, uint256 amount) external returns (bool);\r\n\r\n /**\r\n * @dev Returns the remaining number of tokens that `spender` will be\r\n * allowed to spend on behalf of `owner` through `transferFrom`. This is\r\n * zero by default.\r\n *\r\n * This value can change when `approve` or `transferFrom` are called.\r\n */\r\n function allowance(address owner, address spender) external view returns (uint256);\r\n\r\n /**\r\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\r\n *\r\n * Returns a boolean value indicating whether the operation succeeded.\r\n *\r\n * > Beware that changing an allowance with this method brings the risk\r\n * that someone may use both the old and the new allowance by unfortunate\r\n * transaction ordering. One possible solution to mitigate this race\r\n * condition is to first reduce the spender's allowance to 0 and set the\r\n * desired value afterwards:\r\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\r\n *\r\n * Emits an `Approval` event.\r\n */\r\n function approve(address spender, uint256 amount) external returns (bool);\r\n\r\n /**\r\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\r\n * allowance mechanism. `amount` is then deducted from the caller's\r\n * allowance.\r\n *\r\n * Returns always true. Throws error on failure.\r\n *\r\n * Emits a `Transfer` event.\r\n */\r\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\r\n\r\n /**\r\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\r\n * another (`to`).\r\n *\r\n * Note that `value` may be zero.\r\n */\r\n event Transfer(address indexed from, address indexed to, uint256 value);\r\n\r\n /**\r\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\r\n * a call to `approve`. `value` is the new allowance.\r\n */\r\n event Approval(address indexed owner, address indexed spender, uint256 value);\r\n}\r\n" }, "contracts/interface/IFrankencoin.sol": { "content": "// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./IERC20.sol\";\r\nimport \"./IReserve.sol\";\r\n\r\ninterface IFrankencoin is IERC20 {\r\n function suggestMinter(address _minter, uint256 _applicationPeriod, uint256 _applicationFee, string calldata _message) external;\r\n\r\n function registerPosition(address position) external;\r\n\r\n function denyMinter(address minter, address[] calldata helpers, string calldata message) external;\r\n\r\n function reserve() external view returns (IReserve);\r\n\r\n function minterReserve() external view returns (uint256);\r\n\r\n function calculateAssignedReserve(uint256 mintedAmount, uint32 _reservePPM) external view returns (uint256);\r\n\r\n function equity() external view returns (uint256);\r\n\r\n function isMinter(address minter) external view returns (bool);\r\n\r\n function getPositionParent(address position) external view returns (address);\r\n\r\n function mint(address target, uint256 amount) external;\r\n\r\n function mintWithReserve(address target, uint256 amount, uint32 reservePPM, uint32 feePPM) external;\r\n\r\n function burnFrom(address target, uint256 amount) external;\r\n\r\n function burnWithoutReserve(uint256 amountIncludingReserve, uint32 reservePPM) external;\r\n\r\n function burnFromWithReserve(address payer, uint256 targetTotalBurnAmount, uint32 _reservePPM) external returns (uint256);\r\n\r\n function burnWithReserve(uint256 amountExcludingReserve, uint32 reservePPM) external returns (uint256);\r\n\r\n function coverLoss(address source, uint256 amount) external;\r\n\r\n function collectProfits(address source, uint256 _amount) external;\r\n}\r\n" }, "contracts/interface/IPosition.sol": { "content": "// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./IERC20.sol\";\r\nimport \"./IReserve.sol\";\r\nimport \"./IFrankencoin.sol\";\r\n\r\ninterface IPosition {\r\n\r\n function original() external returns (address);\r\n\r\n function collateral() external returns (IERC20);\r\n\r\n function minimumCollateral() external returns (uint256);\r\n\r\n function challengePeriod() external returns (uint64);\r\n\r\n function expiration() external returns (uint256);\r\n\r\n function price() external returns (uint256);\r\n\r\n function reduceLimitForClone(uint256 amount) external;\r\n\r\n function initializeClone(address owner, uint256 _price, uint256 _coll, uint256 _mint, uint256 expiration) external;\r\n\r\n function deny(address[] calldata helpers, string calldata message) external;\r\n\r\n function mint(address target, uint256 amount) external;\r\n\r\n function minted() external returns (uint256);\r\n\r\n function reserveContribution() external returns (uint32);\r\n\r\n function getUsableMint(uint256 totalMint, bool beforeFees) external view returns (uint256);\r\n\r\n function challengeData(uint256 challengeStart) external view returns (uint256 liqPrice, uint64 phase1, uint64 phase2);\r\n\r\n function notifyChallengeStarted(uint256 size) external;\r\n\r\n function notifyChallengeAverted(uint256 size) external;\r\n\r\n function notifyChallengeSucceeded(address _bidder, uint256 _size) external returns (address, uint256, uint256, uint32);\r\n\r\n}" }, "contracts/interface/IReserve.sol": { "content": "// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./IERC20.sol\";\r\n\r\ninterface IReserve is IERC20 {\r\n function invest(uint256 amount, uint256 expected) external returns (uint256);\r\n function checkQualified(address sender, address[] calldata helpers) external view;\r\n}" }, "contracts/Position.sol": { "content": "// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./utils/Ownable.sol\";\r\nimport \"./utils/MathUtil.sol\";\r\n\r\nimport \"./interface/IERC20.sol\";\r\nimport \"./interface/IPosition.sol\";\r\nimport \"./interface/IReserve.sol\";\r\nimport \"./interface/IFrankencoin.sol\";\r\n\r\n/**\r\n * @title Position\r\n * @notice A collateralized minting position.\r\n */\r\ncontract Position is Ownable, IPosition, MathUtil {\r\n /**\r\n * @notice Note that this contract is intended to be cloned. All clones will share the same values for\r\n * the constant and immutable fields, but have their own values for the other fields.\r\n */\r\n\r\n /**\r\n * @notice The zchf price per unit of the collateral below which challenges succeed, (36 - collateral.decimals) decimals\r\n */\r\n uint256 public price;\r\n\r\n /**\r\n * @notice Net minted amount, including reserve.\r\n */\r\n uint256 public minted;\r\n\r\n /**\r\n * @notice Amount of the collateral that is currently under a challenge.\r\n * Used to figure out whether there are pending challenges.\r\n */\r\n uint256 public challengedAmount;\r\n\r\n /**\r\n * @notice Challenge period in seconds.\r\n */\r\n uint64 public immutable challengePeriod;\r\n\r\n /**\r\n * @notice End of the latest cooldown. If this is in the future, minting is suspended.\r\n */\r\n uint256 public cooldown;\r\n\r\n /**\r\n * @notice How much can be minted at most.\r\n */\r\n uint256 public limit;\r\n\r\n /**\r\n * @notice Timestamp when minting can start and the position no longer denied.\r\n */\r\n uint256 public immutable start;\r\n\r\n /**\r\n * @notice Timestamp of the expiration of the position. After expiration, challenges cannot be averted\r\n * any more. This is also the basis for fee calculations.\r\n */\r\n uint256 public expiration;\r\n\r\n /**\r\n * @notice The original position to help identifying clones.\r\n */\r\n address public immutable original;\r\n\r\n /**\r\n * @notice Pointer to the minting hub.\r\n */\r\n address public immutable hub;\r\n\r\n /**\r\n * @notice The Frankencoin contract.\r\n */\r\n IFrankencoin public immutable zchf;\r\n\r\n /**\r\n * @notice The collateral token.\r\n */\r\n IERC20 public immutable override collateral;\r\n\r\n /**\r\n * @notice Minimum acceptable collateral amount to prevent dust.\r\n */\r\n uint256 public immutable override minimumCollateral;\r\n\r\n /**\r\n * @notice Always pay interest for at least four weeks.\r\n */\r\n uint256 private constant MIN_INTEREST_DURATION = 4 weeks;\r\n\r\n /**\r\n * @notice The interest in parts per million per year that is deducted when minting Frankencoins.\r\n * To be paid upfront.\r\n */\r\n uint32 public immutable annualInterestPPM;\r\n\r\n /**\r\n * @notice The reserve contribution in parts per million of the minted amount.\r\n */\r\n uint32 public immutable reserveContribution;\r\n\r\n event MintingUpdate(uint256 collateral, uint256 price, uint256 minted, uint256 limit);\r\n event PositionDenied(address indexed sender, string message); // emitted if closed by governance\r\n\r\n error InsufficientCollateral();\r\n error TooLate();\r\n error RepaidTooMuch(uint256 excess);\r\n error LimitExceeded();\r\n error ChallengeTooSmall();\r\n error Expired();\r\n error Hot();\r\n error Challenged();\r\n error NotHub();\r\n\r\n modifier alive() {\r\n if (block.timestamp >= expiration) revert Expired();\r\n _;\r\n }\r\n\r\n modifier noCooldown() {\r\n if (block.timestamp <= cooldown) revert Hot();\r\n _;\r\n }\r\n\r\n modifier noChallenge() {\r\n if (challengedAmount > 0) revert Challenged();\r\n _;\r\n }\r\n\r\n modifier onlyHub() {\r\n if (msg.sender != address(hub)) revert NotHub();\r\n _;\r\n }\r\n\r\n /**\r\n * @dev See MintingHub.openPosition\r\n */\r\n constructor(\r\n address _owner,\r\n address _hub,\r\n address _zchf,\r\n address _collateral,\r\n uint256 _minCollateral,\r\n uint256 _initialLimit,\r\n uint256 _initPeriod,\r\n uint256 _duration,\r\n uint64 _challengePeriod,\r\n uint32 _annualInterestPPM,\r\n uint256 _liqPrice,\r\n uint32 _reservePPM\r\n ) {\r\n require(_initPeriod >= 3 days); // must be at least three days, recommended to use higher values\r\n _setOwner(_owner);\r\n original = address(this);\r\n hub = _hub;\r\n zchf = IFrankencoin(_zchf);\r\n collateral = IERC20(_collateral);\r\n annualInterestPPM = _annualInterestPPM;\r\n reserveContribution = _reservePPM;\r\n minimumCollateral = _minCollateral;\r\n challengePeriod = _challengePeriod;\r\n start = block.timestamp + _initPeriod; // at least three days time to deny the position\r\n cooldown = start;\r\n expiration = start + _duration;\r\n limit = _initialLimit;\r\n _setPrice(_liqPrice);\r\n }\r\n\r\n /**\r\n * @notice Method to initialize a freshly created clone. It is the responsibility of the creator to make sure this is only\r\n * called once and to call reduceLimitForClone on the original position before initializing the clone.\r\n */\r\n function initializeClone(\r\n address owner,\r\n uint256 _price,\r\n uint256 _coll,\r\n uint256 _initialMint,\r\n uint256 expirationTime\r\n ) external onlyHub {\r\n if (_coll < minimumCollateral) revert InsufficientCollateral();\r\n uint256 impliedPrice = (_initialMint * ONE_DEC18) / _coll;\r\n _initialMint = (impliedPrice * _coll) / ONE_DEC18; // to cancel potential rounding errors\r\n if (impliedPrice > _price) revert InsufficientCollateral();\r\n _setOwner(owner);\r\n limit = _initialMint;\r\n expiration = expirationTime;\r\n _setPrice(impliedPrice);\r\n _mint(owner, _initialMint, _coll);\r\n }\r\n\r\n function limitForClones() public view returns (uint256) {\r\n uint256 backedLimit = (_collateralBalance() * price) / ONE_DEC18;\r\n if (backedLimit >= limit) {\r\n return 0;\r\n } else {\r\n // due to invariants, this is always below (limit - minted)\r\n return limit - backedLimit;\r\n }\r\n }\r\n\r\n /**\r\n * @notice Adjust this position's limit to allow a clone to mint its own Frankencoins.\r\n * Invariant: global limit stays the same.\r\n *\r\n * Cloning a position is only allowed if the position is not challenged, not expired and not in cooldown.\r\n */\r\n function reduceLimitForClone(uint256 mint_) external noChallenge noCooldown alive onlyHub {\r\n if (mint_ > limitForClones()) revert LimitExceeded();\r\n limit -= mint_;\r\n }\r\n\r\n /**\r\n * @notice Qualified pool share holders can call this method to immediately expire a freshly proposed position.\r\n */\r\n function deny(address[] calldata helpers, string calldata message) external {\r\n if (block.timestamp >= start) revert TooLate();\r\n IReserve(zchf.reserve()).checkQualified(msg.sender, helpers);\r\n _close(); // since expiration is immutable, we put it under eternal cooldown\r\n emit PositionDenied(msg.sender, message);\r\n }\r\n\r\n function _close() internal {\r\n cooldown = type(uint256).max;\r\n }\r\n\r\n function isClosed() public view returns (bool) {\r\n return cooldown == type(uint256).max;\r\n }\r\n\r\n /**\r\n * @notice This is how much the minter can actually use when minting ZCHF, with the rest being used\r\n * assigned to the minter reserve or (if applicable) fees.\r\n */\r\n function getUsableMint(uint256 totalMint, bool afterFees) external view returns (uint256) {\r\n if (afterFees) {\r\n return (totalMint * (1000_000 - reserveContribution - calculateCurrentFee())) / 1000_000;\r\n } else {\r\n return (totalMint * (1000_000 - reserveContribution)) / 1000_000;\r\n }\r\n }\r\n\r\n /**\r\n * @notice \"All in one\" function to adjust the outstanding amount of ZCHF, the collateral amount,\r\n * and the price in one transaction.\r\n */\r\n function adjust(uint256 newMinted, uint256 newCollateral, uint256 newPrice) external onlyOwner {\r\n uint256 colbal = _collateralBalance();\r\n if (newCollateral > colbal) {\r\n collateral.transferFrom(msg.sender, address(this), newCollateral - colbal);\r\n }\r\n // Must be called after collateral deposit, but before withdrawal\r\n if (newMinted < minted) {\r\n zchf.burnFromWithReserve(msg.sender, minted - newMinted, reserveContribution);\r\n minted = newMinted;\r\n }\r\n if (newCollateral < colbal) {\r\n withdrawCollateral(msg.sender, colbal - newCollateral);\r\n }\r\n // Must be called after collateral withdrawal\r\n if (newMinted > minted) {\r\n mint(msg.sender, newMinted - minted);\r\n }\r\n if (newPrice != price) {\r\n adjustPrice(newPrice);\r\n }\r\n }\r\n\r\n /**\r\n * @notice Allows the position owner to adjust the liquidation price as long as there is no pending challenge.\r\n * Lowering the liquidation price can be done with immediate effect, given that there is enough collateral.\r\n * Increasing the liquidation price triggers a cooldown period of 3 days, during which minting is suspended.\r\n */\r\n function adjustPrice(uint256 newPrice) public onlyOwner noChallenge {\r\n if (newPrice > price) {\r\n _restrictMinting(3 days);\r\n } else {\r\n _checkCollateral(_collateralBalance(), newPrice);\r\n }\r\n _setPrice(newPrice);\r\n emit MintingUpdate(_collateralBalance(), price, minted, limit);\r\n }\r\n\r\n function _setPrice(uint256 newPrice) internal {\r\n require(newPrice * minimumCollateral <= limit * ONE_DEC18); // sanity check\r\n price = newPrice;\r\n }\r\n\r\n function _collateralBalance() internal view returns (uint256) {\r\n return IERC20(collateral).balanceOf(address(this));\r\n }\r\n\r\n /**\r\n * @notice Mint ZCHF as long as there is no open challenge, the position is not subject to a cooldown,\r\n * and there is sufficient collateral.\r\n */\r\n function mint(address target, uint256 amount) public onlyOwner noChallenge noCooldown alive {\r\n _mint(target, amount, _collateralBalance());\r\n }\r\n\r\n function calculateCurrentFee() public view returns (uint32) {\r\n uint256 exp = expiration;\r\n uint256 time = block.timestamp < start ? start : block.timestamp;\r\n uint256 timePassed = time >= exp - MIN_INTEREST_DURATION ? MIN_INTEREST_DURATION : exp - time;\r\n // Time resolution is in the range of minutes for typical interest rates.\r\n return uint32((timePassed * annualInterestPPM) / 365 days);\r\n }\r\n\r\n function _mint(address target, uint256 amount, uint256 collateral_) internal {\r\n if (minted + amount > limit) revert LimitExceeded();\r\n zchf.mintWithReserve(target, amount, reserveContribution, calculateCurrentFee());\r\n minted += amount;\r\n\r\n _checkCollateral(collateral_, price);\r\n emit MintingUpdate(_collateralBalance(), price, minted, limit);\r\n }\r\n\r\n function _restrictMinting(uint256 period) internal {\r\n uint256 horizon = block.timestamp + period;\r\n if (horizon > cooldown) {\r\n cooldown = horizon;\r\n }\r\n }\r\n\r\n /**\r\n * @notice Repay some ZCHF. If too much is repaid, the call fails.\r\n * It is possible to repay while there are challenges, but the collateral is locked until all is clear again.\r\n *\r\n * The repaid amount should fulfill the following equation in order to close the position,\r\n * i.e. bring the minted amount to 0:\r\n * minted = amount + zchf.calculateAssignedReserve(amount, reservePPM)\r\n *\r\n * Under normal circumstances, this implies:\r\n * amount = minted * (1000000 - reservePPM)\r\n *\r\n * E.g. if minted is 50 and reservePPM is 200000, it is necessary to repay 40 to be able to close the position.\r\n */\r\n function repay(uint256 amount) public {\r\n IERC20(zchf).transferFrom(msg.sender, address(this), amount);\r\n uint256 actuallyRepaid = IFrankencoin(zchf).burnWithReserve(amount, reserveContribution);\r\n _notifyRepaid(actuallyRepaid);\r\n emit MintingUpdate(_collateralBalance(), price, minted, limit);\r\n }\r\n\r\n function _notifyRepaid(uint256 amount) internal {\r\n if (amount > minted) revert RepaidTooMuch(amount - minted);\r\n minted -= amount;\r\n }\r\n\r\n /**\r\n * @notice Withdraw any ERC20 token that might have ended up on this address.\r\n * Withdrawing collateral is subject to the same restrictions as withdrawCollateral(...).\r\n */\r\n function withdraw(address token, address target, uint256 amount) external onlyOwner {\r\n if (token == address(collateral)) {\r\n withdrawCollateral(target, amount);\r\n } else {\r\n uint256 balance = _collateralBalance();\r\n IERC20(token).transfer(target, amount);\r\n require(balance == _collateralBalance()); // guard against double-entry-point tokens\r\n }\r\n }\r\n\r\n /**\r\n * @notice Withdraw collateral from the position up to the extent that it is still well collateralized afterwards.\r\n * Not possible as long as there is an open challenge or the contract is subject to a cooldown.\r\n *\r\n * Withdrawing collateral below the minimum collateral amount formally closes the position.\r\n */\r\n function withdrawCollateral(address target, uint256 amount) public onlyOwner noChallenge {\r\n if (block.timestamp <= cooldown && !isClosed()) revert Hot();\r\n uint256 balance = _withdrawCollateral(target, amount);\r\n _checkCollateral(balance, price);\r\n if (balance < minimumCollateral && balance > 0) revert InsufficientCollateral(); // Prevent dust amounts\r\n }\r\n\r\n function _withdrawCollateral(address target, uint256 amount) internal returns (uint256) {\r\n if (amount > 0) {\r\n // Some weird tokens fail when trying to transfer 0 amounts\r\n IERC20(collateral).transfer(target, amount);\r\n }\r\n uint256 balance = _collateralBalance();\r\n _considerClose(balance);\r\n emit MintingUpdate(balance, price, minted, limit);\r\n return balance;\r\n }\r\n\r\n function _considerClose(uint256 collateralBalance) internal {\r\n if (collateralBalance < minimumCollateral && challengedAmount == 0) {\r\n // This leaves a slightly unsatisfying possibility open: if the withdrawal happens due to a successful\r\n // challenge, there might be a small amount of collateral left that is not withheld in case there are no\r\n // other pending challenges. The only way to cleanly solve this would be to have two distinct cooldowns,\r\n // one for minting and one for withdrawals.\r\n _close();\r\n }\r\n }\r\n\r\n /**\r\n * @notice This invariant must always hold and must always be checked when any of the three\r\n * variables change in an adverse way.\r\n */\r\n function _checkCollateral(uint256 collateralReserve, uint256 atPrice) internal view {\r\n if (collateralReserve * atPrice < minted * ONE_DEC18) revert InsufficientCollateral();\r\n }\r\n\r\n /**\r\n * @notice Returns the liquidation price and the durations for phase1 and phase2 of the challenge.\r\n * Both phases are usually of equal duration, but near expiration, phase one is adjusted such that\r\n * it cannot last beyond the expiration date of the position.\r\n */\r\n function challengeData(uint256 challengeStart) external view returns (uint256 liqPrice, uint64 phase1, uint64 phase2) {\r\n uint256 timeToExpiration = challengeStart >= expiration ? 0 : expiration - challengeStart;\r\n return (price, uint64(_min(timeToExpiration, challengePeriod)), challengePeriod);\r\n }\r\n\r\n function notifyChallengeStarted(uint256 size) external onlyHub {\r\n // Require minimum size. Collateral balance can be below minimum if it was partially challenged before.\r\n if (size < minimumCollateral && size < _collateralBalance()) revert ChallengeTooSmall();\r\n if (size == 0) revert ChallengeTooSmall();\r\n challengedAmount += size;\r\n }\r\n\r\n /**\r\n * @param size amount of collateral challenged (dec18)\r\n */\r\n function notifyChallengeAverted(uint256 size) external onlyHub {\r\n challengedAmount -= size;\r\n\r\n // Don't allow minter to close the position immediately so challenge can be repeated before\r\n // the owner has a chance to mint more on an undercollateralized position\r\n _restrictMinting(1 days);\r\n\r\n // If this was the last open challenge and there is only a dust amount of collateral left, the position should be closed\r\n _considerClose(_collateralBalance());\r\n }\r\n\r\n /**\r\n * @notice Notifies the position that a challenge was successful.\r\n * Triggers the payout of the challenged part of the collateral.\r\n * Everything else is assumed to be handled by the hub.\r\n *\r\n * @param _bidder address of the bidder that receives the collateral\r\n * @param _size amount of the collateral bid for\r\n * @return (position owner, effective challenge size in ZCHF, amount to be repaid, reserve ppm)\r\n */\r\n function notifyChallengeSucceeded(\r\n address _bidder,\r\n uint256 _size\r\n ) external onlyHub returns (address, uint256, uint256, uint32) {\r\n challengedAmount -= _size;\r\n uint256 colBal = _collateralBalance();\r\n if (colBal < _size) {\r\n _size = colBal;\r\n }\r\n uint256 repayment = colBal == 0 ? 0 : minted * _size / colBal; // for enormous colBal, this could be rounded to 0, which is ok\r\n _notifyRepaid(repayment); // we assume the caller takes care of the actual repayment\r\n\r\n // Give time for additional challenges before the owner can mint again. In particular,\r\n // the owner might have added collateral only seconds before the challenge ended, preventing a close.\r\n _restrictMinting(3 days);\r\n \r\n _withdrawCollateral(_bidder, _size); // transfer collateral to the bidder and emit update\r\n\r\n return (owner, _size, repayment, reserveContribution);\r\n }\r\n}\r\n" }, "contracts/utils/MathUtil.sol": { "content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @title Functions for share valuation\r\n */\r\ncontract MathUtil {\r\n uint256 internal constant ONE_DEC18 = 10 ** 18;\r\n\r\n // Let's go for 12 digits of precision (18-6)\r\n uint256 internal constant THRESH_DEC18 = 10 ** 6;\r\n\r\n /**\r\n * @notice Cubic root with Halley approximation\r\n * Number 1e18 decimal\r\n * @param _v number for which we calculate x**(1/3)\r\n * @return returns _v**(1/3)\r\n */\r\n function _cubicRoot(uint256 _v) internal pure returns (uint256) {\r\n // Good first guess for _v slightly above 1.0, which is often the case in the Frankencoin system\r\n uint256 x = _v > ONE_DEC18 && _v < 10 ** 19 ? (_v - ONE_DEC18) / 3 + ONE_DEC18 : ONE_DEC18;\r\n uint256 diff;\r\n do {\r\n uint256 powX3 = _mulD18(_mulD18(x, x), x);\r\n uint256 xnew = x * (powX3 + 2 * _v) / (2 * powX3 + _v);\r\n diff = xnew > x ? xnew - x : x - xnew;\r\n x = xnew;\r\n } while (diff > THRESH_DEC18);\r\n return x;\r\n }\r\n\r\n function _mulD18(uint256 _a, uint256 _b) internal pure returns (uint256) {\r\n return (_a * _b) / ONE_DEC18;\r\n }\r\n\r\n function _divD18(uint256 _a, uint256 _b) internal pure returns (uint256) {\r\n return (_a * ONE_DEC18) / _b;\r\n }\r\n\r\n function _power3(uint256 _x) internal pure returns (uint256) {\r\n return _mulD18(_mulD18(_x, _x), _x);\r\n }\r\n\r\n function _min(uint256 a, uint256 b) internal pure returns (uint256) {\r\n return a < b ? a : b;\r\n }\r\n}\r\n" }, "contracts/utils/Ownable.sol": { "content": "// SPDX-License-Identifier: MIT\r\n//\r\n// From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol\r\n//\r\n// Modifications:\r\n// - Replaced Context._msgSender() with msg.sender\r\n// - Made leaner\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Contract module which provides a basic access control mechanism, where\r\n * there is an account (an owner) that can be granted exclusive access to\r\n * specific functions.\r\n *\r\n * By default, the owner account will be the one that deploys the contract. This\r\n * can later be changed with {transferOwnership}.\r\n */\r\ncontract Ownable {\r\n address public owner;\r\n\r\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\r\n\r\n error NotOwner();\r\n\r\n /**\r\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\r\n * Can only be called by the current owner.\r\n */\r\n function transferOwnership(address newOwner) public onlyOwner {\r\n _setOwner(newOwner);\r\n }\r\n\r\n /**\r\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\r\n * Internal function without access restriction.\r\n */\r\n function _setOwner(address newOwner) internal {\r\n require(newOwner != address(0x0));\r\n address oldOwner = owner;\r\n owner = newOwner;\r\n emit OwnershipTransferred(oldOwner, newOwner);\r\n }\r\n\r\n function _requireOwner(address sender) internal view {\r\n if (owner != sender) revert NotOwner();\r\n }\r\n\r\n modifier onlyOwner() {\r\n _requireOwner(msg.sender);\r\n _;\r\n }\r\n}\r\n" } }, "settings": { "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "metadata": { "useLiteralContent": true }, "libraries": {} } }}
1
20,290,504
3473db8a1c1486f31e4b787273aede826ec924d724f63325095a9362dfe117a6
6f29577edb449f8a360ebb62a597c0d9b4bbd2f255779f3454871d93af2bae96
52dd2260bf8594cde68339923887638f04a84ce8
e7d8df8f6546965a59dab007e8709965efe1255d
011b9aed95bfc6b5b41aaee833fe51bd0649a019
608060405234801561001057600080fd5b506040516101a23803806101a28339818101604052602081101561003357600080fd5b50516001600160a01b03811661007a5760405162461bcd60e51b815260040180806020018281038252602481526020018061017e6024913960400191505060405180910390fd5b600080546001600160a01b039092166001600160a01b031990921691909117905560d5806100a96000396000f3fe608060405236603757604051339034907f8863e458255c600ae3e61be347822f3ee57088c8538b68b5dd2357e682e59e1990600090a3005b600073ffffffffffffffffffffffffffffffffffffffff8154167fa619486e0000000000000000000000000000000000000000000000000000000082351415608157808252602082f35b3682833781823684845af490503d82833e80609a573d82fd5b503d81f3fea2646970667358221220c8ef5c5147809cc480e3260788e027fa751bfcf051cf3d463bbaeeff798437f364736f6c63430007060033496e76616c6964206d617374657220636f707920616464726573732070726f766964656400000000000000000000000023a19a97a2da581e3d66ef5fd1eea15024f55611
608060405236603757604051339034907f8863e458255c600ae3e61be347822f3ee57088c8538b68b5dd2357e682e59e1990600090a3005b600073ffffffffffffffffffffffffffffffffffffffff8154167fa619486e0000000000000000000000000000000000000000000000000000000082351415608157808252602082f35b3682833781823684845af490503d82833e80609a573d82fd5b503d81f3fea2646970667358221220c8ef5c5147809cc480e3260788e027fa751bfcf051cf3d463bbaeeff798437f364736f6c63430007060033
1
20,290,506
213e66890a72f3f644a017e835b57f38b4d95b87462b5fdc9285f6b5a75be41f
68f47c90292e1e713b33fa5dfef7a8a117825abc9dad2c8c5d9f7b45446ea27b
7af87418733265e4f34c7e6cbc65fda198314290
1f98431c8ad98523631ae4a59f267346ea31f984
d01a878a8e4c1825a33164537d9e48fe9920d121
6101606040523480156200001257600080fd5b503060601b60805260408051630890357360e41b81529051600091339163890357309160048082019260a092909190829003018186803b1580156200005657600080fd5b505afa1580156200006b573d6000803e3d6000fd5b505050506040513d60a08110156200008257600080fd5b508051602080830151604084015160608086015160809096015160e896871b6001600160e81b0319166101005291811b6001600160601b031990811660e05292811b831660c0529390931b1660a052600282810b900b90921b610120529150620000f79082906200010f811b62002b8417901c565b60801b6001600160801b03191661014052506200017d565b60008082600281900b620d89e719816200012557fe5b05029050600083600281900b620d89e8816200013d57fe5b0502905060008460020b83830360020b816200015557fe5b0560010190508062ffffff166001600160801b038016816200017357fe5b0495945050505050565b60805160601c60a05160601c60c05160601c60e05160601c6101005160e81c6101205160e81c6101405160801c61567e6200024a60003980611fee5280614b5f5280614b96525080610c0052806128fd5280614bca5280614bfc525080610cef52806119cb5280611a0252806129455250806111c75280611a855280611ef4528061244452806129215280613e6b5250806108d252806112f55280611a545280611e8e52806123be5280613d2252508061207b528061227d52806128d9525080612bfb525061567e6000f3fe608060405234801561001057600080fd5b50600436106101ae5760003560e01c806370cf754a116100ee578063c45a015511610097578063ddca3f4311610071578063ddca3f4314610800578063f305839914610820578063f30dba9314610828578063f637731d146108aa576101ae565b8063c45a0155146107d1578063d0c93a7c146107d9578063d21220a7146107f8576101ae565b8063883bdbfd116100c8578063883bdbfd14610633578063a34123a71461073c578063a38807f214610776576101ae565b806370cf754a146105c65780638206a4d1146105ce57806385b66729146105f6576101ae565b80633850c7bd1161015b578063490e6cbc11610135578063490e6cbc146104705780634f1eb3d8146104fc578063514ea4bf1461054d5780635339c296146105a6576101ae565b80633850c7bd1461035b5780633c8a7d8d146103b45780634614131914610456576101ae565b80631ad8b03b1161018c5780631ad8b03b146102aa578063252c09d7146102e157806332148f6714610338576101ae565b80630dfe1681146101b3578063128acb08146101d75780631a68650214610286575b600080fd5b6101bb6108d0565b604080516001600160a01b039092168252519081900360200190f35b61026d600480360360a08110156101ed57600080fd5b6001600160a01b0382358116926020810135151592604082013592606083013516919081019060a08101608082013564010000000081111561022e57600080fd5b82018360208201111561024057600080fd5b8035906020019184600183028401116401000000008311171561026257600080fd5b5090925090506108f4565b6040805192835260208301919091528051918290030190f35b61028e6114ad565b604080516001600160801b039092168252519081900360200190f35b6102b26114bc565b60405180836001600160801b03168152602001826001600160801b031681526020019250505060405180910390f35b6102fe600480360360208110156102f757600080fd5b50356114d6565b6040805163ffffffff909516855260069390930b60208501526001600160a01b039091168383015215156060830152519081900360800190f35b6103596004803603602081101561034e57600080fd5b503561ffff1661151c565b005b610363611616565b604080516001600160a01b03909816885260029690960b602088015261ffff9485168787015292841660608701529216608085015260ff90911660a0840152151560c0830152519081900360e00190f35b61026d600480360360a08110156103ca57600080fd5b6001600160a01b03823516916020810135600290810b92604083013590910b916001600160801b036060820135169181019060a08101608082013564010000000081111561041757600080fd5b82018360208201111561042957600080fd5b8035906020019184600183028401116401000000008311171561044b57600080fd5b509092509050611666565b61045e611922565b60408051918252519081900360200190f35b6103596004803603608081101561048657600080fd5b6001600160a01b0382351691602081013591604082013591908101906080810160608201356401000000008111156104bd57600080fd5b8201836020820111156104cf57600080fd5b803590602001918460018302840111640100000000831117156104f157600080fd5b509092509050611928565b6102b2600480360360a081101561051257600080fd5b506001600160a01b03813516906020810135600290810b91604081013590910b906001600160801b0360608201358116916080013516611d83565b61056a6004803603602081101561056357600080fd5b5035611f9d565b604080516001600160801b0396871681526020810195909552848101939093529084166060840152909216608082015290519081900360a00190f35b61045e600480360360208110156105bc57600080fd5b503560010b611fda565b61028e611fec565b610359600480360360408110156105e457600080fd5b5060ff81358116916020013516612010565b6102b26004803603606081101561060c57600080fd5b506001600160a01b03813516906001600160801b036020820135811691604001351661220f565b6106a36004803603602081101561064957600080fd5b81019060208101813564010000000081111561066457600080fd5b82018360208201111561067657600080fd5b8035906020019184602083028401116401000000008311171561069857600080fd5b5090925090506124dc565b604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b838110156106e75781810151838201526020016106cf565b50505050905001838103825284818151815260200191508051906020019060200280838360005b8381101561072657818101518382015260200161070e565b5050505090500194505050505060405180910390f35b61026d6004803603606081101561075257600080fd5b508035600290810b91602081013590910b90604001356001600160801b0316612569565b6107a06004803603604081101561078c57600080fd5b508035600290810b9160200135900b6126e0565b6040805160069490940b84526001600160a01b03909216602084015263ffffffff1682820152519081900360600190f35b6101bb6128d7565b6107e16128fb565b6040805160029290920b8252519081900360200190f35b6101bb61291f565b610808612943565b6040805162ffffff9092168252519081900360200190f35b61045e612967565b6108486004803603602081101561083e57600080fd5b503560020b61296d565b604080516001600160801b039099168952600f9790970b602089015287870195909552606087019390935260069190910b60808601526001600160a01b031660a085015263ffffffff1660c0840152151560e083015251908190036101000190f35b610359600480360360208110156108c057600080fd5b50356001600160a01b03166129db565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000806108ff612bf0565b85610936576040805162461bcd60e51b8152602060048201526002602482015261415360f01b604482015290519081900360640190fd5b6040805160e0810182526000546001600160a01b0381168252600160a01b8104600290810b810b900b602083015261ffff600160b81b8204811693830193909352600160c81b810483166060830152600160d81b8104909216608082015260ff600160e81b8304811660a0830152600160f01b909204909116151560c082018190526109ef576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b87610a3a5780600001516001600160a01b0316866001600160a01b0316118015610a35575073fffd8963efd1fc6a506488495d951d5263988d266001600160a01b038716105b610a6c565b80600001516001600160a01b0316866001600160a01b0316108015610a6c57506401000276a36001600160a01b038716115b610aa3576040805162461bcd60e51b815260206004820152600360248201526214d41360ea1b604482015290519081900360640190fd5b6000805460ff60f01b191681556040805160c08101909152808a610ad25760048460a0015160ff16901c610ae5565b60108460a0015160ff1681610ae357fe5b065b60ff1681526004546001600160801b03166020820152604001610b06612c27565b63ffffffff168152602001600060060b815260200160006001600160a01b031681526020016000151581525090506000808913905060006040518060e001604052808b81526020016000815260200185600001516001600160a01b03168152602001856020015160020b81526020018c610b8257600254610b86565b6001545b815260200160006001600160801b0316815260200184602001516001600160801b031681525090505b805115801590610bd55750886001600160a01b031681604001516001600160a01b031614155b15610f9f57610be261560e565b60408201516001600160a01b031681526060820151610c25906006907f00000000000000000000000000000000000000000000000000000000000000008f612c2b565b15156040830152600290810b810b60208301819052620d89e719910b1215610c5657620d89e7196020820152610c75565b6020810151620d89e860029190910b1315610c7557620d89e860208201525b610c828160200151612d6d565b6001600160a01b031660608201526040820151610d13908d610cbc578b6001600160a01b031683606001516001600160a01b031611610cd6565b8b6001600160a01b031683606001516001600160a01b0316105b610ce4578260600151610ce6565b8b5b60c085015185517f000000000000000000000000000000000000000000000000000000000000000061309f565b60c085015260a084015260808301526001600160a01b031660408301528215610d7557610d498160c00151826080015101613291565b825103825260a0810151610d6b90610d6090613291565b6020840151906132a7565b6020830152610db0565b610d828160a00151613291565b825101825260c08101516080820151610daa91610d9f9101613291565b6020840151906132c3565b60208301525b835160ff1615610df6576000846000015160ff168260c0015181610dd057fe5b60c0840180519290910491829003905260a0840180519091016001600160801b03169052505b60c08201516001600160801b031615610e3557610e298160c00151600160801b8460c001516001600160801b03166132d9565b60808301805190910190525b80606001516001600160a01b031682604001516001600160a01b03161415610f5e57806040015115610f35578360a00151610ebf57610e9d846040015160008760200151886040015188602001518a606001516008613389909695949392919063ffffffff16565b6001600160a01b03166080860152600690810b900b6060850152600160a08501525b6000610f0b82602001518e610ed657600154610edc565b84608001515b8f610eeb578560800151610eef565b6002545b608089015160608a015160408b0151600595949392919061351c565b90508c15610f17576000035b610f258360c00151826135ef565b6001600160801b031660c0840152505b8b610f44578060200151610f4d565b60018160200151035b600290810b900b6060830152610f99565b80600001516001600160a01b031682604001516001600160a01b031614610f9957610f8c82604001516136a5565b600290810b900b60608301525b50610baf565b836020015160020b816060015160020b1461107a57600080610fed86604001518660400151886020015188602001518a606001518b6080015160086139d1909695949392919063ffffffff16565b604085015160608601516000805461ffff60c81b1916600160c81b61ffff958616021761ffff60b81b1916600160b81b95909416949094029290921762ffffff60a01b1916600160a01b62ffffff60029490940b93909316929092029190911773ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03909116179055506110ac9050565b60408101516000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b039092169190911790555b8060c001516001600160801b031683602001516001600160801b0316146110f25760c0810151600480546001600160801b0319166001600160801b039092169190911790555b8a1561114257608081015160015560a08101516001600160801b03161561113d5760a0810151600380546001600160801b031981166001600160801b03918216909301169190911790555b611188565b608081015160025560a08101516001600160801b0316156111885760a0810151600380546001600160801b03808216600160801b92839004821690940116029190911790555b8115158b1515146111a157602081015181518b036111ae565b80600001518a0381602001515b90965094508a156112e75760008512156111f0576111f07f00000000000000000000000000000000000000000000000000000000000000008d87600003613b86565b60006111fa613cd4565b9050336001600160a01b031663fa461e3388888c8c6040518563ffffffff1660e01b815260040180858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b15801561127e57600080fd5b505af1158015611292573d6000803e3d6000fd5b5050505061129e613cd4565b6112a88289613e0d565b11156112e1576040805162461bcd60e51b815260206004820152600360248201526249494160e81b604482015290519081900360640190fd5b50611411565b600086121561131e5761131e7f00000000000000000000000000000000000000000000000000000000000000008d88600003613b86565b6000611328613e1d565b9050336001600160a01b031663fa461e3388888c8c6040518563ffffffff1660e01b815260040180858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b1580156113ac57600080fd5b505af11580156113c0573d6000803e3d6000fd5b505050506113cc613e1d565b6113d68288613e0d565b111561140f576040805162461bcd60e51b815260206004820152600360248201526249494160e81b604482015290519081900360640190fd5b505b60408082015160c083015160608085015184518b8152602081018b90526001600160a01b03948516818701526001600160801b039093169183019190915260020b60808201529151908e169133917fc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca679181900360a00190a350506000805460ff60f01b1916600160f01b17905550919890975095505050505050565b6004546001600160801b031681565b6003546001600160801b0380821691600160801b90041682565b60088161ffff81106114e757600080fd5b015463ffffffff81169150640100000000810460060b90600160581b81046001600160a01b031690600160f81b900460ff1684565b600054600160f01b900460ff16611560576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b19169055611575612bf0565b60008054600160d81b900461ffff169061159160088385613eb5565b6000805461ffff808416600160d81b810261ffff60d81b19909316929092179092559192508316146115fe576040805161ffff80851682528316602082015281517fac49e518f90a358f652e4400164f05a5d8f7e35e7747279bc3a93dbf584e125a929181900390910190a15b50506000805460ff60f01b1916600160f01b17905550565b6000546001600160a01b03811690600160a01b810460020b9061ffff600160b81b8204811691600160c81b8104821691600160d81b8204169060ff600160e81b8204811691600160f01b90041687565b600080548190600160f01b900460ff166116ad576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b191690556001600160801b0385166116cd57600080fd5b60008061171b60405180608001604052808c6001600160a01b031681526020018b60020b81526020018a60020b81526020016117118a6001600160801b0316613f58565b600f0b9052613f69565b9250925050819350809250600080600086111561173d5761173a613cd4565b91505b841561174e5761174b613e1d565b90505b336001600160a01b031663d348799787878b8b6040518563ffffffff1660e01b815260040180858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b1580156117d057600080fd5b505af11580156117e4573d6000803e3d6000fd5b50505050600086111561183b576117f9613cd4565b6118038388613e0d565b111561183b576040805162461bcd60e51b815260206004820152600260248201526104d360f41b604482015290519081900360640190fd5b841561188b57611849613e1d565b6118538287613e0d565b111561188b576040805162461bcd60e51b81526020600482015260026024820152614d3160f01b604482015290519081900360640190fd5b8960020b8b60020b8d6001600160a01b03167f7a53080ba414158be7ec69b987b5fb7d07dee101fe85488f0853ae16239d0bde338d8b8b60405180856001600160a01b03168152602001846001600160801b0316815260200183815260200182815260200194505050505060405180910390a450506000805460ff60f01b1916600160f01b17905550919890975095505050505050565b60025481565b600054600160f01b900460ff1661196c576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b19169055611981612bf0565b6004546001600160801b0316806119c3576040805162461bcd60e51b81526020600482015260016024820152601360fa1b604482015290519081900360640190fd5b60006119f8867f000000000000000000000000000000000000000000000000000000000000000062ffffff16620f42406141a9565b90506000611a2f867f000000000000000000000000000000000000000000000000000000000000000062ffffff16620f42406141a9565b90506000611a3b613cd4565b90506000611a47613e1d565b90508815611a7a57611a7a7f00000000000000000000000000000000000000000000000000000000000000008b8b613b86565b8715611aab57611aab7f00000000000000000000000000000000000000000000000000000000000000008b8a613b86565b336001600160a01b031663e9cbafb085858a8a6040518563ffffffff1660e01b815260040180858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b158015611b2d57600080fd5b505af1158015611b41573d6000803e3d6000fd5b505050506000611b4f613cd4565b90506000611b5b613e1d565b905081611b688588613e0d565b1115611ba0576040805162461bcd60e51b8152602060048201526002602482015261046360f41b604482015290519081900360640190fd5b80611bab8487613e0d565b1115611be3576040805162461bcd60e51b8152602060048201526002602482015261463160f01b604482015290519081900360640190fd5b8382038382038115611c725760008054600160e81b9004600f16908115611c16578160ff168481611c1057fe5b04611c19565b60005b90506001600160801b03811615611c4c57600380546001600160801b038082168401166001600160801b03199091161790555b611c66818503600160801b8d6001600160801b03166132d9565b60018054909101905550505b8015611cfd5760008054600160e81b900460041c600f16908115611ca2578160ff168381611c9c57fe5b04611ca5565b60005b90506001600160801b03811615611cd757600380546001600160801b03600160801b8083048216850182160291161790555b611cf1818403600160801b8d6001600160801b03166132d9565b60028054909101905550505b8d6001600160a01b0316336001600160a01b03167fbdbdb71d7860376ba52b25a5028beea23581364a40522f6bcfb86bb1f2dca6338f8f86866040518085815260200184815260200183815260200182815260200194505050505060405180910390a350506000805460ff60f01b1916600160f01b179055505050505050505050505050565b600080548190600160f01b900460ff16611dca576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b19168155611de460073389896141e3565b60038101549091506001600160801b0390811690861611611e055784611e14565b60038101546001600160801b03165b60038201549093506001600160801b03600160801b909104811690851611611e3c5783611e52565b6003810154600160801b90046001600160801b03165b91506001600160801b03831615611eb7576003810180546001600160801b031981166001600160801b03918216869003821617909155611eb7907f0000000000000000000000000000000000000000000000000000000000000000908a908616613b86565b6001600160801b03821615611f1d576003810180546001600160801b03600160801b808304821686900382160291811691909117909155611f1d907f0000000000000000000000000000000000000000000000000000000000000000908a908516613b86565b604080516001600160a01b038a1681526001600160801b0380861660208301528416818301529051600288810b92908a900b9133917f70935338e69775456a85ddef226c395fb668b63fa0115f5f20610b388e6ca9c0919081900360600190a4506000805460ff60f01b1916600160f01b17905590969095509350505050565b60076020526000908152604090208054600182015460028301546003909301546001600160801b0392831693919281811691600160801b90041685565b60066020526000908152604090205481565b7f000000000000000000000000000000000000000000000000000000000000000081565b600054600160f01b900460ff16612054576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b1916905560408051638da5cb5b60e01b815290516001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691638da5cb5b916004808301926020929190829003018186803b1580156120c157600080fd5b505afa1580156120d5573d6000803e3d6000fd5b505050506040513d60208110156120eb57600080fd5b50516001600160a01b0316331461210157600080fd5b60ff82161580612124575060048260ff16101580156121245750600a8260ff1611155b801561214e575060ff8116158061214e575060048160ff161015801561214e5750600a8160ff1611155b61215757600080fd5b60008054610ff0600484901b16840160ff908116600160e81b9081027fffff00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff841617909355919004167f973d8d92bb299f4af6ce49b52a8adb85ae46b9f214c4c4fc06ac77401237b1336010826040805160ff9390920683168252600f600486901c16602083015286831682820152918516606082015290519081900360800190a150506000805460ff60f01b1916600160f01b17905550565b600080548190600160f01b900460ff16612256576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b1916905560408051638da5cb5b60e01b815290516001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691638da5cb5b916004808301926020929190829003018186803b1580156122c357600080fd5b505afa1580156122d7573d6000803e3d6000fd5b505050506040513d60208110156122ed57600080fd5b50516001600160a01b0316331461230357600080fd5b6003546001600160801b039081169085161161231f578361232c565b6003546001600160801b03165b6003549092506001600160801b03600160801b9091048116908416116123525782612366565b600354600160801b90046001600160801b03165b90506001600160801b038216156123e7576003546001600160801b038381169116141561239557600019909101905b600380546001600160801b031981166001600160801b039182168590038216179091556123e7907f00000000000000000000000000000000000000000000000000000000000000009087908516613b86565b6001600160801b0381161561246d576003546001600160801b03828116600160801b90920416141561241857600019015b600380546001600160801b03600160801b80830482168590038216029181169190911790915561246d907f00000000000000000000000000000000000000000000000000000000000000009087908416613b86565b604080516001600160801b0380851682528316602082015281516001600160a01b0388169233927f596b573906218d3411850b26a6b437d6c4522fdb43d2d2386263f86d50b8b151929081900390910190a36000805460ff60f01b1916600160f01b1790559094909350915050565b6060806124e7612bf0565b61255e6124f2612c27565b858580806020026020016040519081016040528093929190818152602001838360200280828437600092018290525054600454600896959450600160a01b820460020b935061ffff600160b81b8304811693506001600160801b0390911691600160c81b900416614247565b915091509250929050565b600080548190600160f01b900460ff166125b0576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b1916815560408051608081018252338152600288810b602083015287900b918101919091528190819061260990606081016125fc6001600160801b038a16613f58565b600003600f0b9052613f69565b925092509250816000039450806000039350600085118061262a5750600084115b15612669576003830180546001600160801b038082168089018216600160801b93849004831689019092169092029091176001600160801b0319161790555b604080516001600160801b0388168152602081018790528082018690529051600289810b92908b900b9133917f0c396cd989a39f4459b5fa1aed6a9a8dcdbc45908acfd67e028cd568da98982c919081900360600190a450506000805460ff60f01b1916600160f01b179055509094909350915050565b60008060006126ed612bf0565b6126f785856143a1565b600285810b810b60009081526005602052604080822087840b90930b825281206003830154600681900b9367010000000000000082046001600160a01b0316928492600160d81b810463ffffffff169284929091600160f81b900460ff168061275f57600080fd5b6003820154600681900b985067010000000000000081046001600160a01b03169650600160d81b810463ffffffff169450600160f81b900460ff16806127a457600080fd5b50506040805160e0810182526000546001600160a01b0381168252600160a01b8104600290810b810b810b6020840181905261ffff600160b81b8404811695850195909552600160c81b830485166060850152600160d81b8304909416608084015260ff600160e81b8304811660a0850152600160f01b909204909116151560c08301529093508e810b91900b1215905061284d575093909403965090039350900390506128d0565b8a60020b816020015160020b12156128c1576000612869612c27565b602083015160408401516004546060860151939450600093849361289f936008938893879392916001600160801b031690613389565b9a9003989098039b5050949096039290920396509091030392506128d0915050565b50949093039650039350900390505b9250925092565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b60015481565b60056020526000908152604090208054600182015460028301546003909301546001600160801b03831693600160801b909304600f0b9290600681900b9067010000000000000081046001600160a01b031690600160d81b810463ffffffff1690600160f81b900460ff1688565b6000546001600160a01b031615612a1e576040805162461bcd60e51b8152602060048201526002602482015261414960f01b604482015290519081900360640190fd5b6000612a29826136a5565b9050600080612a41612a39612c27565b60089061446a565b6040805160e0810182526001600160a01b038816808252600288810b6020808501829052600085870181905261ffff898116606088018190529089166080880181905260a08801839052600160c0909801979097528154600160f01b73ffffffffffffffffffffffffffffffffffffffff19909116871762ffffff60a01b1916600160a01b62ffffff9787900b9790971696909602959095177fffffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffff16600160c81b9091021761ffff60d81b1916600160d81b909602959095177fff0000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1692909217909355835191825281019190915281519395509193507f98636036cb66a9c19a37435efc1e90142190214e8abeb821bdba3f2990dd4c9592918290030190a150505050565b60008082600281900b620d89e71981612b9957fe5b05029050600083600281900b620d89e881612bb057fe5b0502905060008460020b83830360020b81612bc757fe5b0560010190508062ffffff166001600160801b03801681612be457fe5b0493505050505b919050565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614612c2557600080fd5b565b4290565b60008060008460020b8660020b81612c3f57fe5b05905060008660020b128015612c6657508460020b8660020b81612c5f57fe5b0760020b15155b15612c7057600019015b8315612ce557600080612c82836144b6565b600182810b810b600090815260208d9052604090205460ff83169190911b80016000190190811680151597509294509092509085612cc757888360ff16860302612cda565b88612cd1826144c8565b840360ff168603025b965050505050612d63565b600080612cf4836001016144b6565b91509150600060018260ff166001901b031990506000818b60008660010b60010b8152602001908152602001600020541690508060001415955085612d4657888360ff0360ff16866001010102612d5c565b8883612d5183614568565b0360ff168660010101025b9650505050505b5094509492505050565b60008060008360020b12612d84578260020b612d8c565b8260020b6000035b9050620d89e8811115612dca576040805162461bcd60e51b81526020600482015260016024820152601560fa1b604482015290519081900360640190fd5b600060018216612dde57600160801b612df0565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff1690506002821615612e24576ffff97272373d413259a46990580e213a0260801c5b6004821615612e43576ffff2e50f5f656932ef12357cf3c7fdcc0260801c5b6008821615612e62576fffe5caca7e10e4e61c3624eaa0941cd00260801c5b6010821615612e81576fffcb9843d60f6159c9db58835c9266440260801c5b6020821615612ea0576fff973b41fa98c081472e6896dfb254c00260801c5b6040821615612ebf576fff2ea16466c96a3843ec78b326b528610260801c5b6080821615612ede576ffe5dee046a99a2a811c461f1969c30530260801c5b610100821615612efe576ffcbe86c7900a88aedcffc83b479aa3a40260801c5b610200821615612f1e576ff987a7253ac413176f2b074cf7815e540260801c5b610400821615612f3e576ff3392b0822b70005940c7a398e4b70f30260801c5b610800821615612f5e576fe7159475a2c29b7443b29c7fa6e889d90260801c5b611000821615612f7e576fd097f3bdfd2022b8845ad8f792aa58250260801c5b612000821615612f9e576fa9f746462d870fdf8a65dc1f90e061e50260801c5b614000821615612fbe576f70d869a156d2a1b890bb3df62baf32f70260801c5b618000821615612fde576f31be135f97d08fd981231505542fcfa60260801c5b62010000821615612fff576f09aa508b5b7a84e1c677de54f3e99bc90260801c5b6202000082161561301f576e5d6af8dedb81196699c329225ee6040260801c5b6204000082161561303e576d2216e584f5fa1ea926041bedfe980260801c5b6208000082161561305b576b048a170391f7dc42444e8fa20260801c5b60008460020b131561307657806000198161307257fe5b0490505b64010000000081061561308a57600161308d565b60005b60ff16602082901c0192505050919050565b60008080806001600160a01b03808916908a1610158187128015906131245760006130d88989620f42400362ffffff16620f42406132d9565b9050826130f1576130ec8c8c8c6001614652565b6130fe565b6130fe8b8d8c60016146cd565b955085811061310f578a965061311e565b61311b8c8b838661478a565b96505b5061316e565b8161313b576131368b8b8b60006146cd565b613148565b6131488a8c8b6000614652565b935083886000031061315c5789955061316e565b61316b8b8a8a600003856147d6565b95505b6001600160a01b038a81169087161482156131d15780801561318d5750815b6131a35761319e878d8c60016146cd565b6131a5565b855b95508080156131b2575081155b6131c8576131c3878d8c6000614652565b6131ca565b845b945061321b565b8080156131db5750815b6131f1576131ec8c888c6001614652565b6131f3565b855b9550808015613200575081155b613216576132118c888c60006146cd565b613218565b845b94505b8115801561322b57508860000385115b15613237578860000394505b81801561325657508a6001600160a01b0316876001600160a01b031614155b15613265578589039350613282565b61327f868962ffffff168a620f42400362ffffff166141a9565b93505b50505095509550955095915050565b6000600160ff1b82106132a357600080fd5b5090565b808203828113156000831215146132bd57600080fd5b92915050565b818101828112156000831215146132bd57600080fd5b600080806000198587098686029250828110908390030390508061330f576000841161330457600080fd5b508290049050613382565b80841161331b57600080fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150505b9392505050565b60008063ffffffff8716613430576000898661ffff1661ffff81106133aa57fe5b60408051608081018252919092015463ffffffff8082168084526401000000008304600690810b810b900b6020850152600160581b83046001600160a01b031694840194909452600160f81b90910460ff16151560608301529092508a161461341c57613419818a8988614822565b90505b806020015181604001519250925050613510565b8688036000806134458c8c858c8c8c8c6148d2565b91509150816000015163ffffffff168363ffffffff161415613477578160200151826040015194509450505050613510565b805163ffffffff8481169116141561349f578060200151816040015194509450505050613510565b8151815160208085015190840151918390039286039163ffffffff80841692908516910360060b816134cd57fe5b05028460200151018263ffffffff168263ffffffff1686604001518660400151036001600160a01b031602816134ff57fe5b048560400151019650965050505050505b97509795505050505050565b600295860b860b60009081526020979097526040909620600181018054909503909455938301805490920390915560038201805463ffffffff600160d81b6001600160a01b036701000000000000008085048216909603169094027fffffffffff0000000000000000000000000000000000000000ffffffffffffff90921691909117600681810b90960390950b66ffffffffffffff1666ffffffffffffff199095169490941782810485169095039093160263ffffffff60d81b1990931692909217905554600160801b9004600f0b90565b60008082600f0b121561365457826001600160801b03168260000384039150816001600160801b03161061364f576040805162461bcd60e51b81526020600482015260026024820152614c5360f01b604482015290519081900360640190fd5b6132bd565b826001600160801b03168284019150816001600160801b031610156132bd576040805162461bcd60e51b81526020600482015260026024820152614c4160f01b604482015290519081900360640190fd5b60006401000276a36001600160a01b038316108015906136e1575073fffd8963efd1fc6a506488495d951d5263988d266001600160a01b038316105b613716576040805162461bcd60e51b81526020600482015260016024820152602960f91b604482015290519081900360640190fd5b77ffffffffffffffffffffffffffffffffffffffff00000000602083901b166001600160801b03811160071b81811c67ffffffffffffffff811160061b90811c63ffffffff811160051b90811c61ffff811160041b90811c60ff8111600390811b91821c600f811160021b90811c918211600190811b92831c979088119617909417909217179091171717608081106137b757607f810383901c91506137c1565b80607f0383901b91505b908002607f81811c60ff83811c9190911c800280831c81831c1c800280841c81841c1c800280851c81851c1c800280861c81861c1c800280871c81871c1c800280881c81881c1c800280891c81891c1c8002808a1c818a1c1c8002808b1c818b1c1c8002808c1c818c1c1c8002808d1c818d1c1c8002808e1c9c81901c9c909c1c80029c8d901c9e9d607f198f0160401b60c09190911c678000000000000000161760c19b909b1c674000000000000000169a909a1760c29990991c672000000000000000169890981760c39790971c671000000000000000169690961760c49590951c670800000000000000169490941760c59390931c670400000000000000169290921760c69190911c670200000000000000161760c79190911c670100000000000000161760c89190911c6680000000000000161760c99190911c6640000000000000161760ca9190911c6620000000000000161760cb9190911c6610000000000000161760cc9190911c6608000000000000161760cd9190911c66040000000000001617693627a301d71055774c8581026f028f6481ab7f045a5af012a19d003aa9198101608090811d906fdb2df09e81959a81455e260799a0632f8301901d600281810b9083900b146139c257886001600160a01b03166139a682612d6d565b6001600160a01b031611156139bb57816139bd565b805b6139c4565b815b9998505050505050505050565b6000806000898961ffff1661ffff81106139e757fe5b60408051608081018252919092015463ffffffff8082168084526401000000008304600690810b810b900b6020850152600160581b83046001600160a01b031694840194909452600160f81b90910460ff161515606083015290925089161415613a575788859250925050613510565b8461ffff168461ffff16118015613a7857506001850361ffff168961ffff16145b15613a8557839150613a89565b8491505b8161ffff168960010161ffff1681613a9d57fe5b069250613aac81898989614822565b8a8461ffff1661ffff8110613abd57fe5b825191018054602084015160408501516060909501511515600160f81b027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6001600160a01b03909616600160581b027fff0000000000000000000000000000000000000000ffffffffffffffffffffff60069390930b66ffffffffffffff16640100000000026affffffffffffff000000001963ffffffff90971663ffffffff199095169490941795909516929092171692909217929092161790555097509795505050505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1781529251825160009485949389169392918291908083835b60208310613c025780518252601f199092019160209182019101613be3565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114613c64576040519150601f19603f3d011682016040523d82523d6000602084013e613c69565b606091505b5091509150818015613c97575080511580613c975750808060200190516020811015613c9457600080fd5b50515b613ccd576040805162461bcd60e51b81526020600482015260026024820152612a2360f11b604482015290519081900360640190fd5b5050505050565b604080513060248083019190915282518083039091018152604490910182526020810180516001600160e01b03166370a0823160e01b17815291518151600093849384936001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001693919290918291908083835b60208310613d6d5780518252601f199092019160209182019101613d4e565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114613dcd576040519150601f19603f3d011682016040523d82523d6000602084013e613dd2565b606091505b5091509150818015613de657506020815110155b613def57600080fd5b808060200190516020811015613e0457600080fd5b50519250505090565b808201828110156132bd57600080fd5b604080513060248083019190915282518083039091018152604490910182526020810180516001600160e01b03166370a0823160e01b17815291518151600093849384936001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016939192909182919080838360208310613d6d5780518252601f199092019160209182019101613d4e565b6000808361ffff1611613ef3576040805162461bcd60e51b81526020600482015260016024820152604960f81b604482015290519081900360640190fd5b8261ffff168261ffff1611613f09575081613382565b825b8261ffff168161ffff161015613f4f576001858261ffff1661ffff8110613f2e57fe5b01805463ffffffff191663ffffffff92909216919091179055600101613f0b565b50909392505050565b80600f81900b8114612beb57600080fd5b6000806000613f76612bf0565b613f88846020015185604001516143a1565b6040805160e0810182526000546001600160a01b0381168252600160a01b8104600290810b810b900b602080840182905261ffff600160b81b8404811685870152600160c81b84048116606080870191909152600160d81b8504909116608086015260ff600160e81b8504811660a0870152600160f01b909404909316151560c08501528851908901519489015192890151939461402c9491939092909190614acf565b93508460600151600f0b6000146141a157846020015160020b816020015160020b12156140815761407a6140638660200151612d6d565b6140708760400151612d6d565b8760600151614c84565b92506141a1565b846040015160020b816020015160020b12156141775760045460408201516001600160801b03909116906140d3906140b7612c27565b60208501516060860151608087015160089493929187916139d1565b6000805461ffff60c81b1916600160c81b61ffff938416021761ffff60b81b1916600160b81b939092169290920217905581516040870151614123919061411990612d6d565b8860600151614c84565b93506141416141358760200151612d6d565b83516060890151614cc8565b92506141518187606001516135ef565b600480546001600160801b0319166001600160801b0392909216919091179055506141a1565b61419e6141878660200151612d6d565b6141948760400151612d6d565b8760600151614cc8565b91505b509193909250565b60006141b68484846132d9565b9050600082806141c257fe5b84860911156133825760001981106141d957600080fd5b6001019392505050565b6040805160609490941b6bffffffffffffffffffffffff1916602080860191909152600293840b60e890811b60348701529290930b90911b60378401528051808403601a018152603a90930181528251928201929092206000908152929052902090565b60608060008361ffff1611614287576040805162461bcd60e51b81526020600482015260016024820152604960f81b604482015290519081900360640190fd5b865167ffffffffffffffff8111801561429f57600080fd5b506040519080825280602002602001820160405280156142c9578160200160208202803683370190505b509150865167ffffffffffffffff811180156142e457600080fd5b5060405190808252806020026020018201604052801561430e578160200160208202803683370190505b50905060005b87518110156143945761433f8a8a8a848151811061432e57fe5b60200260200101518a8a8a8a613389565b84838151811061434b57fe5b6020026020010184848151811061435e57fe5b60200260200101826001600160a01b03166001600160a01b03168152508260060b60060b81525050508080600101915050614314565b5097509795505050505050565b8060020b8260020b126143e1576040805162461bcd60e51b8152602060048201526003602482015262544c5560e81b604482015290519081900360640190fd5b620d89e719600283900b1215614424576040805162461bcd60e51b8152602060048201526003602482015262544c4d60e81b604482015290519081900360640190fd5b620d89e8600282900b1315614466576040805162461bcd60e51b815260206004820152600360248201526254554d60e81b604482015290519081900360640190fd5b5050565b6040805160808101825263ffffffff9283168082526000602083018190529282019290925260016060909101819052835463ffffffff1916909117909116600160f81b17909155908190565b60020b600881901d9161010090910790565b60008082116144d657600080fd5b600160801b82106144e957608091821c91015b68010000000000000000821061450157604091821c91015b640100000000821061451557602091821c91015b62010000821061452757601091821c91015b610100821061453857600891821c91015b6010821061454857600491821c91015b6004821061455857600291821c91015b60028210612beb57600101919050565b600080821161457657600080fd5b5060ff6001600160801b0382161561459157607f1901614599565b608082901c91505b67ffffffffffffffff8216156145b257603f19016145ba565b604082901c91505b63ffffffff8216156145cf57601f19016145d7565b602082901c91505b61ffff8216156145ea57600f19016145f2565b601082901c91505b60ff821615614604576007190161460c565b600882901c91505b600f82161561461e5760031901614626565b600482901c91505b60038216156146385760011901614640565b600282901c91505b6001821615612beb5760001901919050565b6000836001600160a01b0316856001600160a01b03161115614672579293925b8161469f5761469a836001600160801b03168686036001600160a01b0316600160601b6132d9565b6146c2565b6146c2836001600160801b03168686036001600160a01b0316600160601b6141a9565b90505b949350505050565b6000836001600160a01b0316856001600160a01b031611156146ed579293925b7bffffffffffffffffffffffffffffffff000000000000000000000000606084901b166001600160a01b03868603811690871661472957600080fd5b8361475957866001600160a01b031661474c8383896001600160a01b03166132d9565b8161475357fe5b0461477f565b61477f6147708383896001600160a01b03166141a9565b886001600160a01b0316614cf7565b979650505050505050565b600080856001600160a01b0316116147a157600080fd5b6000846001600160801b0316116147b757600080fd5b816147c95761469a8585856001614d02565b6146c28585856001614de3565b600080856001600160a01b0316116147ed57600080fd5b6000846001600160801b03161161480357600080fd5b816148155761469a8585856000614de3565b6146c28585856000614d02565b61482a61564a565b600085600001518503905060405180608001604052808663ffffffff1681526020018263ffffffff168660020b0288602001510160060b81526020016000856001600160801b03161161487e576001614880565b845b6001600160801b031673ffffffff00000000000000000000000000000000608085901b16816148ab57fe5b048860400151016001600160a01b0316815260200160011515815250915050949350505050565b6148da61564a565b6148e261564a565b888561ffff1661ffff81106148f357fe5b60408051608081018252919092015463ffffffff81168083526401000000008204600690810b810b900b6020840152600160581b82046001600160a01b031693830193909352600160f81b900460ff1615156060820152925061495890899089614ed8565b15614990578663ffffffff16826000015163ffffffff16141561497a57613510565b8161498783898988614822565b91509150613510565b888361ffff168660010161ffff16816149a557fe5b0661ffff1661ffff81106149b557fe5b60408051608081018252929091015463ffffffff811683526401000000008104600690810b810b900b60208401526001600160a01b03600160581b8204169183019190915260ff600160f81b90910416151560608201819052909250614a6c57604080516080810182528a5463ffffffff811682526401000000008104600690810b810b900b6020830152600160581b81046001600160a01b031692820192909252600160f81b90910460ff161515606082015291505b614a7b88836000015189614ed8565b614ab2576040805162461bcd60e51b815260206004820152600360248201526213d31160ea1b604482015290519081900360640190fd5b614abf8989898887614f9b565b9150915097509795505050505050565b6000614ade60078787876141e3565b60015460025491925090600080600f87900b15614c24576000614aff612c27565b6000805460045492935090918291614b499160089186918591600160a01b810460020b9161ffff600160b81b83048116926001600160801b0390921691600160c81b900416613389565b9092509050614b8360058d8b8d8b8b87898b60007f000000000000000000000000000000000000000000000000000000000000000061513b565b9450614bba60058c8b8d8b8b87898b60017f000000000000000000000000000000000000000000000000000000000000000061513b565b93508415614bee57614bee60068d7f0000000000000000000000000000000000000000000000000000000000000000615325565b8315614c2057614c2060068c7f0000000000000000000000000000000000000000000000000000000000000000615325565b5050505b600080614c3660058c8c8b8a8a61538b565b9092509050614c47878a8484615437565b600089600f0b1215614c75578315614c6457614c6460058c6155cc565b8215614c7557614c7560058b6155cc565b50505050505095945050505050565b60008082600f0b12614caa57614ca5614ca085858560016146cd565b613291565b6146c5565b614cbd614ca085858560000360006146cd565b600003949350505050565b60008082600f0b12614ce457614ca5614ca08585856001614652565b614cbd614ca08585856000036000614652565b808204910615150190565b60008115614d755760006001600160a01b03841115614d3857614d3384600160601b876001600160801b03166132d9565b614d50565b6001600160801b038516606085901b81614d4e57fe5b045b9050614d6d614d686001600160a01b03881683613e0d565b6155f8565b9150506146c5565b60006001600160a01b03841115614da357614d9e84600160601b876001600160801b03166141a9565b614dba565b614dba606085901b6001600160801b038716614cf7565b905080866001600160a01b031611614dd157600080fd5b6001600160a01b0386160390506146c5565b600082614df15750836146c5565b7bffffffffffffffffffffffffffffffff000000000000000000000000606085901b168215614e91576001600160a01b03861684810290858281614e3157fe5b041415614e6257818101828110614e6057614e5683896001600160a01b0316836141a9565b93505050506146c5565b505b614e8882614e83878a6001600160a01b03168681614e7c57fe5b0490613e0d565b614cf7565b925050506146c5565b6001600160a01b03861684810290858281614ea857fe5b04148015614eb557508082115b614ebe57600080fd5b808203614e56614d68846001600160a01b038b16846141a9565b60008363ffffffff168363ffffffff1611158015614f0257508363ffffffff168263ffffffff1611155b15614f1e578163ffffffff168363ffffffff1611159050613382565b60008463ffffffff168463ffffffff1611614f46578363ffffffff1664010000000001614f4e565b8363ffffffff165b64ffffffffff16905060008563ffffffff168463ffffffff1611614f7f578363ffffffff1664010000000001614f87565b8363ffffffff165b64ffffffffff169091111595945050505050565b614fa361564a565b614fab61564a565b60008361ffff168560010161ffff1681614fc157fe5b0661ffff169050600060018561ffff16830103905060005b506002818301048961ffff87168281614fee57fe5b0661ffff8110614ffa57fe5b60408051608081018252929091015463ffffffff811683526401000000008104600690810b810b900b60208401526001600160a01b03600160581b8204169183019190915260ff600160f81b9091041615156060820181905290955061506557806001019250614fd9565b898661ffff16826001018161507657fe5b0661ffff811061508257fe5b60408051608081018252929091015463ffffffff811683526401000000008104600690810b810b900b60208401526001600160a01b03600160581b8204169183019190915260ff600160f81b909104161515606082015285519094506000906150ed908b908b614ed8565b905080801561510657506151068a8a8760000151614ed8565b15615111575061512e565b8061512157600182039250615128565b8160010193505b50614fd9565b5050509550959350505050565b60028a810b900b600090815260208c90526040812080546001600160801b031682615166828d6135ef565b9050846001600160801b0316816001600160801b031611156151b4576040805162461bcd60e51b81526020600482015260026024820152614c4f60f01b604482015290519081900360640190fd5b6001600160801b03828116159082161581141594501561528a578c60020b8e60020b1361525a57600183018b9055600283018a90556003830180547fffffffffff0000000000000000000000000000000000000000ffffffffffffff166701000000000000006001600160a01b038c16021766ffffffffffffff191666ffffffffffffff60068b900b161763ffffffff60d81b1916600160d81b63ffffffff8a16021790555b6003830180547effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16600160f81b1790555b82546001600160801b0319166001600160801b038216178355856152d35782546152ce906152c990600160801b9004600f90810b810b908f900b6132c3565b613f58565b6152f4565b82546152f4906152c990600160801b9004600f90810b810b908f900b6132a7565b8354600f9190910b6001600160801b03908116600160801b0291161790925550909c9b505050505050505050505050565b8060020b8260020b8161533457fe5b0760020b1561534257600080fd5b60008061535d8360020b8560020b8161535757fe5b056144b6565b600191820b820b60009081526020979097526040909620805460ff9097169190911b90951890945550505050565b600285810b80820b60009081526020899052604080822088850b850b83529082209193849391929184918291908a900b126153d1575050600182015460028301546153e4565b8360010154880391508360020154870390505b6000808b60020b8b60020b121561540657505060018301546002840154615419565b84600101548a0391508460020154890390505b92909803979097039b96909503949094039850939650505050505050565b6040805160a08101825285546001600160801b0390811682526001870154602083015260028701549282019290925260038601548083166060830152600160801b900490911660808201526000600f85900b6154d65781516001600160801b03166154ce576040805162461bcd60e51b815260206004820152600260248201526104e560f41b604482015290519081900360640190fd5b5080516154e5565b81516154e290866135ef565b90505b60006155098360200151860384600001516001600160801b0316600160801b6132d9565b9050600061552f8460400151860385600001516001600160801b0316600160801b6132d9565b905086600f0b6000146155565787546001600160801b0319166001600160801b0384161788555b60018801869055600288018590556001600160801b03821615158061558457506000816001600160801b0316115b156155c2576003880180546001600160801b031981166001600160801b039182168501821617808216600160801b9182900483168501909216021790555b5050505050505050565b600290810b810b6000908152602092909252604082208281556001810183905590810182905560030155565b806001600160a01b0381168114612beb57600080fd5b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c081019190915290565b6040805160808101825260008082526020820181905291810182905260608101919091529056fea164736f6c6343000706000a
608060405234801561001057600080fd5b50600436106101ae5760003560e01c806370cf754a116100ee578063c45a015511610097578063ddca3f4311610071578063ddca3f4314610800578063f305839914610820578063f30dba9314610828578063f637731d146108aa576101ae565b8063c45a0155146107d1578063d0c93a7c146107d9578063d21220a7146107f8576101ae565b8063883bdbfd116100c8578063883bdbfd14610633578063a34123a71461073c578063a38807f214610776576101ae565b806370cf754a146105c65780638206a4d1146105ce57806385b66729146105f6576101ae565b80633850c7bd1161015b578063490e6cbc11610135578063490e6cbc146104705780634f1eb3d8146104fc578063514ea4bf1461054d5780635339c296146105a6576101ae565b80633850c7bd1461035b5780633c8a7d8d146103b45780634614131914610456576101ae565b80631ad8b03b1161018c5780631ad8b03b146102aa578063252c09d7146102e157806332148f6714610338576101ae565b80630dfe1681146101b3578063128acb08146101d75780631a68650214610286575b600080fd5b6101bb6108d0565b604080516001600160a01b039092168252519081900360200190f35b61026d600480360360a08110156101ed57600080fd5b6001600160a01b0382358116926020810135151592604082013592606083013516919081019060a08101608082013564010000000081111561022e57600080fd5b82018360208201111561024057600080fd5b8035906020019184600183028401116401000000008311171561026257600080fd5b5090925090506108f4565b6040805192835260208301919091528051918290030190f35b61028e6114ad565b604080516001600160801b039092168252519081900360200190f35b6102b26114bc565b60405180836001600160801b03168152602001826001600160801b031681526020019250505060405180910390f35b6102fe600480360360208110156102f757600080fd5b50356114d6565b6040805163ffffffff909516855260069390930b60208501526001600160a01b039091168383015215156060830152519081900360800190f35b6103596004803603602081101561034e57600080fd5b503561ffff1661151c565b005b610363611616565b604080516001600160a01b03909816885260029690960b602088015261ffff9485168787015292841660608701529216608085015260ff90911660a0840152151560c0830152519081900360e00190f35b61026d600480360360a08110156103ca57600080fd5b6001600160a01b03823516916020810135600290810b92604083013590910b916001600160801b036060820135169181019060a08101608082013564010000000081111561041757600080fd5b82018360208201111561042957600080fd5b8035906020019184600183028401116401000000008311171561044b57600080fd5b509092509050611666565b61045e611922565b60408051918252519081900360200190f35b6103596004803603608081101561048657600080fd5b6001600160a01b0382351691602081013591604082013591908101906080810160608201356401000000008111156104bd57600080fd5b8201836020820111156104cf57600080fd5b803590602001918460018302840111640100000000831117156104f157600080fd5b509092509050611928565b6102b2600480360360a081101561051257600080fd5b506001600160a01b03813516906020810135600290810b91604081013590910b906001600160801b0360608201358116916080013516611d83565b61056a6004803603602081101561056357600080fd5b5035611f9d565b604080516001600160801b0396871681526020810195909552848101939093529084166060840152909216608082015290519081900360a00190f35b61045e600480360360208110156105bc57600080fd5b503560010b611fda565b61028e611fec565b610359600480360360408110156105e457600080fd5b5060ff81358116916020013516612010565b6102b26004803603606081101561060c57600080fd5b506001600160a01b03813516906001600160801b036020820135811691604001351661220f565b6106a36004803603602081101561064957600080fd5b81019060208101813564010000000081111561066457600080fd5b82018360208201111561067657600080fd5b8035906020019184602083028401116401000000008311171561069857600080fd5b5090925090506124dc565b604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b838110156106e75781810151838201526020016106cf565b50505050905001838103825284818151815260200191508051906020019060200280838360005b8381101561072657818101518382015260200161070e565b5050505090500194505050505060405180910390f35b61026d6004803603606081101561075257600080fd5b508035600290810b91602081013590910b90604001356001600160801b0316612569565b6107a06004803603604081101561078c57600080fd5b508035600290810b9160200135900b6126e0565b6040805160069490940b84526001600160a01b03909216602084015263ffffffff1682820152519081900360600190f35b6101bb6128d7565b6107e16128fb565b6040805160029290920b8252519081900360200190f35b6101bb61291f565b610808612943565b6040805162ffffff9092168252519081900360200190f35b61045e612967565b6108486004803603602081101561083e57600080fd5b503560020b61296d565b604080516001600160801b039099168952600f9790970b602089015287870195909552606087019390935260069190910b60808601526001600160a01b031660a085015263ffffffff1660c0840152151560e083015251908190036101000190f35b610359600480360360208110156108c057600080fd5b50356001600160a01b03166129db565b7f0000000000000000000000003561446ef52872c568dd5dcf51a13e2ac77d1ee881565b6000806108ff612bf0565b85610936576040805162461bcd60e51b8152602060048201526002602482015261415360f01b604482015290519081900360640190fd5b6040805160e0810182526000546001600160a01b0381168252600160a01b8104600290810b810b900b602083015261ffff600160b81b8204811693830193909352600160c81b810483166060830152600160d81b8104909216608082015260ff600160e81b8304811660a0830152600160f01b909204909116151560c082018190526109ef576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b87610a3a5780600001516001600160a01b0316866001600160a01b0316118015610a35575073fffd8963efd1fc6a506488495d951d5263988d266001600160a01b038716105b610a6c565b80600001516001600160a01b0316866001600160a01b0316108015610a6c57506401000276a36001600160a01b038716115b610aa3576040805162461bcd60e51b815260206004820152600360248201526214d41360ea1b604482015290519081900360640190fd5b6000805460ff60f01b191681556040805160c08101909152808a610ad25760048460a0015160ff16901c610ae5565b60108460a0015160ff1681610ae357fe5b065b60ff1681526004546001600160801b03166020820152604001610b06612c27565b63ffffffff168152602001600060060b815260200160006001600160a01b031681526020016000151581525090506000808913905060006040518060e001604052808b81526020016000815260200185600001516001600160a01b03168152602001856020015160020b81526020018c610b8257600254610b86565b6001545b815260200160006001600160801b0316815260200184602001516001600160801b031681525090505b805115801590610bd55750886001600160a01b031681604001516001600160a01b031614155b15610f9f57610be261560e565b60408201516001600160a01b031681526060820151610c25906006907f00000000000000000000000000000000000000000000000000000000000000018f612c2b565b15156040830152600290810b810b60208301819052620d89e719910b1215610c5657620d89e7196020820152610c75565b6020810151620d89e860029190910b1315610c7557620d89e860208201525b610c828160200151612d6d565b6001600160a01b031660608201526040820151610d13908d610cbc578b6001600160a01b031683606001516001600160a01b031611610cd6565b8b6001600160a01b031683606001516001600160a01b0316105b610ce4578260600151610ce6565b8b5b60c085015185517f000000000000000000000000000000000000000000000000000000000000006461309f565b60c085015260a084015260808301526001600160a01b031660408301528215610d7557610d498160c00151826080015101613291565b825103825260a0810151610d6b90610d6090613291565b6020840151906132a7565b6020830152610db0565b610d828160a00151613291565b825101825260c08101516080820151610daa91610d9f9101613291565b6020840151906132c3565b60208301525b835160ff1615610df6576000846000015160ff168260c0015181610dd057fe5b60c0840180519290910491829003905260a0840180519091016001600160801b03169052505b60c08201516001600160801b031615610e3557610e298160c00151600160801b8460c001516001600160801b03166132d9565b60808301805190910190525b80606001516001600160a01b031682604001516001600160a01b03161415610f5e57806040015115610f35578360a00151610ebf57610e9d846040015160008760200151886040015188602001518a606001516008613389909695949392919063ffffffff16565b6001600160a01b03166080860152600690810b900b6060850152600160a08501525b6000610f0b82602001518e610ed657600154610edc565b84608001515b8f610eeb578560800151610eef565b6002545b608089015160608a015160408b0151600595949392919061351c565b90508c15610f17576000035b610f258360c00151826135ef565b6001600160801b031660c0840152505b8b610f44578060200151610f4d565b60018160200151035b600290810b900b6060830152610f99565b80600001516001600160a01b031682604001516001600160a01b031614610f9957610f8c82604001516136a5565b600290810b900b60608301525b50610baf565b836020015160020b816060015160020b1461107a57600080610fed86604001518660400151886020015188602001518a606001518b6080015160086139d1909695949392919063ffffffff16565b604085015160608601516000805461ffff60c81b1916600160c81b61ffff958616021761ffff60b81b1916600160b81b95909416949094029290921762ffffff60a01b1916600160a01b62ffffff60029490940b93909316929092029190911773ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03909116179055506110ac9050565b60408101516000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b039092169190911790555b8060c001516001600160801b031683602001516001600160801b0316146110f25760c0810151600480546001600160801b0319166001600160801b039092169190911790555b8a1561114257608081015160015560a08101516001600160801b03161561113d5760a0810151600380546001600160801b031981166001600160801b03918216909301169190911790555b611188565b608081015160025560a08101516001600160801b0316156111885760a0810151600380546001600160801b03808216600160801b92839004821690940116029190911790555b8115158b1515146111a157602081015181518b036111ae565b80600001518a0381602001515b90965094508a156112e75760008512156111f0576111f07f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28d87600003613b86565b60006111fa613cd4565b9050336001600160a01b031663fa461e3388888c8c6040518563ffffffff1660e01b815260040180858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b15801561127e57600080fd5b505af1158015611292573d6000803e3d6000fd5b5050505061129e613cd4565b6112a88289613e0d565b11156112e1576040805162461bcd60e51b815260206004820152600360248201526249494160e81b604482015290519081900360640190fd5b50611411565b600086121561131e5761131e7f0000000000000000000000003561446ef52872c568dd5dcf51a13e2ac77d1ee88d88600003613b86565b6000611328613e1d565b9050336001600160a01b031663fa461e3388888c8c6040518563ffffffff1660e01b815260040180858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b1580156113ac57600080fd5b505af11580156113c0573d6000803e3d6000fd5b505050506113cc613e1d565b6113d68288613e0d565b111561140f576040805162461bcd60e51b815260206004820152600360248201526249494160e81b604482015290519081900360640190fd5b505b60408082015160c083015160608085015184518b8152602081018b90526001600160a01b03948516818701526001600160801b039093169183019190915260020b60808201529151908e169133917fc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca679181900360a00190a350506000805460ff60f01b1916600160f01b17905550919890975095505050505050565b6004546001600160801b031681565b6003546001600160801b0380821691600160801b90041682565b60088161ffff81106114e757600080fd5b015463ffffffff81169150640100000000810460060b90600160581b81046001600160a01b031690600160f81b900460ff1684565b600054600160f01b900460ff16611560576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b19169055611575612bf0565b60008054600160d81b900461ffff169061159160088385613eb5565b6000805461ffff808416600160d81b810261ffff60d81b19909316929092179092559192508316146115fe576040805161ffff80851682528316602082015281517fac49e518f90a358f652e4400164f05a5d8f7e35e7747279bc3a93dbf584e125a929181900390910190a15b50506000805460ff60f01b1916600160f01b17905550565b6000546001600160a01b03811690600160a01b810460020b9061ffff600160b81b8204811691600160c81b8104821691600160d81b8204169060ff600160e81b8204811691600160f01b90041687565b600080548190600160f01b900460ff166116ad576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b191690556001600160801b0385166116cd57600080fd5b60008061171b60405180608001604052808c6001600160a01b031681526020018b60020b81526020018a60020b81526020016117118a6001600160801b0316613f58565b600f0b9052613f69565b9250925050819350809250600080600086111561173d5761173a613cd4565b91505b841561174e5761174b613e1d565b90505b336001600160a01b031663d348799787878b8b6040518563ffffffff1660e01b815260040180858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b1580156117d057600080fd5b505af11580156117e4573d6000803e3d6000fd5b50505050600086111561183b576117f9613cd4565b6118038388613e0d565b111561183b576040805162461bcd60e51b815260206004820152600260248201526104d360f41b604482015290519081900360640190fd5b841561188b57611849613e1d565b6118538287613e0d565b111561188b576040805162461bcd60e51b81526020600482015260026024820152614d3160f01b604482015290519081900360640190fd5b8960020b8b60020b8d6001600160a01b03167f7a53080ba414158be7ec69b987b5fb7d07dee101fe85488f0853ae16239d0bde338d8b8b60405180856001600160a01b03168152602001846001600160801b0316815260200183815260200182815260200194505050505060405180910390a450506000805460ff60f01b1916600160f01b17905550919890975095505050505050565b60025481565b600054600160f01b900460ff1661196c576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b19169055611981612bf0565b6004546001600160801b0316806119c3576040805162461bcd60e51b81526020600482015260016024820152601360fa1b604482015290519081900360640190fd5b60006119f8867f000000000000000000000000000000000000000000000000000000000000006462ffffff16620f42406141a9565b90506000611a2f867f000000000000000000000000000000000000000000000000000000000000006462ffffff16620f42406141a9565b90506000611a3b613cd4565b90506000611a47613e1d565b90508815611a7a57611a7a7f0000000000000000000000003561446ef52872c568dd5dcf51a13e2ac77d1ee88b8b613b86565b8715611aab57611aab7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28b8a613b86565b336001600160a01b031663e9cbafb085858a8a6040518563ffffffff1660e01b815260040180858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b158015611b2d57600080fd5b505af1158015611b41573d6000803e3d6000fd5b505050506000611b4f613cd4565b90506000611b5b613e1d565b905081611b688588613e0d565b1115611ba0576040805162461bcd60e51b8152602060048201526002602482015261046360f41b604482015290519081900360640190fd5b80611bab8487613e0d565b1115611be3576040805162461bcd60e51b8152602060048201526002602482015261463160f01b604482015290519081900360640190fd5b8382038382038115611c725760008054600160e81b9004600f16908115611c16578160ff168481611c1057fe5b04611c19565b60005b90506001600160801b03811615611c4c57600380546001600160801b038082168401166001600160801b03199091161790555b611c66818503600160801b8d6001600160801b03166132d9565b60018054909101905550505b8015611cfd5760008054600160e81b900460041c600f16908115611ca2578160ff168381611c9c57fe5b04611ca5565b60005b90506001600160801b03811615611cd757600380546001600160801b03600160801b8083048216850182160291161790555b611cf1818403600160801b8d6001600160801b03166132d9565b60028054909101905550505b8d6001600160a01b0316336001600160a01b03167fbdbdb71d7860376ba52b25a5028beea23581364a40522f6bcfb86bb1f2dca6338f8f86866040518085815260200184815260200183815260200182815260200194505050505060405180910390a350506000805460ff60f01b1916600160f01b179055505050505050505050505050565b600080548190600160f01b900460ff16611dca576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b19168155611de460073389896141e3565b60038101549091506001600160801b0390811690861611611e055784611e14565b60038101546001600160801b03165b60038201549093506001600160801b03600160801b909104811690851611611e3c5783611e52565b6003810154600160801b90046001600160801b03165b91506001600160801b03831615611eb7576003810180546001600160801b031981166001600160801b03918216869003821617909155611eb7907f0000000000000000000000003561446ef52872c568dd5dcf51a13e2ac77d1ee8908a908616613b86565b6001600160801b03821615611f1d576003810180546001600160801b03600160801b808304821686900382160291811691909117909155611f1d907f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2908a908516613b86565b604080516001600160a01b038a1681526001600160801b0380861660208301528416818301529051600288810b92908a900b9133917f70935338e69775456a85ddef226c395fb668b63fa0115f5f20610b388e6ca9c0919081900360600190a4506000805460ff60f01b1916600160f01b17905590969095509350505050565b60076020526000908152604090208054600182015460028301546003909301546001600160801b0392831693919281811691600160801b90041685565b60066020526000908152604090205481565b7f000000000000000000000000000000000000097451ff859c3282305ffa26a9c581565b600054600160f01b900460ff16612054576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b1916905560408051638da5cb5b60e01b815290516001600160a01b037f0000000000000000000000001f98431c8ad98523631ae4a59f267346ea31f9841691638da5cb5b916004808301926020929190829003018186803b1580156120c157600080fd5b505afa1580156120d5573d6000803e3d6000fd5b505050506040513d60208110156120eb57600080fd5b50516001600160a01b0316331461210157600080fd5b60ff82161580612124575060048260ff16101580156121245750600a8260ff1611155b801561214e575060ff8116158061214e575060048160ff161015801561214e5750600a8160ff1611155b61215757600080fd5b60008054610ff0600484901b16840160ff908116600160e81b9081027fffff00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff841617909355919004167f973d8d92bb299f4af6ce49b52a8adb85ae46b9f214c4c4fc06ac77401237b1336010826040805160ff9390920683168252600f600486901c16602083015286831682820152918516606082015290519081900360800190a150506000805460ff60f01b1916600160f01b17905550565b600080548190600160f01b900460ff16612256576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b1916905560408051638da5cb5b60e01b815290516001600160a01b037f0000000000000000000000001f98431c8ad98523631ae4a59f267346ea31f9841691638da5cb5b916004808301926020929190829003018186803b1580156122c357600080fd5b505afa1580156122d7573d6000803e3d6000fd5b505050506040513d60208110156122ed57600080fd5b50516001600160a01b0316331461230357600080fd5b6003546001600160801b039081169085161161231f578361232c565b6003546001600160801b03165b6003549092506001600160801b03600160801b9091048116908416116123525782612366565b600354600160801b90046001600160801b03165b90506001600160801b038216156123e7576003546001600160801b038381169116141561239557600019909101905b600380546001600160801b031981166001600160801b039182168590038216179091556123e7907f0000000000000000000000003561446ef52872c568dd5dcf51a13e2ac77d1ee89087908516613b86565b6001600160801b0381161561246d576003546001600160801b03828116600160801b90920416141561241857600019015b600380546001600160801b03600160801b80830482168590038216029181169190911790915561246d907f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc29087908416613b86565b604080516001600160801b0380851682528316602082015281516001600160a01b0388169233927f596b573906218d3411850b26a6b437d6c4522fdb43d2d2386263f86d50b8b151929081900390910190a36000805460ff60f01b1916600160f01b1790559094909350915050565b6060806124e7612bf0565b61255e6124f2612c27565b858580806020026020016040519081016040528093929190818152602001838360200280828437600092018290525054600454600896959450600160a01b820460020b935061ffff600160b81b8304811693506001600160801b0390911691600160c81b900416614247565b915091509250929050565b600080548190600160f01b900460ff166125b0576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b1916815560408051608081018252338152600288810b602083015287900b918101919091528190819061260990606081016125fc6001600160801b038a16613f58565b600003600f0b9052613f69565b925092509250816000039450806000039350600085118061262a5750600084115b15612669576003830180546001600160801b038082168089018216600160801b93849004831689019092169092029091176001600160801b0319161790555b604080516001600160801b0388168152602081018790528082018690529051600289810b92908b900b9133917f0c396cd989a39f4459b5fa1aed6a9a8dcdbc45908acfd67e028cd568da98982c919081900360600190a450506000805460ff60f01b1916600160f01b179055509094909350915050565b60008060006126ed612bf0565b6126f785856143a1565b600285810b810b60009081526005602052604080822087840b90930b825281206003830154600681900b9367010000000000000082046001600160a01b0316928492600160d81b810463ffffffff169284929091600160f81b900460ff168061275f57600080fd5b6003820154600681900b985067010000000000000081046001600160a01b03169650600160d81b810463ffffffff169450600160f81b900460ff16806127a457600080fd5b50506040805160e0810182526000546001600160a01b0381168252600160a01b8104600290810b810b810b6020840181905261ffff600160b81b8404811695850195909552600160c81b830485166060850152600160d81b8304909416608084015260ff600160e81b8304811660a0850152600160f01b909204909116151560c08301529093508e810b91900b1215905061284d575093909403965090039350900390506128d0565b8a60020b816020015160020b12156128c1576000612869612c27565b602083015160408401516004546060860151939450600093849361289f936008938893879392916001600160801b031690613389565b9a9003989098039b5050949096039290920396509091030392506128d0915050565b50949093039650039350900390505b9250925092565b7f0000000000000000000000001f98431c8ad98523631ae4a59f267346ea31f98481565b7f000000000000000000000000000000000000000000000000000000000000000181565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b7f000000000000000000000000000000000000000000000000000000000000006481565b60015481565b60056020526000908152604090208054600182015460028301546003909301546001600160801b03831693600160801b909304600f0b9290600681900b9067010000000000000081046001600160a01b031690600160d81b810463ffffffff1690600160f81b900460ff1688565b6000546001600160a01b031615612a1e576040805162461bcd60e51b8152602060048201526002602482015261414960f01b604482015290519081900360640190fd5b6000612a29826136a5565b9050600080612a41612a39612c27565b60089061446a565b6040805160e0810182526001600160a01b038816808252600288810b6020808501829052600085870181905261ffff898116606088018190529089166080880181905260a08801839052600160c0909801979097528154600160f01b73ffffffffffffffffffffffffffffffffffffffff19909116871762ffffff60a01b1916600160a01b62ffffff9787900b9790971696909602959095177fffffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffff16600160c81b9091021761ffff60d81b1916600160d81b909602959095177fff0000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1692909217909355835191825281019190915281519395509193507f98636036cb66a9c19a37435efc1e90142190214e8abeb821bdba3f2990dd4c9592918290030190a150505050565b60008082600281900b620d89e71981612b9957fe5b05029050600083600281900b620d89e881612bb057fe5b0502905060008460020b83830360020b81612bc757fe5b0560010190508062ffffff166001600160801b03801681612be457fe5b0493505050505b919050565b306001600160a01b037f000000000000000000000000d01a878a8e4c1825a33164537d9e48fe9920d1211614612c2557600080fd5b565b4290565b60008060008460020b8660020b81612c3f57fe5b05905060008660020b128015612c6657508460020b8660020b81612c5f57fe5b0760020b15155b15612c7057600019015b8315612ce557600080612c82836144b6565b600182810b810b600090815260208d9052604090205460ff83169190911b80016000190190811680151597509294509092509085612cc757888360ff16860302612cda565b88612cd1826144c8565b840360ff168603025b965050505050612d63565b600080612cf4836001016144b6565b91509150600060018260ff166001901b031990506000818b60008660010b60010b8152602001908152602001600020541690508060001415955085612d4657888360ff0360ff16866001010102612d5c565b8883612d5183614568565b0360ff168660010101025b9650505050505b5094509492505050565b60008060008360020b12612d84578260020b612d8c565b8260020b6000035b9050620d89e8811115612dca576040805162461bcd60e51b81526020600482015260016024820152601560fa1b604482015290519081900360640190fd5b600060018216612dde57600160801b612df0565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff1690506002821615612e24576ffff97272373d413259a46990580e213a0260801c5b6004821615612e43576ffff2e50f5f656932ef12357cf3c7fdcc0260801c5b6008821615612e62576fffe5caca7e10e4e61c3624eaa0941cd00260801c5b6010821615612e81576fffcb9843d60f6159c9db58835c9266440260801c5b6020821615612ea0576fff973b41fa98c081472e6896dfb254c00260801c5b6040821615612ebf576fff2ea16466c96a3843ec78b326b528610260801c5b6080821615612ede576ffe5dee046a99a2a811c461f1969c30530260801c5b610100821615612efe576ffcbe86c7900a88aedcffc83b479aa3a40260801c5b610200821615612f1e576ff987a7253ac413176f2b074cf7815e540260801c5b610400821615612f3e576ff3392b0822b70005940c7a398e4b70f30260801c5b610800821615612f5e576fe7159475a2c29b7443b29c7fa6e889d90260801c5b611000821615612f7e576fd097f3bdfd2022b8845ad8f792aa58250260801c5b612000821615612f9e576fa9f746462d870fdf8a65dc1f90e061e50260801c5b614000821615612fbe576f70d869a156d2a1b890bb3df62baf32f70260801c5b618000821615612fde576f31be135f97d08fd981231505542fcfa60260801c5b62010000821615612fff576f09aa508b5b7a84e1c677de54f3e99bc90260801c5b6202000082161561301f576e5d6af8dedb81196699c329225ee6040260801c5b6204000082161561303e576d2216e584f5fa1ea926041bedfe980260801c5b6208000082161561305b576b048a170391f7dc42444e8fa20260801c5b60008460020b131561307657806000198161307257fe5b0490505b64010000000081061561308a57600161308d565b60005b60ff16602082901c0192505050919050565b60008080806001600160a01b03808916908a1610158187128015906131245760006130d88989620f42400362ffffff16620f42406132d9565b9050826130f1576130ec8c8c8c6001614652565b6130fe565b6130fe8b8d8c60016146cd565b955085811061310f578a965061311e565b61311b8c8b838661478a565b96505b5061316e565b8161313b576131368b8b8b60006146cd565b613148565b6131488a8c8b6000614652565b935083886000031061315c5789955061316e565b61316b8b8a8a600003856147d6565b95505b6001600160a01b038a81169087161482156131d15780801561318d5750815b6131a35761319e878d8c60016146cd565b6131a5565b855b95508080156131b2575081155b6131c8576131c3878d8c6000614652565b6131ca565b845b945061321b565b8080156131db5750815b6131f1576131ec8c888c6001614652565b6131f3565b855b9550808015613200575081155b613216576132118c888c60006146cd565b613218565b845b94505b8115801561322b57508860000385115b15613237578860000394505b81801561325657508a6001600160a01b0316876001600160a01b031614155b15613265578589039350613282565b61327f868962ffffff168a620f42400362ffffff166141a9565b93505b50505095509550955095915050565b6000600160ff1b82106132a357600080fd5b5090565b808203828113156000831215146132bd57600080fd5b92915050565b818101828112156000831215146132bd57600080fd5b600080806000198587098686029250828110908390030390508061330f576000841161330457600080fd5b508290049050613382565b80841161331b57600080fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150505b9392505050565b60008063ffffffff8716613430576000898661ffff1661ffff81106133aa57fe5b60408051608081018252919092015463ffffffff8082168084526401000000008304600690810b810b900b6020850152600160581b83046001600160a01b031694840194909452600160f81b90910460ff16151560608301529092508a161461341c57613419818a8988614822565b90505b806020015181604001519250925050613510565b8688036000806134458c8c858c8c8c8c6148d2565b91509150816000015163ffffffff168363ffffffff161415613477578160200151826040015194509450505050613510565b805163ffffffff8481169116141561349f578060200151816040015194509450505050613510565b8151815160208085015190840151918390039286039163ffffffff80841692908516910360060b816134cd57fe5b05028460200151018263ffffffff168263ffffffff1686604001518660400151036001600160a01b031602816134ff57fe5b048560400151019650965050505050505b97509795505050505050565b600295860b860b60009081526020979097526040909620600181018054909503909455938301805490920390915560038201805463ffffffff600160d81b6001600160a01b036701000000000000008085048216909603169094027fffffffffff0000000000000000000000000000000000000000ffffffffffffff90921691909117600681810b90960390950b66ffffffffffffff1666ffffffffffffff199095169490941782810485169095039093160263ffffffff60d81b1990931692909217905554600160801b9004600f0b90565b60008082600f0b121561365457826001600160801b03168260000384039150816001600160801b03161061364f576040805162461bcd60e51b81526020600482015260026024820152614c5360f01b604482015290519081900360640190fd5b6132bd565b826001600160801b03168284019150816001600160801b031610156132bd576040805162461bcd60e51b81526020600482015260026024820152614c4160f01b604482015290519081900360640190fd5b60006401000276a36001600160a01b038316108015906136e1575073fffd8963efd1fc6a506488495d951d5263988d266001600160a01b038316105b613716576040805162461bcd60e51b81526020600482015260016024820152602960f91b604482015290519081900360640190fd5b77ffffffffffffffffffffffffffffffffffffffff00000000602083901b166001600160801b03811160071b81811c67ffffffffffffffff811160061b90811c63ffffffff811160051b90811c61ffff811160041b90811c60ff8111600390811b91821c600f811160021b90811c918211600190811b92831c979088119617909417909217179091171717608081106137b757607f810383901c91506137c1565b80607f0383901b91505b908002607f81811c60ff83811c9190911c800280831c81831c1c800280841c81841c1c800280851c81851c1c800280861c81861c1c800280871c81871c1c800280881c81881c1c800280891c81891c1c8002808a1c818a1c1c8002808b1c818b1c1c8002808c1c818c1c1c8002808d1c818d1c1c8002808e1c9c81901c9c909c1c80029c8d901c9e9d607f198f0160401b60c09190911c678000000000000000161760c19b909b1c674000000000000000169a909a1760c29990991c672000000000000000169890981760c39790971c671000000000000000169690961760c49590951c670800000000000000169490941760c59390931c670400000000000000169290921760c69190911c670200000000000000161760c79190911c670100000000000000161760c89190911c6680000000000000161760c99190911c6640000000000000161760ca9190911c6620000000000000161760cb9190911c6610000000000000161760cc9190911c6608000000000000161760cd9190911c66040000000000001617693627a301d71055774c8581026f028f6481ab7f045a5af012a19d003aa9198101608090811d906fdb2df09e81959a81455e260799a0632f8301901d600281810b9083900b146139c257886001600160a01b03166139a682612d6d565b6001600160a01b031611156139bb57816139bd565b805b6139c4565b815b9998505050505050505050565b6000806000898961ffff1661ffff81106139e757fe5b60408051608081018252919092015463ffffffff8082168084526401000000008304600690810b810b900b6020850152600160581b83046001600160a01b031694840194909452600160f81b90910460ff161515606083015290925089161415613a575788859250925050613510565b8461ffff168461ffff16118015613a7857506001850361ffff168961ffff16145b15613a8557839150613a89565b8491505b8161ffff168960010161ffff1681613a9d57fe5b069250613aac81898989614822565b8a8461ffff1661ffff8110613abd57fe5b825191018054602084015160408501516060909501511515600160f81b027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6001600160a01b03909616600160581b027fff0000000000000000000000000000000000000000ffffffffffffffffffffff60069390930b66ffffffffffffff16640100000000026affffffffffffff000000001963ffffffff90971663ffffffff199095169490941795909516929092171692909217929092161790555097509795505050505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1781529251825160009485949389169392918291908083835b60208310613c025780518252601f199092019160209182019101613be3565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114613c64576040519150601f19603f3d011682016040523d82523d6000602084013e613c69565b606091505b5091509150818015613c97575080511580613c975750808060200190516020811015613c9457600080fd5b50515b613ccd576040805162461bcd60e51b81526020600482015260026024820152612a2360f11b604482015290519081900360640190fd5b5050505050565b604080513060248083019190915282518083039091018152604490910182526020810180516001600160e01b03166370a0823160e01b17815291518151600093849384936001600160a01b037f0000000000000000000000003561446ef52872c568dd5dcf51a13e2ac77d1ee81693919290918291908083835b60208310613d6d5780518252601f199092019160209182019101613d4e565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114613dcd576040519150601f19603f3d011682016040523d82523d6000602084013e613dd2565b606091505b5091509150818015613de657506020815110155b613def57600080fd5b808060200190516020811015613e0457600080fd5b50519250505090565b808201828110156132bd57600080fd5b604080513060248083019190915282518083039091018152604490910182526020810180516001600160e01b03166370a0823160e01b17815291518151600093849384936001600160a01b037f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc216939192909182919080838360208310613d6d5780518252601f199092019160209182019101613d4e565b6000808361ffff1611613ef3576040805162461bcd60e51b81526020600482015260016024820152604960f81b604482015290519081900360640190fd5b8261ffff168261ffff1611613f09575081613382565b825b8261ffff168161ffff161015613f4f576001858261ffff1661ffff8110613f2e57fe5b01805463ffffffff191663ffffffff92909216919091179055600101613f0b565b50909392505050565b80600f81900b8114612beb57600080fd5b6000806000613f76612bf0565b613f88846020015185604001516143a1565b6040805160e0810182526000546001600160a01b0381168252600160a01b8104600290810b810b900b602080840182905261ffff600160b81b8404811685870152600160c81b84048116606080870191909152600160d81b8504909116608086015260ff600160e81b8504811660a0870152600160f01b909404909316151560c08501528851908901519489015192890151939461402c9491939092909190614acf565b93508460600151600f0b6000146141a157846020015160020b816020015160020b12156140815761407a6140638660200151612d6d565b6140708760400151612d6d565b8760600151614c84565b92506141a1565b846040015160020b816020015160020b12156141775760045460408201516001600160801b03909116906140d3906140b7612c27565b60208501516060860151608087015160089493929187916139d1565b6000805461ffff60c81b1916600160c81b61ffff938416021761ffff60b81b1916600160b81b939092169290920217905581516040870151614123919061411990612d6d565b8860600151614c84565b93506141416141358760200151612d6d565b83516060890151614cc8565b92506141518187606001516135ef565b600480546001600160801b0319166001600160801b0392909216919091179055506141a1565b61419e6141878660200151612d6d565b6141948760400151612d6d565b8760600151614cc8565b91505b509193909250565b60006141b68484846132d9565b9050600082806141c257fe5b84860911156133825760001981106141d957600080fd5b6001019392505050565b6040805160609490941b6bffffffffffffffffffffffff1916602080860191909152600293840b60e890811b60348701529290930b90911b60378401528051808403601a018152603a90930181528251928201929092206000908152929052902090565b60608060008361ffff1611614287576040805162461bcd60e51b81526020600482015260016024820152604960f81b604482015290519081900360640190fd5b865167ffffffffffffffff8111801561429f57600080fd5b506040519080825280602002602001820160405280156142c9578160200160208202803683370190505b509150865167ffffffffffffffff811180156142e457600080fd5b5060405190808252806020026020018201604052801561430e578160200160208202803683370190505b50905060005b87518110156143945761433f8a8a8a848151811061432e57fe5b60200260200101518a8a8a8a613389565b84838151811061434b57fe5b6020026020010184848151811061435e57fe5b60200260200101826001600160a01b03166001600160a01b03168152508260060b60060b81525050508080600101915050614314565b5097509795505050505050565b8060020b8260020b126143e1576040805162461bcd60e51b8152602060048201526003602482015262544c5560e81b604482015290519081900360640190fd5b620d89e719600283900b1215614424576040805162461bcd60e51b8152602060048201526003602482015262544c4d60e81b604482015290519081900360640190fd5b620d89e8600282900b1315614466576040805162461bcd60e51b815260206004820152600360248201526254554d60e81b604482015290519081900360640190fd5b5050565b6040805160808101825263ffffffff9283168082526000602083018190529282019290925260016060909101819052835463ffffffff1916909117909116600160f81b17909155908190565b60020b600881901d9161010090910790565b60008082116144d657600080fd5b600160801b82106144e957608091821c91015b68010000000000000000821061450157604091821c91015b640100000000821061451557602091821c91015b62010000821061452757601091821c91015b610100821061453857600891821c91015b6010821061454857600491821c91015b6004821061455857600291821c91015b60028210612beb57600101919050565b600080821161457657600080fd5b5060ff6001600160801b0382161561459157607f1901614599565b608082901c91505b67ffffffffffffffff8216156145b257603f19016145ba565b604082901c91505b63ffffffff8216156145cf57601f19016145d7565b602082901c91505b61ffff8216156145ea57600f19016145f2565b601082901c91505b60ff821615614604576007190161460c565b600882901c91505b600f82161561461e5760031901614626565b600482901c91505b60038216156146385760011901614640565b600282901c91505b6001821615612beb5760001901919050565b6000836001600160a01b0316856001600160a01b03161115614672579293925b8161469f5761469a836001600160801b03168686036001600160a01b0316600160601b6132d9565b6146c2565b6146c2836001600160801b03168686036001600160a01b0316600160601b6141a9565b90505b949350505050565b6000836001600160a01b0316856001600160a01b031611156146ed579293925b7bffffffffffffffffffffffffffffffff000000000000000000000000606084901b166001600160a01b03868603811690871661472957600080fd5b8361475957866001600160a01b031661474c8383896001600160a01b03166132d9565b8161475357fe5b0461477f565b61477f6147708383896001600160a01b03166141a9565b886001600160a01b0316614cf7565b979650505050505050565b600080856001600160a01b0316116147a157600080fd5b6000846001600160801b0316116147b757600080fd5b816147c95761469a8585856001614d02565b6146c28585856001614de3565b600080856001600160a01b0316116147ed57600080fd5b6000846001600160801b03161161480357600080fd5b816148155761469a8585856000614de3565b6146c28585856000614d02565b61482a61564a565b600085600001518503905060405180608001604052808663ffffffff1681526020018263ffffffff168660020b0288602001510160060b81526020016000856001600160801b03161161487e576001614880565b845b6001600160801b031673ffffffff00000000000000000000000000000000608085901b16816148ab57fe5b048860400151016001600160a01b0316815260200160011515815250915050949350505050565b6148da61564a565b6148e261564a565b888561ffff1661ffff81106148f357fe5b60408051608081018252919092015463ffffffff81168083526401000000008204600690810b810b900b6020840152600160581b82046001600160a01b031693830193909352600160f81b900460ff1615156060820152925061495890899089614ed8565b15614990578663ffffffff16826000015163ffffffff16141561497a57613510565b8161498783898988614822565b91509150613510565b888361ffff168660010161ffff16816149a557fe5b0661ffff1661ffff81106149b557fe5b60408051608081018252929091015463ffffffff811683526401000000008104600690810b810b900b60208401526001600160a01b03600160581b8204169183019190915260ff600160f81b90910416151560608201819052909250614a6c57604080516080810182528a5463ffffffff811682526401000000008104600690810b810b900b6020830152600160581b81046001600160a01b031692820192909252600160f81b90910460ff161515606082015291505b614a7b88836000015189614ed8565b614ab2576040805162461bcd60e51b815260206004820152600360248201526213d31160ea1b604482015290519081900360640190fd5b614abf8989898887614f9b565b9150915097509795505050505050565b6000614ade60078787876141e3565b60015460025491925090600080600f87900b15614c24576000614aff612c27565b6000805460045492935090918291614b499160089186918591600160a01b810460020b9161ffff600160b81b83048116926001600160801b0390921691600160c81b900416613389565b9092509050614b8360058d8b8d8b8b87898b60007f000000000000000000000000000000000000097451ff859c3282305ffa26a9c561513b565b9450614bba60058c8b8d8b8b87898b60017f000000000000000000000000000000000000097451ff859c3282305ffa26a9c561513b565b93508415614bee57614bee60068d7f0000000000000000000000000000000000000000000000000000000000000001615325565b8315614c2057614c2060068c7f0000000000000000000000000000000000000000000000000000000000000001615325565b5050505b600080614c3660058c8c8b8a8a61538b565b9092509050614c47878a8484615437565b600089600f0b1215614c75578315614c6457614c6460058c6155cc565b8215614c7557614c7560058b6155cc565b50505050505095945050505050565b60008082600f0b12614caa57614ca5614ca085858560016146cd565b613291565b6146c5565b614cbd614ca085858560000360006146cd565b600003949350505050565b60008082600f0b12614ce457614ca5614ca08585856001614652565b614cbd614ca08585856000036000614652565b808204910615150190565b60008115614d755760006001600160a01b03841115614d3857614d3384600160601b876001600160801b03166132d9565b614d50565b6001600160801b038516606085901b81614d4e57fe5b045b9050614d6d614d686001600160a01b03881683613e0d565b6155f8565b9150506146c5565b60006001600160a01b03841115614da357614d9e84600160601b876001600160801b03166141a9565b614dba565b614dba606085901b6001600160801b038716614cf7565b905080866001600160a01b031611614dd157600080fd5b6001600160a01b0386160390506146c5565b600082614df15750836146c5565b7bffffffffffffffffffffffffffffffff000000000000000000000000606085901b168215614e91576001600160a01b03861684810290858281614e3157fe5b041415614e6257818101828110614e6057614e5683896001600160a01b0316836141a9565b93505050506146c5565b505b614e8882614e83878a6001600160a01b03168681614e7c57fe5b0490613e0d565b614cf7565b925050506146c5565b6001600160a01b03861684810290858281614ea857fe5b04148015614eb557508082115b614ebe57600080fd5b808203614e56614d68846001600160a01b038b16846141a9565b60008363ffffffff168363ffffffff1611158015614f0257508363ffffffff168263ffffffff1611155b15614f1e578163ffffffff168363ffffffff1611159050613382565b60008463ffffffff168463ffffffff1611614f46578363ffffffff1664010000000001614f4e565b8363ffffffff165b64ffffffffff16905060008563ffffffff168463ffffffff1611614f7f578363ffffffff1664010000000001614f87565b8363ffffffff165b64ffffffffff169091111595945050505050565b614fa361564a565b614fab61564a565b60008361ffff168560010161ffff1681614fc157fe5b0661ffff169050600060018561ffff16830103905060005b506002818301048961ffff87168281614fee57fe5b0661ffff8110614ffa57fe5b60408051608081018252929091015463ffffffff811683526401000000008104600690810b810b900b60208401526001600160a01b03600160581b8204169183019190915260ff600160f81b9091041615156060820181905290955061506557806001019250614fd9565b898661ffff16826001018161507657fe5b0661ffff811061508257fe5b60408051608081018252929091015463ffffffff811683526401000000008104600690810b810b900b60208401526001600160a01b03600160581b8204169183019190915260ff600160f81b909104161515606082015285519094506000906150ed908b908b614ed8565b905080801561510657506151068a8a8760000151614ed8565b15615111575061512e565b8061512157600182039250615128565b8160010193505b50614fd9565b5050509550959350505050565b60028a810b900b600090815260208c90526040812080546001600160801b031682615166828d6135ef565b9050846001600160801b0316816001600160801b031611156151b4576040805162461bcd60e51b81526020600482015260026024820152614c4f60f01b604482015290519081900360640190fd5b6001600160801b03828116159082161581141594501561528a578c60020b8e60020b1361525a57600183018b9055600283018a90556003830180547fffffffffff0000000000000000000000000000000000000000ffffffffffffff166701000000000000006001600160a01b038c16021766ffffffffffffff191666ffffffffffffff60068b900b161763ffffffff60d81b1916600160d81b63ffffffff8a16021790555b6003830180547effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16600160f81b1790555b82546001600160801b0319166001600160801b038216178355856152d35782546152ce906152c990600160801b9004600f90810b810b908f900b6132c3565b613f58565b6152f4565b82546152f4906152c990600160801b9004600f90810b810b908f900b6132a7565b8354600f9190910b6001600160801b03908116600160801b0291161790925550909c9b505050505050505050505050565b8060020b8260020b8161533457fe5b0760020b1561534257600080fd5b60008061535d8360020b8560020b8161535757fe5b056144b6565b600191820b820b60009081526020979097526040909620805460ff9097169190911b90951890945550505050565b600285810b80820b60009081526020899052604080822088850b850b83529082209193849391929184918291908a900b126153d1575050600182015460028301546153e4565b8360010154880391508360020154870390505b6000808b60020b8b60020b121561540657505060018301546002840154615419565b84600101548a0391508460020154890390505b92909803979097039b96909503949094039850939650505050505050565b6040805160a08101825285546001600160801b0390811682526001870154602083015260028701549282019290925260038601548083166060830152600160801b900490911660808201526000600f85900b6154d65781516001600160801b03166154ce576040805162461bcd60e51b815260206004820152600260248201526104e560f41b604482015290519081900360640190fd5b5080516154e5565b81516154e290866135ef565b90505b60006155098360200151860384600001516001600160801b0316600160801b6132d9565b9050600061552f8460400151860385600001516001600160801b0316600160801b6132d9565b905086600f0b6000146155565787546001600160801b0319166001600160801b0384161788555b60018801869055600288018590556001600160801b03821615158061558457506000816001600160801b0316115b156155c2576003880180546001600160801b031981166001600160801b039182168501821617808216600160801b9182900483168501909216021790555b5050505050505050565b600290810b810b6000908152602092909252604082208281556001810183905590810182905560030155565b806001600160a01b0381168114612beb57600080fd5b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c081019190915290565b6040805160808101825260008082526020820181905291810182905260608101919091529056fea164736f6c6343000706000a
{{ "language": "Solidity", "sources": { "contracts/UniswapV3Pool.sol": { "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity =0.7.6;\n\nimport './interfaces/IUniswapV3Pool.sol';\n\nimport './NoDelegateCall.sol';\n\nimport './libraries/LowGasSafeMath.sol';\nimport './libraries/SafeCast.sol';\nimport './libraries/Tick.sol';\nimport './libraries/TickBitmap.sol';\nimport './libraries/Position.sol';\nimport './libraries/Oracle.sol';\n\nimport './libraries/FullMath.sol';\nimport './libraries/FixedPoint128.sol';\nimport './libraries/TransferHelper.sol';\nimport './libraries/TickMath.sol';\nimport './libraries/LiquidityMath.sol';\nimport './libraries/SqrtPriceMath.sol';\nimport './libraries/SwapMath.sol';\n\nimport './interfaces/IUniswapV3PoolDeployer.sol';\nimport './interfaces/IUniswapV3Factory.sol';\nimport './interfaces/IERC20Minimal.sol';\nimport './interfaces/callback/IUniswapV3MintCallback.sol';\nimport './interfaces/callback/IUniswapV3SwapCallback.sol';\nimport './interfaces/callback/IUniswapV3FlashCallback.sol';\n\ncontract UniswapV3Pool is IUniswapV3Pool, NoDelegateCall {\n using LowGasSafeMath for uint256;\n using LowGasSafeMath for int256;\n using SafeCast for uint256;\n using SafeCast for int256;\n using Tick for mapping(int24 => Tick.Info);\n using TickBitmap for mapping(int16 => uint256);\n using Position for mapping(bytes32 => Position.Info);\n using Position for Position.Info;\n using Oracle for Oracle.Observation[65535];\n\n /// @inheritdoc IUniswapV3PoolImmutables\n address public immutable override factory;\n /// @inheritdoc IUniswapV3PoolImmutables\n address public immutable override token0;\n /// @inheritdoc IUniswapV3PoolImmutables\n address public immutable override token1;\n /// @inheritdoc IUniswapV3PoolImmutables\n uint24 public immutable override fee;\n\n /// @inheritdoc IUniswapV3PoolImmutables\n int24 public immutable override tickSpacing;\n\n /// @inheritdoc IUniswapV3PoolImmutables\n uint128 public immutable override maxLiquidityPerTick;\n\n struct Slot0 {\n // the current price\n uint160 sqrtPriceX96;\n // the current tick\n int24 tick;\n // the most-recently updated index of the observations array\n uint16 observationIndex;\n // the current maximum number of observations that are being stored\n uint16 observationCardinality;\n // the next maximum number of observations to store, triggered in observations.write\n uint16 observationCardinalityNext;\n // the current protocol fee as a percentage of the swap fee taken on withdrawal\n // represented as an integer denominator (1/x)%\n uint8 feeProtocol;\n // whether the pool is locked\n bool unlocked;\n }\n /// @inheritdoc IUniswapV3PoolState\n Slot0 public override slot0;\n\n /// @inheritdoc IUniswapV3PoolState\n uint256 public override feeGrowthGlobal0X128;\n /// @inheritdoc IUniswapV3PoolState\n uint256 public override feeGrowthGlobal1X128;\n\n // accumulated protocol fees in token0/token1 units\n struct ProtocolFees {\n uint128 token0;\n uint128 token1;\n }\n /// @inheritdoc IUniswapV3PoolState\n ProtocolFees public override protocolFees;\n\n /// @inheritdoc IUniswapV3PoolState\n uint128 public override liquidity;\n\n /// @inheritdoc IUniswapV3PoolState\n mapping(int24 => Tick.Info) public override ticks;\n /// @inheritdoc IUniswapV3PoolState\n mapping(int16 => uint256) public override tickBitmap;\n /// @inheritdoc IUniswapV3PoolState\n mapping(bytes32 => Position.Info) public override positions;\n /// @inheritdoc IUniswapV3PoolState\n Oracle.Observation[65535] public override observations;\n\n /// @dev Mutually exclusive reentrancy protection into the pool to/from a method. This method also prevents entrance\n /// to a function before the pool is initialized. The reentrancy guard is required throughout the contract because\n /// we use balance checks to determine the payment status of interactions such as mint, swap and flash.\n modifier lock() {\n require(slot0.unlocked, 'LOK');\n slot0.unlocked = false;\n _;\n slot0.unlocked = true;\n }\n\n /// @dev Prevents calling a function from anyone except the address returned by IUniswapV3Factory#owner()\n modifier onlyFactoryOwner() {\n require(msg.sender == IUniswapV3Factory(factory).owner());\n _;\n }\n\n constructor() {\n int24 _tickSpacing;\n (factory, token0, token1, fee, _tickSpacing) = IUniswapV3PoolDeployer(msg.sender).parameters();\n tickSpacing = _tickSpacing;\n\n maxLiquidityPerTick = Tick.tickSpacingToMaxLiquidityPerTick(_tickSpacing);\n }\n\n /// @dev Common checks for valid tick inputs.\n function checkTicks(int24 tickLower, int24 tickUpper) private pure {\n require(tickLower < tickUpper, 'TLU');\n require(tickLower >= TickMath.MIN_TICK, 'TLM');\n require(tickUpper <= TickMath.MAX_TICK, 'TUM');\n }\n\n /// @dev Returns the block timestamp truncated to 32 bits, i.e. mod 2**32. This method is overridden in tests.\n function _blockTimestamp() internal view virtual returns (uint32) {\n return uint32(block.timestamp); // truncation is desired\n }\n\n /// @dev Get the pool's balance of token0\n /// @dev This function is gas optimized to avoid a redundant extcodesize check in addition to the returndatasize\n /// check\n function balance0() private view returns (uint256) {\n (bool success, bytes memory data) =\n token0.staticcall(abi.encodeWithSelector(IERC20Minimal.balanceOf.selector, address(this)));\n require(success && data.length >= 32);\n return abi.decode(data, (uint256));\n }\n\n /// @dev Get the pool's balance of token1\n /// @dev This function is gas optimized to avoid a redundant extcodesize check in addition to the returndatasize\n /// check\n function balance1() private view returns (uint256) {\n (bool success, bytes memory data) =\n token1.staticcall(abi.encodeWithSelector(IERC20Minimal.balanceOf.selector, address(this)));\n require(success && data.length >= 32);\n return abi.decode(data, (uint256));\n }\n\n /// @inheritdoc IUniswapV3PoolDerivedState\n function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)\n external\n view\n override\n noDelegateCall\n returns (\n int56 tickCumulativeInside,\n uint160 secondsPerLiquidityInsideX128,\n uint32 secondsInside\n )\n {\n checkTicks(tickLower, tickUpper);\n\n int56 tickCumulativeLower;\n int56 tickCumulativeUpper;\n uint160 secondsPerLiquidityOutsideLowerX128;\n uint160 secondsPerLiquidityOutsideUpperX128;\n uint32 secondsOutsideLower;\n uint32 secondsOutsideUpper;\n\n {\n Tick.Info storage lower = ticks[tickLower];\n Tick.Info storage upper = ticks[tickUpper];\n bool initializedLower;\n (tickCumulativeLower, secondsPerLiquidityOutsideLowerX128, secondsOutsideLower, initializedLower) = (\n lower.tickCumulativeOutside,\n lower.secondsPerLiquidityOutsideX128,\n lower.secondsOutside,\n lower.initialized\n );\n require(initializedLower);\n\n bool initializedUpper;\n (tickCumulativeUpper, secondsPerLiquidityOutsideUpperX128, secondsOutsideUpper, initializedUpper) = (\n upper.tickCumulativeOutside,\n upper.secondsPerLiquidityOutsideX128,\n upper.secondsOutside,\n upper.initialized\n );\n require(initializedUpper);\n }\n\n Slot0 memory _slot0 = slot0;\n\n if (_slot0.tick < tickLower) {\n return (\n tickCumulativeLower - tickCumulativeUpper,\n secondsPerLiquidityOutsideLowerX128 - secondsPerLiquidityOutsideUpperX128,\n secondsOutsideLower - secondsOutsideUpper\n );\n } else if (_slot0.tick < tickUpper) {\n uint32 time = _blockTimestamp();\n (int56 tickCumulative, uint160 secondsPerLiquidityCumulativeX128) =\n observations.observeSingle(\n time,\n 0,\n _slot0.tick,\n _slot0.observationIndex,\n liquidity,\n _slot0.observationCardinality\n );\n return (\n tickCumulative - tickCumulativeLower - tickCumulativeUpper,\n secondsPerLiquidityCumulativeX128 -\n secondsPerLiquidityOutsideLowerX128 -\n secondsPerLiquidityOutsideUpperX128,\n time - secondsOutsideLower - secondsOutsideUpper\n );\n } else {\n return (\n tickCumulativeUpper - tickCumulativeLower,\n secondsPerLiquidityOutsideUpperX128 - secondsPerLiquidityOutsideLowerX128,\n secondsOutsideUpper - secondsOutsideLower\n );\n }\n }\n\n /// @inheritdoc IUniswapV3PoolDerivedState\n function observe(uint32[] calldata secondsAgos)\n external\n view\n override\n noDelegateCall\n returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s)\n {\n return\n observations.observe(\n _blockTimestamp(),\n secondsAgos,\n slot0.tick,\n slot0.observationIndex,\n liquidity,\n slot0.observationCardinality\n );\n }\n\n /// @inheritdoc IUniswapV3PoolActions\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext)\n external\n override\n lock\n noDelegateCall\n {\n uint16 observationCardinalityNextOld = slot0.observationCardinalityNext; // for the event\n uint16 observationCardinalityNextNew =\n observations.grow(observationCardinalityNextOld, observationCardinalityNext);\n slot0.observationCardinalityNext = observationCardinalityNextNew;\n if (observationCardinalityNextOld != observationCardinalityNextNew)\n emit IncreaseObservationCardinalityNext(observationCardinalityNextOld, observationCardinalityNextNew);\n }\n\n /// @inheritdoc IUniswapV3PoolActions\n /// @dev not locked because it initializes unlocked\n function initialize(uint160 sqrtPriceX96) external override {\n require(slot0.sqrtPriceX96 == 0, 'AI');\n\n int24 tick = TickMath.getTickAtSqrtRatio(sqrtPriceX96);\n\n (uint16 cardinality, uint16 cardinalityNext) = observations.initialize(_blockTimestamp());\n\n slot0 = Slot0({\n sqrtPriceX96: sqrtPriceX96,\n tick: tick,\n observationIndex: 0,\n observationCardinality: cardinality,\n observationCardinalityNext: cardinalityNext,\n feeProtocol: 0,\n unlocked: true\n });\n\n emit Initialize(sqrtPriceX96, tick);\n }\n\n struct ModifyPositionParams {\n // the address that owns the position\n address owner;\n // the lower and upper tick of the position\n int24 tickLower;\n int24 tickUpper;\n // any change in liquidity\n int128 liquidityDelta;\n }\n\n /// @dev Effect some changes to a position\n /// @param params the position details and the change to the position's liquidity to effect\n /// @return position a storage pointer referencing the position with the given owner and tick range\n /// @return amount0 the amount of token0 owed to the pool, negative if the pool should pay the recipient\n /// @return amount1 the amount of token1 owed to the pool, negative if the pool should pay the recipient\n function _modifyPosition(ModifyPositionParams memory params)\n private\n noDelegateCall\n returns (\n Position.Info storage position,\n int256 amount0,\n int256 amount1\n )\n {\n checkTicks(params.tickLower, params.tickUpper);\n\n Slot0 memory _slot0 = slot0; // SLOAD for gas optimization\n\n position = _updatePosition(\n params.owner,\n params.tickLower,\n params.tickUpper,\n params.liquidityDelta,\n _slot0.tick\n );\n\n if (params.liquidityDelta != 0) {\n if (_slot0.tick < params.tickLower) {\n // current tick is below the passed range; liquidity can only become in range by crossing from left to\n // right, when we'll need _more_ token0 (it's becoming more valuable) so user must provide it\n amount0 = SqrtPriceMath.getAmount0Delta(\n TickMath.getSqrtRatioAtTick(params.tickLower),\n TickMath.getSqrtRatioAtTick(params.tickUpper),\n params.liquidityDelta\n );\n } else if (_slot0.tick < params.tickUpper) {\n // current tick is inside the passed range\n uint128 liquidityBefore = liquidity; // SLOAD for gas optimization\n\n // write an oracle entry\n (slot0.observationIndex, slot0.observationCardinality) = observations.write(\n _slot0.observationIndex,\n _blockTimestamp(),\n _slot0.tick,\n liquidityBefore,\n _slot0.observationCardinality,\n _slot0.observationCardinalityNext\n );\n\n amount0 = SqrtPriceMath.getAmount0Delta(\n _slot0.sqrtPriceX96,\n TickMath.getSqrtRatioAtTick(params.tickUpper),\n params.liquidityDelta\n );\n amount1 = SqrtPriceMath.getAmount1Delta(\n TickMath.getSqrtRatioAtTick(params.tickLower),\n _slot0.sqrtPriceX96,\n params.liquidityDelta\n );\n\n liquidity = LiquidityMath.addDelta(liquidityBefore, params.liquidityDelta);\n } else {\n // current tick is above the passed range; liquidity can only become in range by crossing from right to\n // left, when we'll need _more_ token1 (it's becoming more valuable) so user must provide it\n amount1 = SqrtPriceMath.getAmount1Delta(\n TickMath.getSqrtRatioAtTick(params.tickLower),\n TickMath.getSqrtRatioAtTick(params.tickUpper),\n params.liquidityDelta\n );\n }\n }\n }\n\n /// @dev Gets and updates a position with the given liquidity delta\n /// @param owner the owner of the position\n /// @param tickLower the lower tick of the position's tick range\n /// @param tickUpper the upper tick of the position's tick range\n /// @param tick the current tick, passed to avoid sloads\n function _updatePosition(\n address owner,\n int24 tickLower,\n int24 tickUpper,\n int128 liquidityDelta,\n int24 tick\n ) private returns (Position.Info storage position) {\n position = positions.get(owner, tickLower, tickUpper);\n\n uint256 _feeGrowthGlobal0X128 = feeGrowthGlobal0X128; // SLOAD for gas optimization\n uint256 _feeGrowthGlobal1X128 = feeGrowthGlobal1X128; // SLOAD for gas optimization\n\n // if we need to update the ticks, do it\n bool flippedLower;\n bool flippedUpper;\n if (liquidityDelta != 0) {\n uint32 time = _blockTimestamp();\n (int56 tickCumulative, uint160 secondsPerLiquidityCumulativeX128) =\n observations.observeSingle(\n time,\n 0,\n slot0.tick,\n slot0.observationIndex,\n liquidity,\n slot0.observationCardinality\n );\n\n flippedLower = ticks.update(\n tickLower,\n tick,\n liquidityDelta,\n _feeGrowthGlobal0X128,\n _feeGrowthGlobal1X128,\n secondsPerLiquidityCumulativeX128,\n tickCumulative,\n time,\n false,\n maxLiquidityPerTick\n );\n flippedUpper = ticks.update(\n tickUpper,\n tick,\n liquidityDelta,\n _feeGrowthGlobal0X128,\n _feeGrowthGlobal1X128,\n secondsPerLiquidityCumulativeX128,\n tickCumulative,\n time,\n true,\n maxLiquidityPerTick\n );\n\n if (flippedLower) {\n tickBitmap.flipTick(tickLower, tickSpacing);\n }\n if (flippedUpper) {\n tickBitmap.flipTick(tickUpper, tickSpacing);\n }\n }\n\n (uint256 feeGrowthInside0X128, uint256 feeGrowthInside1X128) =\n ticks.getFeeGrowthInside(tickLower, tickUpper, tick, _feeGrowthGlobal0X128, _feeGrowthGlobal1X128);\n\n position.update(liquidityDelta, feeGrowthInside0X128, feeGrowthInside1X128);\n\n // clear any tick data that is no longer needed\n if (liquidityDelta < 0) {\n if (flippedLower) {\n ticks.clear(tickLower);\n }\n if (flippedUpper) {\n ticks.clear(tickUpper);\n }\n }\n }\n\n /// @inheritdoc IUniswapV3PoolActions\n /// @dev noDelegateCall is applied indirectly via _modifyPosition\n function mint(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount,\n bytes calldata data\n ) external override lock returns (uint256 amount0, uint256 amount1) {\n require(amount > 0);\n (, int256 amount0Int, int256 amount1Int) =\n _modifyPosition(\n ModifyPositionParams({\n owner: recipient,\n tickLower: tickLower,\n tickUpper: tickUpper,\n liquidityDelta: int256(amount).toInt128()\n })\n );\n\n amount0 = uint256(amount0Int);\n amount1 = uint256(amount1Int);\n\n uint256 balance0Before;\n uint256 balance1Before;\n if (amount0 > 0) balance0Before = balance0();\n if (amount1 > 0) balance1Before = balance1();\n IUniswapV3MintCallback(msg.sender).uniswapV3MintCallback(amount0, amount1, data);\n if (amount0 > 0) require(balance0Before.add(amount0) <= balance0(), 'M0');\n if (amount1 > 0) require(balance1Before.add(amount1) <= balance1(), 'M1');\n\n emit Mint(msg.sender, recipient, tickLower, tickUpper, amount, amount0, amount1);\n }\n\n /// @inheritdoc IUniswapV3PoolActions\n function collect(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external override lock returns (uint128 amount0, uint128 amount1) {\n // we don't need to checkTicks here, because invalid positions will never have non-zero tokensOwed{0,1}\n Position.Info storage position = positions.get(msg.sender, tickLower, tickUpper);\n\n amount0 = amount0Requested > position.tokensOwed0 ? position.tokensOwed0 : amount0Requested;\n amount1 = amount1Requested > position.tokensOwed1 ? position.tokensOwed1 : amount1Requested;\n\n if (amount0 > 0) {\n position.tokensOwed0 -= amount0;\n TransferHelper.safeTransfer(token0, recipient, amount0);\n }\n if (amount1 > 0) {\n position.tokensOwed1 -= amount1;\n TransferHelper.safeTransfer(token1, recipient, amount1);\n }\n\n emit Collect(msg.sender, recipient, tickLower, tickUpper, amount0, amount1);\n }\n\n /// @inheritdoc IUniswapV3PoolActions\n /// @dev noDelegateCall is applied indirectly via _modifyPosition\n function burn(\n int24 tickLower,\n int24 tickUpper,\n uint128 amount\n ) external override lock returns (uint256 amount0, uint256 amount1) {\n (Position.Info storage position, int256 amount0Int, int256 amount1Int) =\n _modifyPosition(\n ModifyPositionParams({\n owner: msg.sender,\n tickLower: tickLower,\n tickUpper: tickUpper,\n liquidityDelta: -int256(amount).toInt128()\n })\n );\n\n amount0 = uint256(-amount0Int);\n amount1 = uint256(-amount1Int);\n\n if (amount0 > 0 || amount1 > 0) {\n (position.tokensOwed0, position.tokensOwed1) = (\n position.tokensOwed0 + uint128(amount0),\n position.tokensOwed1 + uint128(amount1)\n );\n }\n\n emit Burn(msg.sender, tickLower, tickUpper, amount, amount0, amount1);\n }\n\n struct SwapCache {\n // the protocol fee for the input token\n uint8 feeProtocol;\n // liquidity at the beginning of the swap\n uint128 liquidityStart;\n // the timestamp of the current block\n uint32 blockTimestamp;\n // the current value of the tick accumulator, computed only if we cross an initialized tick\n int56 tickCumulative;\n // the current value of seconds per liquidity accumulator, computed only if we cross an initialized tick\n uint160 secondsPerLiquidityCumulativeX128;\n // whether we've computed and cached the above two accumulators\n bool computedLatestObservation;\n }\n\n // the top level state of the swap, the results of which are recorded in storage at the end\n struct SwapState {\n // the amount remaining to be swapped in/out of the input/output asset\n int256 amountSpecifiedRemaining;\n // the amount already swapped out/in of the output/input asset\n int256 amountCalculated;\n // current sqrt(price)\n uint160 sqrtPriceX96;\n // the tick associated with the current price\n int24 tick;\n // the global fee growth of the input token\n uint256 feeGrowthGlobalX128;\n // amount of input token paid as protocol fee\n uint128 protocolFee;\n // the current liquidity in range\n uint128 liquidity;\n }\n\n struct StepComputations {\n // the price at the beginning of the step\n uint160 sqrtPriceStartX96;\n // the next tick to swap to from the current tick in the swap direction\n int24 tickNext;\n // whether tickNext is initialized or not\n bool initialized;\n // sqrt(price) for the next tick (1/0)\n uint160 sqrtPriceNextX96;\n // how much is being swapped in in this step\n uint256 amountIn;\n // how much is being swapped out\n uint256 amountOut;\n // how much fee is being paid in\n uint256 feeAmount;\n }\n\n /// @inheritdoc IUniswapV3PoolActions\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external override noDelegateCall returns (int256 amount0, int256 amount1) {\n require(amountSpecified != 0, 'AS');\n\n Slot0 memory slot0Start = slot0;\n\n require(slot0Start.unlocked, 'LOK');\n require(\n zeroForOne\n ? sqrtPriceLimitX96 < slot0Start.sqrtPriceX96 && sqrtPriceLimitX96 > TickMath.MIN_SQRT_RATIO\n : sqrtPriceLimitX96 > slot0Start.sqrtPriceX96 && sqrtPriceLimitX96 < TickMath.MAX_SQRT_RATIO,\n 'SPL'\n );\n\n slot0.unlocked = false;\n\n SwapCache memory cache =\n SwapCache({\n liquidityStart: liquidity,\n blockTimestamp: _blockTimestamp(),\n feeProtocol: zeroForOne ? (slot0Start.feeProtocol % 16) : (slot0Start.feeProtocol >> 4),\n secondsPerLiquidityCumulativeX128: 0,\n tickCumulative: 0,\n computedLatestObservation: false\n });\n\n bool exactInput = amountSpecified > 0;\n\n SwapState memory state =\n SwapState({\n amountSpecifiedRemaining: amountSpecified,\n amountCalculated: 0,\n sqrtPriceX96: slot0Start.sqrtPriceX96,\n tick: slot0Start.tick,\n feeGrowthGlobalX128: zeroForOne ? feeGrowthGlobal0X128 : feeGrowthGlobal1X128,\n protocolFee: 0,\n liquidity: cache.liquidityStart\n });\n\n // continue swapping as long as we haven't used the entire input/output and haven't reached the price limit\n while (state.amountSpecifiedRemaining != 0 && state.sqrtPriceX96 != sqrtPriceLimitX96) {\n StepComputations memory step;\n\n step.sqrtPriceStartX96 = state.sqrtPriceX96;\n\n (step.tickNext, step.initialized) = tickBitmap.nextInitializedTickWithinOneWord(\n state.tick,\n tickSpacing,\n zeroForOne\n );\n\n // ensure that we do not overshoot the min/max tick, as the tick bitmap is not aware of these bounds\n if (step.tickNext < TickMath.MIN_TICK) {\n step.tickNext = TickMath.MIN_TICK;\n } else if (step.tickNext > TickMath.MAX_TICK) {\n step.tickNext = TickMath.MAX_TICK;\n }\n\n // get the price for the next tick\n step.sqrtPriceNextX96 = TickMath.getSqrtRatioAtTick(step.tickNext);\n\n // compute values to swap to the target tick, price limit, or point where input/output amount is exhausted\n (state.sqrtPriceX96, step.amountIn, step.amountOut, step.feeAmount) = SwapMath.computeSwapStep(\n state.sqrtPriceX96,\n (zeroForOne ? step.sqrtPriceNextX96 < sqrtPriceLimitX96 : step.sqrtPriceNextX96 > sqrtPriceLimitX96)\n ? sqrtPriceLimitX96\n : step.sqrtPriceNextX96,\n state.liquidity,\n state.amountSpecifiedRemaining,\n fee\n );\n\n if (exactInput) {\n state.amountSpecifiedRemaining -= (step.amountIn + step.feeAmount).toInt256();\n state.amountCalculated = state.amountCalculated.sub(step.amountOut.toInt256());\n } else {\n state.amountSpecifiedRemaining += step.amountOut.toInt256();\n state.amountCalculated = state.amountCalculated.add((step.amountIn + step.feeAmount).toInt256());\n }\n\n // if the protocol fee is on, calculate how much is owed, decrement feeAmount, and increment protocolFee\n if (cache.feeProtocol > 0) {\n uint256 delta = step.feeAmount / cache.feeProtocol;\n step.feeAmount -= delta;\n state.protocolFee += uint128(delta);\n }\n\n // update global fee tracker\n if (state.liquidity > 0)\n state.feeGrowthGlobalX128 += FullMath.mulDiv(step.feeAmount, FixedPoint128.Q128, state.liquidity);\n\n // shift tick if we reached the next price\n if (state.sqrtPriceX96 == step.sqrtPriceNextX96) {\n // if the tick is initialized, run the tick transition\n if (step.initialized) {\n // check for the placeholder value, which we replace with the actual value the first time the swap\n // crosses an initialized tick\n if (!cache.computedLatestObservation) {\n (cache.tickCumulative, cache.secondsPerLiquidityCumulativeX128) = observations.observeSingle(\n cache.blockTimestamp,\n 0,\n slot0Start.tick,\n slot0Start.observationIndex,\n cache.liquidityStart,\n slot0Start.observationCardinality\n );\n cache.computedLatestObservation = true;\n }\n int128 liquidityNet =\n ticks.cross(\n step.tickNext,\n (zeroForOne ? state.feeGrowthGlobalX128 : feeGrowthGlobal0X128),\n (zeroForOne ? feeGrowthGlobal1X128 : state.feeGrowthGlobalX128),\n cache.secondsPerLiquidityCumulativeX128,\n cache.tickCumulative,\n cache.blockTimestamp\n );\n // if we're moving leftward, we interpret liquidityNet as the opposite sign\n // safe because liquidityNet cannot be type(int128).min\n if (zeroForOne) liquidityNet = -liquidityNet;\n\n state.liquidity = LiquidityMath.addDelta(state.liquidity, liquidityNet);\n }\n\n state.tick = zeroForOne ? step.tickNext - 1 : step.tickNext;\n } else if (state.sqrtPriceX96 != step.sqrtPriceStartX96) {\n // recompute unless we're on a lower tick boundary (i.e. already transitioned ticks), and haven't moved\n state.tick = TickMath.getTickAtSqrtRatio(state.sqrtPriceX96);\n }\n }\n\n // update tick and write an oracle entry if the tick change\n if (state.tick != slot0Start.tick) {\n (uint16 observationIndex, uint16 observationCardinality) =\n observations.write(\n slot0Start.observationIndex,\n cache.blockTimestamp,\n slot0Start.tick,\n cache.liquidityStart,\n slot0Start.observationCardinality,\n slot0Start.observationCardinalityNext\n );\n (slot0.sqrtPriceX96, slot0.tick, slot0.observationIndex, slot0.observationCardinality) = (\n state.sqrtPriceX96,\n state.tick,\n observationIndex,\n observationCardinality\n );\n } else {\n // otherwise just update the price\n slot0.sqrtPriceX96 = state.sqrtPriceX96;\n }\n\n // update liquidity if it changed\n if (cache.liquidityStart != state.liquidity) liquidity = state.liquidity;\n\n // update fee growth global and, if necessary, protocol fees\n // overflow is acceptable, protocol has to withdraw before it hits type(uint128).max fees\n if (zeroForOne) {\n feeGrowthGlobal0X128 = state.feeGrowthGlobalX128;\n if (state.protocolFee > 0) protocolFees.token0 += state.protocolFee;\n } else {\n feeGrowthGlobal1X128 = state.feeGrowthGlobalX128;\n if (state.protocolFee > 0) protocolFees.token1 += state.protocolFee;\n }\n\n (amount0, amount1) = zeroForOne == exactInput\n ? (amountSpecified - state.amountSpecifiedRemaining, state.amountCalculated)\n : (state.amountCalculated, amountSpecified - state.amountSpecifiedRemaining);\n\n // do the transfers and collect payment\n if (zeroForOne) {\n if (amount1 < 0) TransferHelper.safeTransfer(token1, recipient, uint256(-amount1));\n\n uint256 balance0Before = balance0();\n IUniswapV3SwapCallback(msg.sender).uniswapV3SwapCallback(amount0, amount1, data);\n require(balance0Before.add(uint256(amount0)) <= balance0(), 'IIA');\n } else {\n if (amount0 < 0) TransferHelper.safeTransfer(token0, recipient, uint256(-amount0));\n\n uint256 balance1Before = balance1();\n IUniswapV3SwapCallback(msg.sender).uniswapV3SwapCallback(amount0, amount1, data);\n require(balance1Before.add(uint256(amount1)) <= balance1(), 'IIA');\n }\n\n emit Swap(msg.sender, recipient, amount0, amount1, state.sqrtPriceX96, state.liquidity, state.tick);\n slot0.unlocked = true;\n }\n\n /// @inheritdoc IUniswapV3PoolActions\n function flash(\n address recipient,\n uint256 amount0,\n uint256 amount1,\n bytes calldata data\n ) external override lock noDelegateCall {\n uint128 _liquidity = liquidity;\n require(_liquidity > 0, 'L');\n\n uint256 fee0 = FullMath.mulDivRoundingUp(amount0, fee, 1e6);\n uint256 fee1 = FullMath.mulDivRoundingUp(amount1, fee, 1e6);\n uint256 balance0Before = balance0();\n uint256 balance1Before = balance1();\n\n if (amount0 > 0) TransferHelper.safeTransfer(token0, recipient, amount0);\n if (amount1 > 0) TransferHelper.safeTransfer(token1, recipient, amount1);\n\n IUniswapV3FlashCallback(msg.sender).uniswapV3FlashCallback(fee0, fee1, data);\n\n uint256 balance0After = balance0();\n uint256 balance1After = balance1();\n\n require(balance0Before.add(fee0) <= balance0After, 'F0');\n require(balance1Before.add(fee1) <= balance1After, 'F1');\n\n // sub is safe because we know balanceAfter is gt balanceBefore by at least fee\n uint256 paid0 = balance0After - balance0Before;\n uint256 paid1 = balance1After - balance1Before;\n\n if (paid0 > 0) {\n uint8 feeProtocol0 = slot0.feeProtocol % 16;\n uint256 fees0 = feeProtocol0 == 0 ? 0 : paid0 / feeProtocol0;\n if (uint128(fees0) > 0) protocolFees.token0 += uint128(fees0);\n feeGrowthGlobal0X128 += FullMath.mulDiv(paid0 - fees0, FixedPoint128.Q128, _liquidity);\n }\n if (paid1 > 0) {\n uint8 feeProtocol1 = slot0.feeProtocol >> 4;\n uint256 fees1 = feeProtocol1 == 0 ? 0 : paid1 / feeProtocol1;\n if (uint128(fees1) > 0) protocolFees.token1 += uint128(fees1);\n feeGrowthGlobal1X128 += FullMath.mulDiv(paid1 - fees1, FixedPoint128.Q128, _liquidity);\n }\n\n emit Flash(msg.sender, recipient, amount0, amount1, paid0, paid1);\n }\n\n /// @inheritdoc IUniswapV3PoolOwnerActions\n function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external override lock onlyFactoryOwner {\n require(\n (feeProtocol0 == 0 || (feeProtocol0 >= 4 && feeProtocol0 <= 10)) &&\n (feeProtocol1 == 0 || (feeProtocol1 >= 4 && feeProtocol1 <= 10))\n );\n uint8 feeProtocolOld = slot0.feeProtocol;\n slot0.feeProtocol = feeProtocol0 + (feeProtocol1 << 4);\n emit SetFeeProtocol(feeProtocolOld % 16, feeProtocolOld >> 4, feeProtocol0, feeProtocol1);\n }\n\n /// @inheritdoc IUniswapV3PoolOwnerActions\n function collectProtocol(\n address recipient,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external override lock onlyFactoryOwner returns (uint128 amount0, uint128 amount1) {\n amount0 = amount0Requested > protocolFees.token0 ? protocolFees.token0 : amount0Requested;\n amount1 = amount1Requested > protocolFees.token1 ? protocolFees.token1 : amount1Requested;\n\n if (amount0 > 0) {\n if (amount0 == protocolFees.token0) amount0--; // ensure that the slot is not cleared, for gas savings\n protocolFees.token0 -= amount0;\n TransferHelper.safeTransfer(token0, recipient, amount0);\n }\n if (amount1 > 0) {\n if (amount1 == protocolFees.token1) amount1--; // ensure that the slot is not cleared, for gas savings\n protocolFees.token1 -= amount1;\n TransferHelper.safeTransfer(token1, recipient, amount1);\n }\n\n emit CollectProtocol(msg.sender, recipient, amount0, amount1);\n }\n}\n" }, "contracts/interfaces/IUniswapV3Pool.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\nimport './pool/IUniswapV3PoolImmutables.sol';\nimport './pool/IUniswapV3PoolState.sol';\nimport './pool/IUniswapV3PoolDerivedState.sol';\nimport './pool/IUniswapV3PoolActions.sol';\nimport './pool/IUniswapV3PoolOwnerActions.sol';\nimport './pool/IUniswapV3PoolEvents.sol';\n\n/// @title The interface for a Uniswap V3 Pool\n/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform\n/// to the ERC20 specification\n/// @dev The pool interface is broken up into many smaller pieces\ninterface IUniswapV3Pool is\n IUniswapV3PoolImmutables,\n IUniswapV3PoolState,\n IUniswapV3PoolDerivedState,\n IUniswapV3PoolActions,\n IUniswapV3PoolOwnerActions,\n IUniswapV3PoolEvents\n{\n\n}\n" }, "contracts/NoDelegateCall.sol": { "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity =0.7.6;\n\n/// @title Prevents delegatecall to a contract\n/// @notice Base contract that provides a modifier for preventing delegatecall to methods in a child contract\nabstract contract NoDelegateCall {\n /// @dev The original address of this contract\n address private immutable original;\n\n constructor() {\n // Immutables are computed in the init code of the contract, and then inlined into the deployed bytecode.\n // In other words, this variable won't change when it's checked at runtime.\n original = address(this);\n }\n\n /// @dev Private method is used instead of inlining into modifier because modifiers are copied into each method,\n /// and the use of immutable means the address bytes are copied in every place the modifier is used.\n function checkNotDelegateCall() private view {\n require(address(this) == original);\n }\n\n /// @notice Prevents delegatecall into the modified method\n modifier noDelegateCall() {\n checkNotDelegateCall();\n _;\n }\n}\n" }, "contracts/libraries/LowGasSafeMath.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.7.0;\n\n/// @title Optimized overflow and underflow safe math operations\n/// @notice Contains methods for doing math operations that revert on overflow or underflow for minimal gas cost\nlibrary LowGasSafeMath {\n /// @notice Returns x + y, reverts if sum overflows uint256\n /// @param x The augend\n /// @param y The addend\n /// @return z The sum of x and y\n function add(uint256 x, uint256 y) internal pure returns (uint256 z) {\n require((z = x + y) >= x);\n }\n\n /// @notice Returns x - y, reverts if underflows\n /// @param x The minuend\n /// @param y The subtrahend\n /// @return z The difference of x and y\n function sub(uint256 x, uint256 y) internal pure returns (uint256 z) {\n require((z = x - y) <= x);\n }\n\n /// @notice Returns x * y, reverts if overflows\n /// @param x The multiplicand\n /// @param y The multiplier\n /// @return z The product of x and y\n function mul(uint256 x, uint256 y) internal pure returns (uint256 z) {\n require(x == 0 || (z = x * y) / x == y);\n }\n\n /// @notice Returns x + y, reverts if overflows or underflows\n /// @param x The augend\n /// @param y The addend\n /// @return z The sum of x and y\n function add(int256 x, int256 y) internal pure returns (int256 z) {\n require((z = x + y) >= x == (y >= 0));\n }\n\n /// @notice Returns x - y, reverts if overflows or underflows\n /// @param x The minuend\n /// @param y The subtrahend\n /// @return z The difference of x and y\n function sub(int256 x, int256 y) internal pure returns (int256 z) {\n require((z = x - y) <= x == (y >= 0));\n }\n}\n" }, "contracts/libraries/SafeCast.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Safe casting methods\n/// @notice Contains methods for safely casting between types\nlibrary SafeCast {\n /// @notice Cast a uint256 to a uint160, revert on overflow\n /// @param y The uint256 to be downcasted\n /// @return z The downcasted integer, now type uint160\n function toUint160(uint256 y) internal pure returns (uint160 z) {\n require((z = uint160(y)) == y);\n }\n\n /// @notice Cast a int256 to a int128, revert on overflow or underflow\n /// @param y The int256 to be downcasted\n /// @return z The downcasted integer, now type int128\n function toInt128(int256 y) internal pure returns (int128 z) {\n require((z = int128(y)) == y);\n }\n\n /// @notice Cast a uint256 to a int256, revert on overflow\n /// @param y The uint256 to be casted\n /// @return z The casted integer, now type int256\n function toInt256(uint256 y) internal pure returns (int256 z) {\n require(y < 2**255);\n z = int256(y);\n }\n}\n" }, "contracts/libraries/Tick.sol": { "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity >=0.5.0;\n\nimport './LowGasSafeMath.sol';\nimport './SafeCast.sol';\n\nimport './TickMath.sol';\nimport './LiquidityMath.sol';\n\n/// @title Tick\n/// @notice Contains functions for managing tick processes and relevant calculations\nlibrary Tick {\n using LowGasSafeMath for int256;\n using SafeCast for int256;\n\n // info stored for each initialized individual tick\n struct Info {\n // the total position liquidity that references this tick\n uint128 liquidityGross;\n // amount of net liquidity added (subtracted) when tick is crossed from left to right (right to left),\n int128 liquidityNet;\n // fee growth per unit of liquidity on the _other_ side of this tick (relative to the current tick)\n // only has relative meaning, not absolute — the value depends on when the tick is initialized\n uint256 feeGrowthOutside0X128;\n uint256 feeGrowthOutside1X128;\n // the cumulative tick value on the other side of the tick\n int56 tickCumulativeOutside;\n // the seconds per unit of liquidity on the _other_ side of this tick (relative to the current tick)\n // only has relative meaning, not absolute — the value depends on when the tick is initialized\n uint160 secondsPerLiquidityOutsideX128;\n // the seconds spent on the other side of the tick (relative to the current tick)\n // only has relative meaning, not absolute — the value depends on when the tick is initialized\n uint32 secondsOutside;\n // true iff the tick is initialized, i.e. the value is exactly equivalent to the expression liquidityGross != 0\n // these 8 bits are set to prevent fresh sstores when crossing newly initialized ticks\n bool initialized;\n }\n\n /// @notice Derives max liquidity per tick from given tick spacing\n /// @dev Executed within the pool constructor\n /// @param tickSpacing The amount of required tick separation, realized in multiples of `tickSpacing`\n /// e.g., a tickSpacing of 3 requires ticks to be initialized every 3rd tick i.e., ..., -6, -3, 0, 3, 6, ...\n /// @return The max liquidity per tick\n function tickSpacingToMaxLiquidityPerTick(int24 tickSpacing) internal pure returns (uint128) {\n int24 minTick = (TickMath.MIN_TICK / tickSpacing) * tickSpacing;\n int24 maxTick = (TickMath.MAX_TICK / tickSpacing) * tickSpacing;\n uint24 numTicks = uint24((maxTick - minTick) / tickSpacing) + 1;\n return type(uint128).max / numTicks;\n }\n\n /// @notice Retrieves fee growth data\n /// @param self The mapping containing all tick information for initialized ticks\n /// @param tickLower The lower tick boundary of the position\n /// @param tickUpper The upper tick boundary of the position\n /// @param tickCurrent The current tick\n /// @param feeGrowthGlobal0X128 The all-time global fee growth, per unit of liquidity, in token0\n /// @param feeGrowthGlobal1X128 The all-time global fee growth, per unit of liquidity, in token1\n /// @return feeGrowthInside0X128 The all-time fee growth in token0, per unit of liquidity, inside the position's tick boundaries\n /// @return feeGrowthInside1X128 The all-time fee growth in token1, per unit of liquidity, inside the position's tick boundaries\n function getFeeGrowthInside(\n mapping(int24 => Tick.Info) storage self,\n int24 tickLower,\n int24 tickUpper,\n int24 tickCurrent,\n uint256 feeGrowthGlobal0X128,\n uint256 feeGrowthGlobal1X128\n ) internal view returns (uint256 feeGrowthInside0X128, uint256 feeGrowthInside1X128) {\n Info storage lower = self[tickLower];\n Info storage upper = self[tickUpper];\n\n // calculate fee growth below\n uint256 feeGrowthBelow0X128;\n uint256 feeGrowthBelow1X128;\n if (tickCurrent >= tickLower) {\n feeGrowthBelow0X128 = lower.feeGrowthOutside0X128;\n feeGrowthBelow1X128 = lower.feeGrowthOutside1X128;\n } else {\n feeGrowthBelow0X128 = feeGrowthGlobal0X128 - lower.feeGrowthOutside0X128;\n feeGrowthBelow1X128 = feeGrowthGlobal1X128 - lower.feeGrowthOutside1X128;\n }\n\n // calculate fee growth above\n uint256 feeGrowthAbove0X128;\n uint256 feeGrowthAbove1X128;\n if (tickCurrent < tickUpper) {\n feeGrowthAbove0X128 = upper.feeGrowthOutside0X128;\n feeGrowthAbove1X128 = upper.feeGrowthOutside1X128;\n } else {\n feeGrowthAbove0X128 = feeGrowthGlobal0X128 - upper.feeGrowthOutside0X128;\n feeGrowthAbove1X128 = feeGrowthGlobal1X128 - upper.feeGrowthOutside1X128;\n }\n\n feeGrowthInside0X128 = feeGrowthGlobal0X128 - feeGrowthBelow0X128 - feeGrowthAbove0X128;\n feeGrowthInside1X128 = feeGrowthGlobal1X128 - feeGrowthBelow1X128 - feeGrowthAbove1X128;\n }\n\n /// @notice Updates a tick and returns true if the tick was flipped from initialized to uninitialized, or vice versa\n /// @param self The mapping containing all tick information for initialized ticks\n /// @param tick The tick that will be updated\n /// @param tickCurrent The current tick\n /// @param liquidityDelta A new amount of liquidity to be added (subtracted) when tick is crossed from left to right (right to left)\n /// @param feeGrowthGlobal0X128 The all-time global fee growth, per unit of liquidity, in token0\n /// @param feeGrowthGlobal1X128 The all-time global fee growth, per unit of liquidity, in token1\n /// @param secondsPerLiquidityCumulativeX128 The all-time seconds per max(1, liquidity) of the pool\n /// @param time The current block timestamp cast to a uint32\n /// @param upper true for updating a position's upper tick, or false for updating a position's lower tick\n /// @param maxLiquidity The maximum liquidity allocation for a single tick\n /// @return flipped Whether the tick was flipped from initialized to uninitialized, or vice versa\n function update(\n mapping(int24 => Tick.Info) storage self,\n int24 tick,\n int24 tickCurrent,\n int128 liquidityDelta,\n uint256 feeGrowthGlobal0X128,\n uint256 feeGrowthGlobal1X128,\n uint160 secondsPerLiquidityCumulativeX128,\n int56 tickCumulative,\n uint32 time,\n bool upper,\n uint128 maxLiquidity\n ) internal returns (bool flipped) {\n Tick.Info storage info = self[tick];\n\n uint128 liquidityGrossBefore = info.liquidityGross;\n uint128 liquidityGrossAfter = LiquidityMath.addDelta(liquidityGrossBefore, liquidityDelta);\n\n require(liquidityGrossAfter <= maxLiquidity, 'LO');\n\n flipped = (liquidityGrossAfter == 0) != (liquidityGrossBefore == 0);\n\n if (liquidityGrossBefore == 0) {\n // by convention, we assume that all growth before a tick was initialized happened _below_ the tick\n if (tick <= tickCurrent) {\n info.feeGrowthOutside0X128 = feeGrowthGlobal0X128;\n info.feeGrowthOutside1X128 = feeGrowthGlobal1X128;\n info.secondsPerLiquidityOutsideX128 = secondsPerLiquidityCumulativeX128;\n info.tickCumulativeOutside = tickCumulative;\n info.secondsOutside = time;\n }\n info.initialized = true;\n }\n\n info.liquidityGross = liquidityGrossAfter;\n\n // when the lower (upper) tick is crossed left to right (right to left), liquidity must be added (removed)\n info.liquidityNet = upper\n ? int256(info.liquidityNet).sub(liquidityDelta).toInt128()\n : int256(info.liquidityNet).add(liquidityDelta).toInt128();\n }\n\n /// @notice Clears tick data\n /// @param self The mapping containing all initialized tick information for initialized ticks\n /// @param tick The tick that will be cleared\n function clear(mapping(int24 => Tick.Info) storage self, int24 tick) internal {\n delete self[tick];\n }\n\n /// @notice Transitions to next tick as needed by price movement\n /// @param self The mapping containing all tick information for initialized ticks\n /// @param tick The destination tick of the transition\n /// @param feeGrowthGlobal0X128 The all-time global fee growth, per unit of liquidity, in token0\n /// @param feeGrowthGlobal1X128 The all-time global fee growth, per unit of liquidity, in token1\n /// @param secondsPerLiquidityCumulativeX128 The current seconds per liquidity\n /// @param time The current block.timestamp\n /// @return liquidityNet The amount of liquidity added (subtracted) when tick is crossed from left to right (right to left)\n function cross(\n mapping(int24 => Tick.Info) storage self,\n int24 tick,\n uint256 feeGrowthGlobal0X128,\n uint256 feeGrowthGlobal1X128,\n uint160 secondsPerLiquidityCumulativeX128,\n int56 tickCumulative,\n uint32 time\n ) internal returns (int128 liquidityNet) {\n Tick.Info storage info = self[tick];\n info.feeGrowthOutside0X128 = feeGrowthGlobal0X128 - info.feeGrowthOutside0X128;\n info.feeGrowthOutside1X128 = feeGrowthGlobal1X128 - info.feeGrowthOutside1X128;\n info.secondsPerLiquidityOutsideX128 = secondsPerLiquidityCumulativeX128 - info.secondsPerLiquidityOutsideX128;\n info.tickCumulativeOutside = tickCumulative - info.tickCumulativeOutside;\n info.secondsOutside = time - info.secondsOutside;\n liquidityNet = info.liquidityNet;\n }\n}\n" }, "contracts/libraries/TickBitmap.sol": { "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity >=0.5.0;\n\nimport './BitMath.sol';\n\n/// @title Packed tick initialized state library\n/// @notice Stores a packed mapping of tick index to its initialized state\n/// @dev The mapping uses int16 for keys since ticks are represented as int24 and there are 256 (2^8) values per word.\nlibrary TickBitmap {\n /// @notice Computes the position in the mapping where the initialized bit for a tick lives\n /// @param tick The tick for which to compute the position\n /// @return wordPos The key in the mapping containing the word in which the bit is stored\n /// @return bitPos The bit position in the word where the flag is stored\n function position(int24 tick) private pure returns (int16 wordPos, uint8 bitPos) {\n wordPos = int16(tick >> 8);\n bitPos = uint8(tick % 256);\n }\n\n /// @notice Flips the initialized state for a given tick from false to true, or vice versa\n /// @param self The mapping in which to flip the tick\n /// @param tick The tick to flip\n /// @param tickSpacing The spacing between usable ticks\n function flipTick(\n mapping(int16 => uint256) storage self,\n int24 tick,\n int24 tickSpacing\n ) internal {\n require(tick % tickSpacing == 0); // ensure that the tick is spaced\n (int16 wordPos, uint8 bitPos) = position(tick / tickSpacing);\n uint256 mask = 1 << bitPos;\n self[wordPos] ^= mask;\n }\n\n /// @notice Returns the next initialized tick contained in the same word (or adjacent word) as the tick that is either\n /// to the left (less than or equal to) or right (greater than) of the given tick\n /// @param self The mapping in which to compute the next initialized tick\n /// @param tick The starting tick\n /// @param tickSpacing The spacing between usable ticks\n /// @param lte Whether to search for the next initialized tick to the left (less than or equal to the starting tick)\n /// @return next The next initialized or uninitialized tick up to 256 ticks away from the current tick\n /// @return initialized Whether the next tick is initialized, as the function only searches within up to 256 ticks\n function nextInitializedTickWithinOneWord(\n mapping(int16 => uint256) storage self,\n int24 tick,\n int24 tickSpacing,\n bool lte\n ) internal view returns (int24 next, bool initialized) {\n int24 compressed = tick / tickSpacing;\n if (tick < 0 && tick % tickSpacing != 0) compressed--; // round towards negative infinity\n\n if (lte) {\n (int16 wordPos, uint8 bitPos) = position(compressed);\n // all the 1s at or to the right of the current bitPos\n uint256 mask = (1 << bitPos) - 1 + (1 << bitPos);\n uint256 masked = self[wordPos] & mask;\n\n // if there are no initialized ticks to the right of or at the current tick, return rightmost in the word\n initialized = masked != 0;\n // overflow/underflow is possible, but prevented externally by limiting both tickSpacing and tick\n next = initialized\n ? (compressed - int24(bitPos - BitMath.mostSignificantBit(masked))) * tickSpacing\n : (compressed - int24(bitPos)) * tickSpacing;\n } else {\n // start from the word of the next tick, since the current tick state doesn't matter\n (int16 wordPos, uint8 bitPos) = position(compressed + 1);\n // all the 1s at or to the left of the bitPos\n uint256 mask = ~((1 << bitPos) - 1);\n uint256 masked = self[wordPos] & mask;\n\n // if there are no initialized ticks to the left of the current tick, return leftmost in the word\n initialized = masked != 0;\n // overflow/underflow is possible, but prevented externally by limiting both tickSpacing and tick\n next = initialized\n ? (compressed + 1 + int24(BitMath.leastSignificantBit(masked) - bitPos)) * tickSpacing\n : (compressed + 1 + int24(type(uint8).max - bitPos)) * tickSpacing;\n }\n }\n}\n" }, "contracts/libraries/Position.sol": { "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity >=0.5.0;\n\nimport './FullMath.sol';\nimport './FixedPoint128.sol';\nimport './LiquidityMath.sol';\n\n/// @title Position\n/// @notice Positions represent an owner address' liquidity between a lower and upper tick boundary\n/// @dev Positions store additional state for tracking fees owed to the position\nlibrary Position {\n // info stored for each user's position\n struct Info {\n // the amount of liquidity owned by this position\n uint128 liquidity;\n // fee growth per unit of liquidity as of the last update to liquidity or fees owed\n uint256 feeGrowthInside0LastX128;\n uint256 feeGrowthInside1LastX128;\n // the fees owed to the position owner in token0/token1\n uint128 tokensOwed0;\n uint128 tokensOwed1;\n }\n\n /// @notice Returns the Info struct of a position, given an owner and position boundaries\n /// @param self The mapping containing all user positions\n /// @param owner The address of the position owner\n /// @param tickLower The lower tick boundary of the position\n /// @param tickUpper The upper tick boundary of the position\n /// @return position The position info struct of the given owners' position\n function get(\n mapping(bytes32 => Info) storage self,\n address owner,\n int24 tickLower,\n int24 tickUpper\n ) internal view returns (Position.Info storage position) {\n position = self[keccak256(abi.encodePacked(owner, tickLower, tickUpper))];\n }\n\n /// @notice Credits accumulated fees to a user's position\n /// @param self The individual position to update\n /// @param liquidityDelta The change in pool liquidity as a result of the position update\n /// @param feeGrowthInside0X128 The all-time fee growth in token0, per unit of liquidity, inside the position's tick boundaries\n /// @param feeGrowthInside1X128 The all-time fee growth in token1, per unit of liquidity, inside the position's tick boundaries\n function update(\n Info storage self,\n int128 liquidityDelta,\n uint256 feeGrowthInside0X128,\n uint256 feeGrowthInside1X128\n ) internal {\n Info memory _self = self;\n\n uint128 liquidityNext;\n if (liquidityDelta == 0) {\n require(_self.liquidity > 0, 'NP'); // disallow pokes for 0 liquidity positions\n liquidityNext = _self.liquidity;\n } else {\n liquidityNext = LiquidityMath.addDelta(_self.liquidity, liquidityDelta);\n }\n\n // calculate accumulated fees\n uint128 tokensOwed0 =\n uint128(\n FullMath.mulDiv(\n feeGrowthInside0X128 - _self.feeGrowthInside0LastX128,\n _self.liquidity,\n FixedPoint128.Q128\n )\n );\n uint128 tokensOwed1 =\n uint128(\n FullMath.mulDiv(\n feeGrowthInside1X128 - _self.feeGrowthInside1LastX128,\n _self.liquidity,\n FixedPoint128.Q128\n )\n );\n\n // update the position\n if (liquidityDelta != 0) self.liquidity = liquidityNext;\n self.feeGrowthInside0LastX128 = feeGrowthInside0X128;\n self.feeGrowthInside1LastX128 = feeGrowthInside1X128;\n if (tokensOwed0 > 0 || tokensOwed1 > 0) {\n // overflow is acceptable, have to withdraw before you hit type(uint128).max fees\n self.tokensOwed0 += tokensOwed0;\n self.tokensOwed1 += tokensOwed1;\n }\n }\n}\n" }, "contracts/libraries/Oracle.sol": { "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity >=0.5.0;\n\n/// @title Oracle\n/// @notice Provides price and liquidity data useful for a wide variety of system designs\n/// @dev Instances of stored oracle data, \"observations\", are collected in the oracle array\n/// Every pool is initialized with an oracle array length of 1. Anyone can pay the SSTOREs to increase the\n/// maximum length of the oracle array. New slots will be added when the array is fully populated.\n/// Observations are overwritten when the full length of the oracle array is populated.\n/// The most recent observation is available, independent of the length of the oracle array, by passing 0 to observe()\nlibrary Oracle {\n struct Observation {\n // the block timestamp of the observation\n uint32 blockTimestamp;\n // the tick accumulator, i.e. tick * time elapsed since the pool was first initialized\n int56 tickCumulative;\n // the seconds per liquidity, i.e. seconds elapsed / max(1, liquidity) since the pool was first initialized\n uint160 secondsPerLiquidityCumulativeX128;\n // whether or not the observation is initialized\n bool initialized;\n }\n\n /// @notice Transforms a previous observation into a new observation, given the passage of time and the current tick and liquidity values\n /// @dev blockTimestamp _must_ be chronologically equal to or greater than last.blockTimestamp, safe for 0 or 1 overflows\n /// @param last The specified observation to be transformed\n /// @param blockTimestamp The timestamp of the new observation\n /// @param tick The active tick at the time of the new observation\n /// @param liquidity The total in-range liquidity at the time of the new observation\n /// @return Observation The newly populated observation\n function transform(\n Observation memory last,\n uint32 blockTimestamp,\n int24 tick,\n uint128 liquidity\n ) private pure returns (Observation memory) {\n uint32 delta = blockTimestamp - last.blockTimestamp;\n return\n Observation({\n blockTimestamp: blockTimestamp,\n tickCumulative: last.tickCumulative + int56(tick) * delta,\n secondsPerLiquidityCumulativeX128: last.secondsPerLiquidityCumulativeX128 +\n ((uint160(delta) << 128) / (liquidity > 0 ? liquidity : 1)),\n initialized: true\n });\n }\n\n /// @notice Initialize the oracle array by writing the first slot. Called once for the lifecycle of the observations array\n /// @param self The stored oracle array\n /// @param time The time of the oracle initialization, via block.timestamp truncated to uint32\n /// @return cardinality The number of populated elements in the oracle array\n /// @return cardinalityNext The new length of the oracle array, independent of population\n function initialize(Observation[65535] storage self, uint32 time)\n internal\n returns (uint16 cardinality, uint16 cardinalityNext)\n {\n self[0] = Observation({\n blockTimestamp: time,\n tickCumulative: 0,\n secondsPerLiquidityCumulativeX128: 0,\n initialized: true\n });\n return (1, 1);\n }\n\n /// @notice Writes an oracle observation to the array\n /// @dev Writable at most once per block. Index represents the most recently written element. cardinality and index must be tracked externally.\n /// If the index is at the end of the allowable array length (according to cardinality), and the next cardinality\n /// is greater than the current one, cardinality may be increased. This restriction is created to preserve ordering.\n /// @param self The stored oracle array\n /// @param index The index of the observation that was most recently written to the observations array\n /// @param blockTimestamp The timestamp of the new observation\n /// @param tick The active tick at the time of the new observation\n /// @param liquidity The total in-range liquidity at the time of the new observation\n /// @param cardinality The number of populated elements in the oracle array\n /// @param cardinalityNext The new length of the oracle array, independent of population\n /// @return indexUpdated The new index of the most recently written element in the oracle array\n /// @return cardinalityUpdated The new cardinality of the oracle array\n function write(\n Observation[65535] storage self,\n uint16 index,\n uint32 blockTimestamp,\n int24 tick,\n uint128 liquidity,\n uint16 cardinality,\n uint16 cardinalityNext\n ) internal returns (uint16 indexUpdated, uint16 cardinalityUpdated) {\n Observation memory last = self[index];\n\n // early return if we've already written an observation this block\n if (last.blockTimestamp == blockTimestamp) return (index, cardinality);\n\n // if the conditions are right, we can bump the cardinality\n if (cardinalityNext > cardinality && index == (cardinality - 1)) {\n cardinalityUpdated = cardinalityNext;\n } else {\n cardinalityUpdated = cardinality;\n }\n\n indexUpdated = (index + 1) % cardinalityUpdated;\n self[indexUpdated] = transform(last, blockTimestamp, tick, liquidity);\n }\n\n /// @notice Prepares the oracle array to store up to `next` observations\n /// @param self The stored oracle array\n /// @param current The current next cardinality of the oracle array\n /// @param next The proposed next cardinality which will be populated in the oracle array\n /// @return next The next cardinality which will be populated in the oracle array\n function grow(\n Observation[65535] storage self,\n uint16 current,\n uint16 next\n ) internal returns (uint16) {\n require(current > 0, 'I');\n // no-op if the passed next value isn't greater than the current next value\n if (next <= current) return current;\n // store in each slot to prevent fresh SSTOREs in swaps\n // this data will not be used because the initialized boolean is still false\n for (uint16 i = current; i < next; i++) self[i].blockTimestamp = 1;\n return next;\n }\n\n /// @notice comparator for 32-bit timestamps\n /// @dev safe for 0 or 1 overflows, a and b _must_ be chronologically before or equal to time\n /// @param time A timestamp truncated to 32 bits\n /// @param a A comparison timestamp from which to determine the relative position of `time`\n /// @param b From which to determine the relative position of `time`\n /// @return bool Whether `a` is chronologically <= `b`\n function lte(\n uint32 time,\n uint32 a,\n uint32 b\n ) private pure returns (bool) {\n // if there hasn't been overflow, no need to adjust\n if (a <= time && b <= time) return a <= b;\n\n uint256 aAdjusted = a > time ? a : a + 2**32;\n uint256 bAdjusted = b > time ? b : b + 2**32;\n\n return aAdjusted <= bAdjusted;\n }\n\n /// @notice Fetches the observations beforeOrAt and atOrAfter a target, i.e. where [beforeOrAt, atOrAfter] is satisfied.\n /// The result may be the same observation, or adjacent observations.\n /// @dev The answer must be contained in the array, used when the target is located within the stored observation\n /// boundaries: older than the most recent observation and younger, or the same age as, the oldest observation\n /// @param self The stored oracle array\n /// @param time The current block.timestamp\n /// @param target The timestamp at which the reserved observation should be for\n /// @param index The index of the observation that was most recently written to the observations array\n /// @param cardinality The number of populated elements in the oracle array\n /// @return beforeOrAt The observation recorded before, or at, the target\n /// @return atOrAfter The observation recorded at, or after, the target\n function binarySearch(\n Observation[65535] storage self,\n uint32 time,\n uint32 target,\n uint16 index,\n uint16 cardinality\n ) private view returns (Observation memory beforeOrAt, Observation memory atOrAfter) {\n uint256 l = (index + 1) % cardinality; // oldest observation\n uint256 r = l + cardinality - 1; // newest observation\n uint256 i;\n while (true) {\n i = (l + r) / 2;\n\n beforeOrAt = self[i % cardinality];\n\n // we've landed on an uninitialized tick, keep searching higher (more recently)\n if (!beforeOrAt.initialized) {\n l = i + 1;\n continue;\n }\n\n atOrAfter = self[(i + 1) % cardinality];\n\n bool targetAtOrAfter = lte(time, beforeOrAt.blockTimestamp, target);\n\n // check if we've found the answer!\n if (targetAtOrAfter && lte(time, target, atOrAfter.blockTimestamp)) break;\n\n if (!targetAtOrAfter) r = i - 1;\n else l = i + 1;\n }\n }\n\n /// @notice Fetches the observations beforeOrAt and atOrAfter a given target, i.e. where [beforeOrAt, atOrAfter] is satisfied\n /// @dev Assumes there is at least 1 initialized observation.\n /// Used by observeSingle() to compute the counterfactual accumulator values as of a given block timestamp.\n /// @param self The stored oracle array\n /// @param time The current block.timestamp\n /// @param target The timestamp at which the reserved observation should be for\n /// @param tick The active tick at the time of the returned or simulated observation\n /// @param index The index of the observation that was most recently written to the observations array\n /// @param liquidity The total pool liquidity at the time of the call\n /// @param cardinality The number of populated elements in the oracle array\n /// @return beforeOrAt The observation which occurred at, or before, the given timestamp\n /// @return atOrAfter The observation which occurred at, or after, the given timestamp\n function getSurroundingObservations(\n Observation[65535] storage self,\n uint32 time,\n uint32 target,\n int24 tick,\n uint16 index,\n uint128 liquidity,\n uint16 cardinality\n ) private view returns (Observation memory beforeOrAt, Observation memory atOrAfter) {\n // optimistically set before to the newest observation\n beforeOrAt = self[index];\n\n // if the target is chronologically at or after the newest observation, we can early return\n if (lte(time, beforeOrAt.blockTimestamp, target)) {\n if (beforeOrAt.blockTimestamp == target) {\n // if newest observation equals target, we're in the same block, so we can ignore atOrAfter\n return (beforeOrAt, atOrAfter);\n } else {\n // otherwise, we need to transform\n return (beforeOrAt, transform(beforeOrAt, target, tick, liquidity));\n }\n }\n\n // now, set before to the oldest observation\n beforeOrAt = self[(index + 1) % cardinality];\n if (!beforeOrAt.initialized) beforeOrAt = self[0];\n\n // ensure that the target is chronologically at or after the oldest observation\n require(lte(time, beforeOrAt.blockTimestamp, target), 'OLD');\n\n // if we've reached this point, we have to binary search\n return binarySearch(self, time, target, index, cardinality);\n }\n\n /// @dev Reverts if an observation at or before the desired observation timestamp does not exist.\n /// 0 may be passed as `secondsAgo' to return the current cumulative values.\n /// If called with a timestamp falling between two observations, returns the counterfactual accumulator values\n /// at exactly the timestamp between the two observations.\n /// @param self The stored oracle array\n /// @param time The current block timestamp\n /// @param secondsAgo The amount of time to look back, in seconds, at which point to return an observation\n /// @param tick The current tick\n /// @param index The index of the observation that was most recently written to the observations array\n /// @param liquidity The current in-range pool liquidity\n /// @param cardinality The number of populated elements in the oracle array\n /// @return tickCumulative The tick * time elapsed since the pool was first initialized, as of `secondsAgo`\n /// @return secondsPerLiquidityCumulativeX128 The time elapsed / max(1, liquidity) since the pool was first initialized, as of `secondsAgo`\n function observeSingle(\n Observation[65535] storage self,\n uint32 time,\n uint32 secondsAgo,\n int24 tick,\n uint16 index,\n uint128 liquidity,\n uint16 cardinality\n ) internal view returns (int56 tickCumulative, uint160 secondsPerLiquidityCumulativeX128) {\n if (secondsAgo == 0) {\n Observation memory last = self[index];\n if (last.blockTimestamp != time) last = transform(last, time, tick, liquidity);\n return (last.tickCumulative, last.secondsPerLiquidityCumulativeX128);\n }\n\n uint32 target = time - secondsAgo;\n\n (Observation memory beforeOrAt, Observation memory atOrAfter) =\n getSurroundingObservations(self, time, target, tick, index, liquidity, cardinality);\n\n if (target == beforeOrAt.blockTimestamp) {\n // we're at the left boundary\n return (beforeOrAt.tickCumulative, beforeOrAt.secondsPerLiquidityCumulativeX128);\n } else if (target == atOrAfter.blockTimestamp) {\n // we're at the right boundary\n return (atOrAfter.tickCumulative, atOrAfter.secondsPerLiquidityCumulativeX128);\n } else {\n // we're in the middle\n uint32 observationTimeDelta = atOrAfter.blockTimestamp - beforeOrAt.blockTimestamp;\n uint32 targetDelta = target - beforeOrAt.blockTimestamp;\n return (\n beforeOrAt.tickCumulative +\n ((atOrAfter.tickCumulative - beforeOrAt.tickCumulative) / observationTimeDelta) *\n targetDelta,\n beforeOrAt.secondsPerLiquidityCumulativeX128 +\n uint160(\n (uint256(\n atOrAfter.secondsPerLiquidityCumulativeX128 - beforeOrAt.secondsPerLiquidityCumulativeX128\n ) * targetDelta) / observationTimeDelta\n )\n );\n }\n }\n\n /// @notice Returns the accumulator values as of each time seconds ago from the given time in the array of `secondsAgos`\n /// @dev Reverts if `secondsAgos` > oldest observation\n /// @param self The stored oracle array\n /// @param time The current block.timestamp\n /// @param secondsAgos Each amount of time to look back, in seconds, at which point to return an observation\n /// @param tick The current tick\n /// @param index The index of the observation that was most recently written to the observations array\n /// @param liquidity The current in-range pool liquidity\n /// @param cardinality The number of populated elements in the oracle array\n /// @return tickCumulatives The tick * time elapsed since the pool was first initialized, as of each `secondsAgo`\n /// @return secondsPerLiquidityCumulativeX128s The cumulative seconds / max(1, liquidity) since the pool was first initialized, as of each `secondsAgo`\n function observe(\n Observation[65535] storage self,\n uint32 time,\n uint32[] memory secondsAgos,\n int24 tick,\n uint16 index,\n uint128 liquidity,\n uint16 cardinality\n ) internal view returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s) {\n require(cardinality > 0, 'I');\n\n tickCumulatives = new int56[](secondsAgos.length);\n secondsPerLiquidityCumulativeX128s = new uint160[](secondsAgos.length);\n for (uint256 i = 0; i < secondsAgos.length; i++) {\n (tickCumulatives[i], secondsPerLiquidityCumulativeX128s[i]) = observeSingle(\n self,\n time,\n secondsAgos[i],\n tick,\n index,\n liquidity,\n cardinality\n );\n }\n }\n}\n" }, "contracts/libraries/FullMath.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.4.0;\n\n/// @title Contains 512-bit math functions\n/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\n/// @dev Handles \"phantom overflow\" i.e., allows multiplication and division where an intermediate value overflows 256 bits\nlibrary FullMath {\n /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv\n function mulDiv(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n // 512-bit multiply [prod1 prod0] = a * b\n // Compute the product mod 2**256 and mod 2**256 - 1\n // then use the Chinese Remainder Theorem to reconstruct\n // the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2**256 + prod0\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(a, b, not(0))\n prod0 := mul(a, b)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division\n if (prod1 == 0) {\n require(denominator > 0);\n assembly {\n result := div(prod0, denominator)\n }\n return result;\n }\n\n // Make sure the result is less than 2**256.\n // Also prevents denominator == 0\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0]\n // Compute remainder using mulmod\n uint256 remainder;\n assembly {\n remainder := mulmod(a, b, denominator)\n }\n // Subtract 256 bit number from 512 bit number\n assembly {\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator\n // Compute largest power of two divisor of denominator.\n // Always >= 1.\n uint256 twos = -denominator & denominator;\n // Divide denominator by power of two\n assembly {\n denominator := div(denominator, twos)\n }\n\n // Divide [prod1 prod0] by the factors of two\n assembly {\n prod0 := div(prod0, twos)\n }\n // Shift in bits from prod1 into prod0. For this we need\n // to flip `twos` such that it is 2**256 / twos.\n // If twos is zero, then it becomes one\n assembly {\n twos := add(div(sub(0, twos), twos), 1)\n }\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2**256\n // Now that denominator is an odd number, it has an inverse\n // modulo 2**256 such that denominator * inv = 1 mod 2**256.\n // Compute the inverse by starting with a seed that is correct\n // correct for four bits. That is, denominator * inv = 1 mod 2**4\n uint256 inv = (3 * denominator) ^ 2;\n // Now use Newton-Raphson iteration to improve the precision.\n // Thanks to Hensel's lifting lemma, this also works in modular\n // arithmetic, doubling the correct bits in each step.\n inv *= 2 - denominator * inv; // inverse mod 2**8\n inv *= 2 - denominator * inv; // inverse mod 2**16\n inv *= 2 - denominator * inv; // inverse mod 2**32\n inv *= 2 - denominator * inv; // inverse mod 2**64\n inv *= 2 - denominator * inv; // inverse mod 2**128\n inv *= 2 - denominator * inv; // inverse mod 2**256\n\n // Because the division is now exact we can divide by multiplying\n // with the modular inverse of denominator. This will give us the\n // correct result modulo 2**256. Since the precoditions guarantee\n // that the outcome is less than 2**256, this is the final result.\n // We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inv;\n return result;\n }\n\n /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n function mulDivRoundingUp(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n result = mulDiv(a, b, denominator);\n if (mulmod(a, b, denominator) > 0) {\n require(result < type(uint256).max);\n result++;\n }\n }\n}\n" }, "contracts/libraries/FixedPoint128.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.4.0;\n\n/// @title FixedPoint128\n/// @notice A library for handling binary fixed point numbers, see https://en.wikipedia.org/wiki/Q_(number_format)\nlibrary FixedPoint128 {\n uint256 internal constant Q128 = 0x100000000000000000000000000000000;\n}\n" }, "contracts/libraries/TransferHelper.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.6.0;\n\nimport '../interfaces/IERC20Minimal.sol';\n\n/// @title TransferHelper\n/// @notice Contains helper methods for interacting with ERC20 tokens that do not consistently return true/false\nlibrary TransferHelper {\n /// @notice Transfers tokens from msg.sender to a recipient\n /// @dev Calls transfer on token contract, errors with TF if transfer fails\n /// @param token The contract address of the token which will be transferred\n /// @param to The recipient of the transfer\n /// @param value The value of the transfer\n function safeTransfer(\n address token,\n address to,\n uint256 value\n ) internal {\n (bool success, bytes memory data) =\n token.call(abi.encodeWithSelector(IERC20Minimal.transfer.selector, to, value));\n require(success && (data.length == 0 || abi.decode(data, (bool))), 'TF');\n }\n}\n" }, "contracts/libraries/TickMath.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Math library for computing sqrt prices from ticks and vice versa\n/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports\n/// prices between 2**-128 and 2**128\nlibrary TickMath {\n /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128\n int24 internal constant MIN_TICK = -887272;\n /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128\n int24 internal constant MAX_TICK = -MIN_TICK;\n\n /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)\n uint160 internal constant MIN_SQRT_RATIO = 4295128739;\n /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)\n uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;\n\n /// @notice Calculates sqrt(1.0001^tick) * 2^96\n /// @dev Throws if |tick| > max tick\n /// @param tick The input tick for the above formula\n /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the given tick\n function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {\n uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));\n require(absTick <= uint256(MAX_TICK), 'T');\n\n uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;\n if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;\n if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;\n if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;\n if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;\n if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;\n if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;\n if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;\n if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;\n if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;\n if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;\n if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;\n if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;\n if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;\n if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;\n if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;\n if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;\n if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;\n if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;\n if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;\n\n if (tick > 0) ratio = type(uint256).max / ratio;\n\n // this divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.\n // we then downcast because we know the result always fits within 160 bits due to our tick input constraint\n // we round up in the division so getTickAtSqrtRatio of the output price is always consistent\n sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));\n }\n\n /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio\n /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may\n /// ever return.\n /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96\n /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio\n function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {\n // second inequality must be < because the price can never reach the price at the max tick\n require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R');\n uint256 ratio = uint256(sqrtPriceX96) << 32;\n\n uint256 r = ratio;\n uint256 msb = 0;\n\n assembly {\n let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(5, gt(r, 0xFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(4, gt(r, 0xFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(3, gt(r, 0xFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(2, gt(r, 0xF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(1, gt(r, 0x3))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := gt(r, 0x1)\n msb := or(msb, f)\n }\n\n if (msb >= 128) r = ratio >> (msb - 127);\n else r = ratio << (127 - msb);\n\n int256 log_2 = (int256(msb) - 128) << 64;\n\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(63, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(62, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(61, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(60, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(59, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(58, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(57, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(56, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(55, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(54, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(53, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(52, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(51, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(50, f))\n }\n\n int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number\n\n int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);\n int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);\n\n tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;\n }\n}\n" }, "contracts/libraries/LiquidityMath.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Math library for liquidity\nlibrary LiquidityMath {\n /// @notice Add a signed liquidity delta to liquidity and revert if it overflows or underflows\n /// @param x The liquidity before change\n /// @param y The delta by which liquidity should be changed\n /// @return z The liquidity delta\n function addDelta(uint128 x, int128 y) internal pure returns (uint128 z) {\n if (y < 0) {\n require((z = x - uint128(-y)) < x, 'LS');\n } else {\n require((z = x + uint128(y)) >= x, 'LA');\n }\n }\n}\n" }, "contracts/libraries/SqrtPriceMath.sol": { "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity >=0.5.0;\n\nimport './LowGasSafeMath.sol';\nimport './SafeCast.sol';\n\nimport './FullMath.sol';\nimport './UnsafeMath.sol';\nimport './FixedPoint96.sol';\n\n/// @title Functions based on Q64.96 sqrt price and liquidity\n/// @notice Contains the math that uses square root of price as a Q64.96 and liquidity to compute deltas\nlibrary SqrtPriceMath {\n using LowGasSafeMath for uint256;\n using SafeCast for uint256;\n\n /// @notice Gets the next sqrt price given a delta of token0\n /// @dev Always rounds up, because in the exact output case (increasing price) we need to move the price at least\n /// far enough to get the desired output amount, and in the exact input case (decreasing price) we need to move the\n /// price less in order to not send too much output.\n /// The most precise formula for this is liquidity * sqrtPX96 / (liquidity +- amount * sqrtPX96),\n /// if this is impossible because of overflow, we calculate liquidity / (liquidity / sqrtPX96 +- amount).\n /// @param sqrtPX96 The starting price, i.e. before accounting for the token0 delta\n /// @param liquidity The amount of usable liquidity\n /// @param amount How much of token0 to add or remove from virtual reserves\n /// @param add Whether to add or remove the amount of token0\n /// @return The price after adding or removing amount, depending on add\n function getNextSqrtPriceFromAmount0RoundingUp(\n uint160 sqrtPX96,\n uint128 liquidity,\n uint256 amount,\n bool add\n ) internal pure returns (uint160) {\n // we short circuit amount == 0 because the result is otherwise not guaranteed to equal the input price\n if (amount == 0) return sqrtPX96;\n uint256 numerator1 = uint256(liquidity) << FixedPoint96.RESOLUTION;\n\n if (add) {\n uint256 product;\n if ((product = amount * sqrtPX96) / amount == sqrtPX96) {\n uint256 denominator = numerator1 + product;\n if (denominator >= numerator1)\n // always fits in 160 bits\n return uint160(FullMath.mulDivRoundingUp(numerator1, sqrtPX96, denominator));\n }\n\n return uint160(UnsafeMath.divRoundingUp(numerator1, (numerator1 / sqrtPX96).add(amount)));\n } else {\n uint256 product;\n // if the product overflows, we know the denominator underflows\n // in addition, we must check that the denominator does not underflow\n require((product = amount * sqrtPX96) / amount == sqrtPX96 && numerator1 > product);\n uint256 denominator = numerator1 - product;\n return FullMath.mulDivRoundingUp(numerator1, sqrtPX96, denominator).toUint160();\n }\n }\n\n /// @notice Gets the next sqrt price given a delta of token1\n /// @dev Always rounds down, because in the exact output case (decreasing price) we need to move the price at least\n /// far enough to get the desired output amount, and in the exact input case (increasing price) we need to move the\n /// price less in order to not send too much output.\n /// The formula we compute is within <1 wei of the lossless version: sqrtPX96 +- amount / liquidity\n /// @param sqrtPX96 The starting price, i.e., before accounting for the token1 delta\n /// @param liquidity The amount of usable liquidity\n /// @param amount How much of token1 to add, or remove, from virtual reserves\n /// @param add Whether to add, or remove, the amount of token1\n /// @return The price after adding or removing `amount`\n function getNextSqrtPriceFromAmount1RoundingDown(\n uint160 sqrtPX96,\n uint128 liquidity,\n uint256 amount,\n bool add\n ) internal pure returns (uint160) {\n // if we're adding (subtracting), rounding down requires rounding the quotient down (up)\n // in both cases, avoid a mulDiv for most inputs\n if (add) {\n uint256 quotient =\n (\n amount <= type(uint160).max\n ? (amount << FixedPoint96.RESOLUTION) / liquidity\n : FullMath.mulDiv(amount, FixedPoint96.Q96, liquidity)\n );\n\n return uint256(sqrtPX96).add(quotient).toUint160();\n } else {\n uint256 quotient =\n (\n amount <= type(uint160).max\n ? UnsafeMath.divRoundingUp(amount << FixedPoint96.RESOLUTION, liquidity)\n : FullMath.mulDivRoundingUp(amount, FixedPoint96.Q96, liquidity)\n );\n\n require(sqrtPX96 > quotient);\n // always fits 160 bits\n return uint160(sqrtPX96 - quotient);\n }\n }\n\n /// @notice Gets the next sqrt price given an input amount of token0 or token1\n /// @dev Throws if price or liquidity are 0, or if the next price is out of bounds\n /// @param sqrtPX96 The starting price, i.e., before accounting for the input amount\n /// @param liquidity The amount of usable liquidity\n /// @param amountIn How much of token0, or token1, is being swapped in\n /// @param zeroForOne Whether the amount in is token0 or token1\n /// @return sqrtQX96 The price after adding the input amount to token0 or token1\n function getNextSqrtPriceFromInput(\n uint160 sqrtPX96,\n uint128 liquidity,\n uint256 amountIn,\n bool zeroForOne\n ) internal pure returns (uint160 sqrtQX96) {\n require(sqrtPX96 > 0);\n require(liquidity > 0);\n\n // round to make sure that we don't pass the target price\n return\n zeroForOne\n ? getNextSqrtPriceFromAmount0RoundingUp(sqrtPX96, liquidity, amountIn, true)\n : getNextSqrtPriceFromAmount1RoundingDown(sqrtPX96, liquidity, amountIn, true);\n }\n\n /// @notice Gets the next sqrt price given an output amount of token0 or token1\n /// @dev Throws if price or liquidity are 0 or the next price is out of bounds\n /// @param sqrtPX96 The starting price before accounting for the output amount\n /// @param liquidity The amount of usable liquidity\n /// @param amountOut How much of token0, or token1, is being swapped out\n /// @param zeroForOne Whether the amount out is token0 or token1\n /// @return sqrtQX96 The price after removing the output amount of token0 or token1\n function getNextSqrtPriceFromOutput(\n uint160 sqrtPX96,\n uint128 liquidity,\n uint256 amountOut,\n bool zeroForOne\n ) internal pure returns (uint160 sqrtQX96) {\n require(sqrtPX96 > 0);\n require(liquidity > 0);\n\n // round to make sure that we pass the target price\n return\n zeroForOne\n ? getNextSqrtPriceFromAmount1RoundingDown(sqrtPX96, liquidity, amountOut, false)\n : getNextSqrtPriceFromAmount0RoundingUp(sqrtPX96, liquidity, amountOut, false);\n }\n\n /// @notice Gets the amount0 delta between two prices\n /// @dev Calculates liquidity / sqrt(lower) - liquidity / sqrt(upper),\n /// i.e. liquidity * (sqrt(upper) - sqrt(lower)) / (sqrt(upper) * sqrt(lower))\n /// @param sqrtRatioAX96 A sqrt price\n /// @param sqrtRatioBX96 Another sqrt price\n /// @param liquidity The amount of usable liquidity\n /// @param roundUp Whether to round the amount up or down\n /// @return amount0 Amount of token0 required to cover a position of size liquidity between the two passed prices\n function getAmount0Delta(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity,\n bool roundUp\n ) internal pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n uint256 numerator1 = uint256(liquidity) << FixedPoint96.RESOLUTION;\n uint256 numerator2 = sqrtRatioBX96 - sqrtRatioAX96;\n\n require(sqrtRatioAX96 > 0);\n\n return\n roundUp\n ? UnsafeMath.divRoundingUp(\n FullMath.mulDivRoundingUp(numerator1, numerator2, sqrtRatioBX96),\n sqrtRatioAX96\n )\n : FullMath.mulDiv(numerator1, numerator2, sqrtRatioBX96) / sqrtRatioAX96;\n }\n\n /// @notice Gets the amount1 delta between two prices\n /// @dev Calculates liquidity * (sqrt(upper) - sqrt(lower))\n /// @param sqrtRatioAX96 A sqrt price\n /// @param sqrtRatioBX96 Another sqrt price\n /// @param liquidity The amount of usable liquidity\n /// @param roundUp Whether to round the amount up, or down\n /// @return amount1 Amount of token1 required to cover a position of size liquidity between the two passed prices\n function getAmount1Delta(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity,\n bool roundUp\n ) internal pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return\n roundUp\n ? FullMath.mulDivRoundingUp(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96)\n : FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n /// @notice Helper that gets signed token0 delta\n /// @param sqrtRatioAX96 A sqrt price\n /// @param sqrtRatioBX96 Another sqrt price\n /// @param liquidity The change in liquidity for which to compute the amount0 delta\n /// @return amount0 Amount of token0 corresponding to the passed liquidityDelta between the two prices\n function getAmount0Delta(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n int128 liquidity\n ) internal pure returns (int256 amount0) {\n return\n liquidity < 0\n ? -getAmount0Delta(sqrtRatioAX96, sqrtRatioBX96, uint128(-liquidity), false).toInt256()\n : getAmount0Delta(sqrtRatioAX96, sqrtRatioBX96, uint128(liquidity), true).toInt256();\n }\n\n /// @notice Helper that gets signed token1 delta\n /// @param sqrtRatioAX96 A sqrt price\n /// @param sqrtRatioBX96 Another sqrt price\n /// @param liquidity The change in liquidity for which to compute the amount1 delta\n /// @return amount1 Amount of token1 corresponding to the passed liquidityDelta between the two prices\n function getAmount1Delta(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n int128 liquidity\n ) internal pure returns (int256 amount1) {\n return\n liquidity < 0\n ? -getAmount1Delta(sqrtRatioAX96, sqrtRatioBX96, uint128(-liquidity), false).toInt256()\n : getAmount1Delta(sqrtRatioAX96, sqrtRatioBX96, uint128(liquidity), true).toInt256();\n }\n}\n" }, "contracts/libraries/SwapMath.sol": { "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity >=0.5.0;\n\nimport './FullMath.sol';\nimport './SqrtPriceMath.sol';\n\n/// @title Computes the result of a swap within ticks\n/// @notice Contains methods for computing the result of a swap within a single tick price range, i.e., a single tick.\nlibrary SwapMath {\n /// @notice Computes the result of swapping some amount in, or amount out, given the parameters of the swap\n /// @dev The fee, plus the amount in, will never exceed the amount remaining if the swap's `amountSpecified` is positive\n /// @param sqrtRatioCurrentX96 The current sqrt price of the pool\n /// @param sqrtRatioTargetX96 The price that cannot be exceeded, from which the direction of the swap is inferred\n /// @param liquidity The usable liquidity\n /// @param amountRemaining How much input or output amount is remaining to be swapped in/out\n /// @param feePips The fee taken from the input amount, expressed in hundredths of a bip\n /// @return sqrtRatioNextX96 The price after swapping the amount in/out, not to exceed the price target\n /// @return amountIn The amount to be swapped in, of either token0 or token1, based on the direction of the swap\n /// @return amountOut The amount to be received, of either token0 or token1, based on the direction of the swap\n /// @return feeAmount The amount of input that will be taken as a fee\n function computeSwapStep(\n uint160 sqrtRatioCurrentX96,\n uint160 sqrtRatioTargetX96,\n uint128 liquidity,\n int256 amountRemaining,\n uint24 feePips\n )\n internal\n pure\n returns (\n uint160 sqrtRatioNextX96,\n uint256 amountIn,\n uint256 amountOut,\n uint256 feeAmount\n )\n {\n bool zeroForOne = sqrtRatioCurrentX96 >= sqrtRatioTargetX96;\n bool exactIn = amountRemaining >= 0;\n\n if (exactIn) {\n uint256 amountRemainingLessFee = FullMath.mulDiv(uint256(amountRemaining), 1e6 - feePips, 1e6);\n amountIn = zeroForOne\n ? SqrtPriceMath.getAmount0Delta(sqrtRatioTargetX96, sqrtRatioCurrentX96, liquidity, true)\n : SqrtPriceMath.getAmount1Delta(sqrtRatioCurrentX96, sqrtRatioTargetX96, liquidity, true);\n if (amountRemainingLessFee >= amountIn) sqrtRatioNextX96 = sqrtRatioTargetX96;\n else\n sqrtRatioNextX96 = SqrtPriceMath.getNextSqrtPriceFromInput(\n sqrtRatioCurrentX96,\n liquidity,\n amountRemainingLessFee,\n zeroForOne\n );\n } else {\n amountOut = zeroForOne\n ? SqrtPriceMath.getAmount1Delta(sqrtRatioTargetX96, sqrtRatioCurrentX96, liquidity, false)\n : SqrtPriceMath.getAmount0Delta(sqrtRatioCurrentX96, sqrtRatioTargetX96, liquidity, false);\n if (uint256(-amountRemaining) >= amountOut) sqrtRatioNextX96 = sqrtRatioTargetX96;\n else\n sqrtRatioNextX96 = SqrtPriceMath.getNextSqrtPriceFromOutput(\n sqrtRatioCurrentX96,\n liquidity,\n uint256(-amountRemaining),\n zeroForOne\n );\n }\n\n bool max = sqrtRatioTargetX96 == sqrtRatioNextX96;\n\n // get the input/output amounts\n if (zeroForOne) {\n amountIn = max && exactIn\n ? amountIn\n : SqrtPriceMath.getAmount0Delta(sqrtRatioNextX96, sqrtRatioCurrentX96, liquidity, true);\n amountOut = max && !exactIn\n ? amountOut\n : SqrtPriceMath.getAmount1Delta(sqrtRatioNextX96, sqrtRatioCurrentX96, liquidity, false);\n } else {\n amountIn = max && exactIn\n ? amountIn\n : SqrtPriceMath.getAmount1Delta(sqrtRatioCurrentX96, sqrtRatioNextX96, liquidity, true);\n amountOut = max && !exactIn\n ? amountOut\n : SqrtPriceMath.getAmount0Delta(sqrtRatioCurrentX96, sqrtRatioNextX96, liquidity, false);\n }\n\n // cap the output amount to not exceed the remaining output amount\n if (!exactIn && amountOut > uint256(-amountRemaining)) {\n amountOut = uint256(-amountRemaining);\n }\n\n if (exactIn && sqrtRatioNextX96 != sqrtRatioTargetX96) {\n // we didn't reach the target, so take the remainder of the maximum input as fee\n feeAmount = uint256(amountRemaining) - amountIn;\n } else {\n feeAmount = FullMath.mulDivRoundingUp(amountIn, feePips, 1e6 - feePips);\n }\n }\n}\n" }, "contracts/interfaces/IUniswapV3PoolDeployer.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title An interface for a contract that is capable of deploying Uniswap V3 Pools\n/// @notice A contract that constructs a pool must implement this to pass arguments to the pool\n/// @dev This is used to avoid having constructor arguments in the pool contract, which results in the init code hash\n/// of the pool being constant allowing the CREATE2 address of the pool to be cheaply computed on-chain\ninterface IUniswapV3PoolDeployer {\n /// @notice Get the parameters to be used in constructing the pool, set transiently during pool creation.\n /// @dev Called by the pool constructor to fetch the parameters of the pool\n /// Returns factory The factory address\n /// Returns token0 The first token of the pool by address sort order\n /// Returns token1 The second token of the pool by address sort order\n /// Returns fee The fee collected upon every swap in the pool, denominated in hundredths of a bip\n /// Returns tickSpacing The minimum number of ticks between initialized ticks\n function parameters()\n external\n view\n returns (\n address factory,\n address token0,\n address token1,\n uint24 fee,\n int24 tickSpacing\n );\n}\n" }, "contracts/interfaces/IUniswapV3Factory.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title The interface for the Uniswap V3 Factory\n/// @notice The Uniswap V3 Factory facilitates creation of Uniswap V3 pools and control over the protocol fees\ninterface IUniswapV3Factory {\n /// @notice Emitted when the owner of the factory is changed\n /// @param oldOwner The owner before the owner was changed\n /// @param newOwner The owner after the owner was changed\n event OwnerChanged(address indexed oldOwner, address indexed newOwner);\n\n /// @notice Emitted when a pool is created\n /// @param token0 The first token of the pool by address sort order\n /// @param token1 The second token of the pool by address sort order\n /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip\n /// @param tickSpacing The minimum number of ticks between initialized ticks\n /// @param pool The address of the created pool\n event PoolCreated(\n address indexed token0,\n address indexed token1,\n uint24 indexed fee,\n int24 tickSpacing,\n address pool\n );\n\n /// @notice Emitted when a new fee amount is enabled for pool creation via the factory\n /// @param fee The enabled fee, denominated in hundredths of a bip\n /// @param tickSpacing The minimum number of ticks between initialized ticks for pools created with the given fee\n event FeeAmountEnabled(uint24 indexed fee, int24 indexed tickSpacing);\n\n /// @notice Returns the current owner of the factory\n /// @dev Can be changed by the current owner via setOwner\n /// @return The address of the factory owner\n function owner() external view returns (address);\n\n /// @notice Returns the tick spacing for a given fee amount, if enabled, or 0 if not enabled\n /// @dev A fee amount can never be removed, so this value should be hard coded or cached in the calling context\n /// @param fee The enabled fee, denominated in hundredths of a bip. Returns 0 in case of unenabled fee\n /// @return The tick spacing\n function feeAmountTickSpacing(uint24 fee) external view returns (int24);\n\n /// @notice Returns the pool address for a given pair of tokens and a fee, or address 0 if it does not exist\n /// @dev tokenA and tokenB may be passed in either token0/token1 or token1/token0 order\n /// @param tokenA The contract address of either token0 or token1\n /// @param tokenB The contract address of the other token\n /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip\n /// @return pool The pool address\n function getPool(\n address tokenA,\n address tokenB,\n uint24 fee\n ) external view returns (address pool);\n\n /// @notice Creates a pool for the given two tokens and fee\n /// @param tokenA One of the two tokens in the desired pool\n /// @param tokenB The other of the two tokens in the desired pool\n /// @param fee The desired fee for the pool\n /// @dev tokenA and tokenB may be passed in either order: token0/token1 or token1/token0. tickSpacing is retrieved\n /// from the fee. The call will revert if the pool already exists, the fee is invalid, or the token arguments\n /// are invalid.\n /// @return pool The address of the newly created pool\n function createPool(\n address tokenA,\n address tokenB,\n uint24 fee\n ) external returns (address pool);\n\n /// @notice Updates the owner of the factory\n /// @dev Must be called by the current owner\n /// @param _owner The new owner of the factory\n function setOwner(address _owner) external;\n\n /// @notice Enables a fee amount with the given tickSpacing\n /// @dev Fee amounts may never be removed once enabled\n /// @param fee The fee amount to enable, denominated in hundredths of a bip (i.e. 1e-6)\n /// @param tickSpacing The spacing between ticks to be enforced for all pools created with the given fee amount\n function enableFeeAmount(uint24 fee, int24 tickSpacing) external;\n}\n" }, "contracts/interfaces/IERC20Minimal.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Minimal ERC20 interface for Uniswap\n/// @notice Contains a subset of the full ERC20 interface that is used in Uniswap V3\ninterface IERC20Minimal {\n /// @notice Returns the balance of a token\n /// @param account The account for which to look up the number of tokens it has, i.e. its balance\n /// @return The number of tokens held by the account\n function balanceOf(address account) external view returns (uint256);\n\n /// @notice Transfers the amount of token from the `msg.sender` to the recipient\n /// @param recipient The account that will receive the amount transferred\n /// @param amount The number of tokens to send from the sender to the recipient\n /// @return Returns true for a successful transfer, false for an unsuccessful transfer\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /// @notice Returns the current allowance given to a spender by an owner\n /// @param owner The account of the token owner\n /// @param spender The account of the token spender\n /// @return The current allowance granted by `owner` to `spender`\n function allowance(address owner, address spender) external view returns (uint256);\n\n /// @notice Sets the allowance of a spender from the `msg.sender` to the value `amount`\n /// @param spender The account which will be allowed to spend a given amount of the owners tokens\n /// @param amount The amount of tokens allowed to be used by `spender`\n /// @return Returns true for a successful approval, false for unsuccessful\n function approve(address spender, uint256 amount) external returns (bool);\n\n /// @notice Transfers `amount` tokens from `sender` to `recipient` up to the allowance given to the `msg.sender`\n /// @param sender The account from which the transfer will be initiated\n /// @param recipient The recipient of the transfer\n /// @param amount The amount of the transfer\n /// @return Returns true for a successful transfer, false for unsuccessful\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /// @notice Event emitted when tokens are transferred from one address to another, either via `#transfer` or `#transferFrom`.\n /// @param from The account from which the tokens were sent, i.e. the balance decreased\n /// @param to The account to which the tokens were sent, i.e. the balance increased\n /// @param value The amount of tokens that were transferred\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /// @notice Event emitted when the approval amount for the spender of a given owner's tokens changes.\n /// @param owner The account that approved spending of its tokens\n /// @param spender The account for which the spending allowance was modified\n /// @param value The new allowance from the owner to the spender\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" }, "contracts/interfaces/callback/IUniswapV3MintCallback.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Callback for IUniswapV3PoolActions#mint\n/// @notice Any contract that calls IUniswapV3PoolActions#mint must implement this interface\ninterface IUniswapV3MintCallback {\n /// @notice Called to `msg.sender` after minting liquidity to a position from IUniswapV3Pool#mint.\n /// @dev In the implementation you must pay the pool tokens owed for the minted liquidity.\n /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.\n /// @param amount0Owed The amount of token0 due to the pool for the minted liquidity\n /// @param amount1Owed The amount of token1 due to the pool for the minted liquidity\n /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#mint call\n function uniswapV3MintCallback(\n uint256 amount0Owed,\n uint256 amount1Owed,\n bytes calldata data\n ) external;\n}\n" }, "contracts/interfaces/callback/IUniswapV3SwapCallback.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Callback for IUniswapV3PoolActions#swap\n/// @notice Any contract that calls IUniswapV3PoolActions#swap must implement this interface\ninterface IUniswapV3SwapCallback {\n /// @notice Called to `msg.sender` after executing a swap via IUniswapV3Pool#swap.\n /// @dev In the implementation you must pay the pool tokens owed for the swap.\n /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.\n /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped.\n /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by\n /// the end of the swap. If positive, the callback must send that amount of token0 to the pool.\n /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by\n /// the end of the swap. If positive, the callback must send that amount of token1 to the pool.\n /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#swap call\n function uniswapV3SwapCallback(\n int256 amount0Delta,\n int256 amount1Delta,\n bytes calldata data\n ) external;\n}\n" }, "contracts/interfaces/callback/IUniswapV3FlashCallback.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Callback for IUniswapV3PoolActions#flash\n/// @notice Any contract that calls IUniswapV3PoolActions#flash must implement this interface\ninterface IUniswapV3FlashCallback {\n /// @notice Called to `msg.sender` after transferring to the recipient from IUniswapV3Pool#flash.\n /// @dev In the implementation you must repay the pool the tokens sent by flash plus the computed fee amounts.\n /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.\n /// @param fee0 The fee amount in token0 due to the pool by the end of the flash\n /// @param fee1 The fee amount in token1 due to the pool by the end of the flash\n /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#flash call\n function uniswapV3FlashCallback(\n uint256 fee0,\n uint256 fee1,\n bytes calldata data\n ) external;\n}\n" }, "contracts/interfaces/pool/IUniswapV3PoolImmutables.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that never changes\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\ninterface IUniswapV3PoolImmutables {\n /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface\n /// @return The contract address\n function factory() external view returns (address);\n\n /// @notice The first of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token0() external view returns (address);\n\n /// @notice The second of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token1() external view returns (address);\n\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\n /// @return The fee\n function fee() external view returns (uint24);\n\n /// @notice The pool tick spacing\n /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive\n /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...\n /// This value is an int24 to avoid casting even though it is always positive.\n /// @return The tick spacing\n function tickSpacing() external view returns (int24);\n\n /// @notice The maximum amount of position liquidity that can use any tick in the range\n /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and\n /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool\n /// @return The max amount of liquidity per tick\n function maxLiquidityPerTick() external view returns (uint128);\n}\n" }, "contracts/interfaces/pool/IUniswapV3PoolState.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that can change\n/// @notice These methods compose the pool's state, and can change with any frequency including multiple times\n/// per transaction\ninterface IUniswapV3PoolState {\n /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas\n /// when accessed externally.\n /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value\n /// tick The current tick of the pool, i.e. according to the last tick transition that was run.\n /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick\n /// boundary.\n /// observationIndex The index of the last oracle observation that was written,\n /// observationCardinality The current maximum number of observations stored in the pool,\n /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.\n /// feeProtocol The protocol fee for both tokens of the pool.\n /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0\n /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.\n /// unlocked Whether the pool is currently locked to reentrancy\n function slot0()\n external\n view\n returns (\n uint160 sqrtPriceX96,\n int24 tick,\n uint16 observationIndex,\n uint16 observationCardinality,\n uint16 observationCardinalityNext,\n uint8 feeProtocol,\n bool unlocked\n );\n\n /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal0X128() external view returns (uint256);\n\n /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal1X128() external view returns (uint256);\n\n /// @notice The amounts of token0 and token1 that are owed to the protocol\n /// @dev Protocol fees will never exceed uint128 max in either token\n function protocolFees() external view returns (uint128 token0, uint128 token1);\n\n /// @notice The currently in range liquidity available to the pool\n /// @dev This value has no relationship to the total liquidity across all ticks\n function liquidity() external view returns (uint128);\n\n /// @notice Look up information about a specific tick in the pool\n /// @param tick The tick to look up\n /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or\n /// tick upper,\n /// liquidityNet how much liquidity changes when the pool price crosses the tick,\n /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,\n /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,\n /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick\n /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,\n /// secondsOutside the seconds spent on the other side of the tick from the current tick,\n /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.\n /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.\n /// In addition, these values are only relative and must be used only in comparison to previous snapshots for\n /// a specific position.\n function ticks(int24 tick)\n external\n view\n returns (\n uint128 liquidityGross,\n int128 liquidityNet,\n uint256 feeGrowthOutside0X128,\n uint256 feeGrowthOutside1X128,\n int56 tickCumulativeOutside,\n uint160 secondsPerLiquidityOutsideX128,\n uint32 secondsOutside,\n bool initialized\n );\n\n /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information\n function tickBitmap(int16 wordPosition) external view returns (uint256);\n\n /// @notice Returns the information about a position by the position's key\n /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper\n /// @return _liquidity The amount of liquidity in the position,\n /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,\n /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,\n /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,\n /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke\n function positions(bytes32 key)\n external\n view\n returns (\n uint128 _liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n\n /// @notice Returns data about a specific observation index\n /// @param index The element of the observations array to fetch\n /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time\n /// ago, rather than at a specific index in the array.\n /// @return blockTimestamp The timestamp of the observation,\n /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,\n /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,\n /// Returns initialized whether the observation has been initialized and the values are safe to use\n function observations(uint256 index)\n external\n view\n returns (\n uint32 blockTimestamp,\n int56 tickCumulative,\n uint160 secondsPerLiquidityCumulativeX128,\n bool initialized\n );\n}\n" }, "contracts/interfaces/pool/IUniswapV3PoolDerivedState.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that is not stored\n/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the\n/// blockchain. The functions here may have variable gas costs.\ninterface IUniswapV3PoolDerivedState {\n /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp\n /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing\n /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,\n /// you must call it with secondsAgos = [3600, 0].\n /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in\n /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.\n /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned\n /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp\n /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block\n /// timestamp\n function observe(uint32[] calldata secondsAgos)\n external\n view\n returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);\n\n /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range\n /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.\n /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first\n /// snapshot is taken and the second snapshot is taken.\n /// @param tickLower The lower tick of the range\n /// @param tickUpper The upper tick of the range\n /// @return tickCumulativeInside The snapshot of the tick accumulator for the range\n /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range\n /// @return secondsInside The snapshot of seconds per liquidity for the range\n function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)\n external\n view\n returns (\n int56 tickCumulativeInside,\n uint160 secondsPerLiquidityInsideX128,\n uint32 secondsInside\n );\n}\n" }, "contracts/interfaces/pool/IUniswapV3PoolActions.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissionless pool actions\n/// @notice Contains pool methods that can be called by anyone\ninterface IUniswapV3PoolActions {\n /// @notice Sets the initial price for the pool\n /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value\n /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96\n function initialize(uint160 sqrtPriceX96) external;\n\n /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position\n /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback\n /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends\n /// on tickLower, tickUpper, the amount of liquidity, and the current price.\n /// @param recipient The address for which the liquidity will be created\n /// @param tickLower The lower tick of the position in which to add liquidity\n /// @param tickUpper The upper tick of the position in which to add liquidity\n /// @param amount The amount of liquidity to mint\n /// @param data Any data that should be passed through to the callback\n /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback\n /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback\n function mint(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount,\n bytes calldata data\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Collects tokens owed to a position\n /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.\n /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or\n /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the\n /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.\n /// @param recipient The address which should receive the fees collected\n /// @param tickLower The lower tick of the position for which to collect fees\n /// @param tickUpper The upper tick of the position for which to collect fees\n /// @param amount0Requested How much token0 should be withdrawn from the fees owed\n /// @param amount1Requested How much token1 should be withdrawn from the fees owed\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n\n /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position\n /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0\n /// @dev Fees must be collected separately via a call to #collect\n /// @param tickLower The lower tick of the position for which to burn liquidity\n /// @param tickUpper The upper tick of the position for which to burn liquidity\n /// @param amount How much liquidity to burn\n /// @return amount0 The amount of token0 sent to the recipient\n /// @return amount1 The amount of token1 sent to the recipient\n function burn(\n int24 tickLower,\n int24 tickUpper,\n uint128 amount\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Swap token0 for token1, or token1 for token0\n /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback\n /// @param recipient The address to receive the output of the swap\n /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0\n /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)\n /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this\n /// value after the swap. If one for zero, the price cannot be greater than this value after the swap\n /// @param data Any data to be passed through to the callback\n /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive\n /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external returns (int256 amount0, int256 amount1);\n\n /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback\n /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback\n /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling\n /// with 0 amount{0,1} and sending the donation amount(s) from the callback\n /// @param recipient The address which will receive the token0 and token1 amounts\n /// @param amount0 The amount of token0 to send\n /// @param amount1 The amount of token1 to send\n /// @param data Any data to be passed through to the callback\n function flash(\n address recipient,\n uint256 amount0,\n uint256 amount1,\n bytes calldata data\n ) external;\n\n /// @notice Increase the maximum number of price and liquidity observations that this pool will store\n /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to\n /// the input observationCardinalityNext.\n /// @param observationCardinalityNext The desired minimum number of observations for the pool to store\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\n}\n" }, "contracts/interfaces/pool/IUniswapV3PoolOwnerActions.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissioned pool actions\n/// @notice Contains pool methods that may only be called by the factory owner\ninterface IUniswapV3PoolOwnerActions {\n /// @notice Set the denominator of the protocol's % share of the fees\n /// @param feeProtocol0 new protocol fee for token0 of the pool\n /// @param feeProtocol1 new protocol fee for token1 of the pool\n function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;\n\n /// @notice Collect the protocol fee accrued to the pool\n /// @param recipient The address to which collected protocol fees should be sent\n /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1\n /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0\n /// @return amount0 The protocol fee collected in token0\n /// @return amount1 The protocol fee collected in token1\n function collectProtocol(\n address recipient,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n}\n" }, "contracts/interfaces/pool/IUniswapV3PoolEvents.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Events emitted by a pool\n/// @notice Contains all events emitted by the pool\ninterface IUniswapV3PoolEvents {\n /// @notice Emitted exactly once by a pool when #initialize is first called on the pool\n /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize\n /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96\n /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool\n event Initialize(uint160 sqrtPriceX96, int24 tick);\n\n /// @notice Emitted when liquidity is minted for a given position\n /// @param sender The address that minted the liquidity\n /// @param owner The owner of the position and recipient of any minted liquidity\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity minted to the position range\n /// @param amount0 How much token0 was required for the minted liquidity\n /// @param amount1 How much token1 was required for the minted liquidity\n event Mint(\n address sender,\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted when fees are collected by the owner of a position\n /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees\n /// @param owner The owner of the position for which fees are collected\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount0 The amount of token0 fees collected\n /// @param amount1 The amount of token1 fees collected\n event Collect(\n address indexed owner,\n address recipient,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount0,\n uint128 amount1\n );\n\n /// @notice Emitted when a position's liquidity is removed\n /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect\n /// @param owner The owner of the position for which liquidity is removed\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity to remove\n /// @param amount0 The amount of token0 withdrawn\n /// @param amount1 The amount of token1 withdrawn\n event Burn(\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted by the pool for any swaps between token0 and token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the output of the swap\n /// @param amount0 The delta of the token0 balance of the pool\n /// @param amount1 The delta of the token1 balance of the pool\n /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96\n /// @param liquidity The liquidity of the pool after the swap\n /// @param tick The log base 1.0001 of price of the pool after the swap\n event Swap(\n address indexed sender,\n address indexed recipient,\n int256 amount0,\n int256 amount1,\n uint160 sqrtPriceX96,\n uint128 liquidity,\n int24 tick\n );\n\n /// @notice Emitted by the pool for any flashes of token0/token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the tokens from flash\n /// @param amount0 The amount of token0 that was flashed\n /// @param amount1 The amount of token1 that was flashed\n /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee\n /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee\n event Flash(\n address indexed sender,\n address indexed recipient,\n uint256 amount0,\n uint256 amount1,\n uint256 paid0,\n uint256 paid1\n );\n\n /// @notice Emitted by the pool for increases to the number of observations that can be stored\n /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index\n /// just before a mint/swap/burn.\n /// @param observationCardinalityNextOld The previous value of the next observation cardinality\n /// @param observationCardinalityNextNew The updated value of the next observation cardinality\n event IncreaseObservationCardinalityNext(\n uint16 observationCardinalityNextOld,\n uint16 observationCardinalityNextNew\n );\n\n /// @notice Emitted when the protocol fee is changed by the pool\n /// @param feeProtocol0Old The previous value of the token0 protocol fee\n /// @param feeProtocol1Old The previous value of the token1 protocol fee\n /// @param feeProtocol0New The updated value of the token0 protocol fee\n /// @param feeProtocol1New The updated value of the token1 protocol fee\n event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);\n\n /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner\n /// @param sender The address that collects the protocol fees\n /// @param recipient The address that receives the collected protocol fees\n /// @param amount0 The amount of token0 protocol fees that is withdrawn\n /// @param amount0 The amount of token1 protocol fees that is withdrawn\n event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);\n}\n" }, "contracts/libraries/BitMath.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title BitMath\n/// @dev This library provides functionality for computing bit properties of an unsigned integer\nlibrary BitMath {\n /// @notice Returns the index of the most significant bit of the number,\n /// where the least significant bit is at index 0 and the most significant bit is at index 255\n /// @dev The function satisfies the property:\n /// x >= 2**mostSignificantBit(x) and x < 2**(mostSignificantBit(x)+1)\n /// @param x the value for which to compute the most significant bit, must be greater than 0\n /// @return r the index of the most significant bit\n function mostSignificantBit(uint256 x) internal pure returns (uint8 r) {\n require(x > 0);\n\n if (x >= 0x100000000000000000000000000000000) {\n x >>= 128;\n r += 128;\n }\n if (x >= 0x10000000000000000) {\n x >>= 64;\n r += 64;\n }\n if (x >= 0x100000000) {\n x >>= 32;\n r += 32;\n }\n if (x >= 0x10000) {\n x >>= 16;\n r += 16;\n }\n if (x >= 0x100) {\n x >>= 8;\n r += 8;\n }\n if (x >= 0x10) {\n x >>= 4;\n r += 4;\n }\n if (x >= 0x4) {\n x >>= 2;\n r += 2;\n }\n if (x >= 0x2) r += 1;\n }\n\n /// @notice Returns the index of the least significant bit of the number,\n /// where the least significant bit is at index 0 and the most significant bit is at index 255\n /// @dev The function satisfies the property:\n /// (x & 2**leastSignificantBit(x)) != 0 and (x & (2**(leastSignificantBit(x)) - 1)) == 0)\n /// @param x the value for which to compute the least significant bit, must be greater than 0\n /// @return r the index of the least significant bit\n function leastSignificantBit(uint256 x) internal pure returns (uint8 r) {\n require(x > 0);\n\n r = 255;\n if (x & type(uint128).max > 0) {\n r -= 128;\n } else {\n x >>= 128;\n }\n if (x & type(uint64).max > 0) {\n r -= 64;\n } else {\n x >>= 64;\n }\n if (x & type(uint32).max > 0) {\n r -= 32;\n } else {\n x >>= 32;\n }\n if (x & type(uint16).max > 0) {\n r -= 16;\n } else {\n x >>= 16;\n }\n if (x & type(uint8).max > 0) {\n r -= 8;\n } else {\n x >>= 8;\n }\n if (x & 0xf > 0) {\n r -= 4;\n } else {\n x >>= 4;\n }\n if (x & 0x3 > 0) {\n r -= 2;\n } else {\n x >>= 2;\n }\n if (x & 0x1 > 0) r -= 1;\n }\n}\n" }, "contracts/libraries/UnsafeMath.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Math functions that do not check inputs or outputs\n/// @notice Contains methods that perform common math functions but do not do any overflow or underflow checks\nlibrary UnsafeMath {\n /// @notice Returns ceil(x / y)\n /// @dev division by 0 has unspecified behavior, and must be checked externally\n /// @param x The dividend\n /// @param y The divisor\n /// @return z The quotient, ceil(x / y)\n function divRoundingUp(uint256 x, uint256 y) internal pure returns (uint256 z) {\n assembly {\n z := add(div(x, y), gt(mod(x, y), 0))\n }\n }\n}\n" }, "contracts/libraries/FixedPoint96.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.4.0;\n\n/// @title FixedPoint96\n/// @notice A library for handling binary fixed point numbers, see https://en.wikipedia.org/wiki/Q_(number_format)\n/// @dev Used in SqrtPriceMath.sol\nlibrary FixedPoint96 {\n uint8 internal constant RESOLUTION = 96;\n uint256 internal constant Q96 = 0x1000000000000000000000000;\n}\n" } }, "settings": { "optimizer": { "enabled": true, "runs": 800 }, "metadata": { "bytecodeHash": "none" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } }, "libraries": {} } }}
1
20,290,506
213e66890a72f3f644a017e835b57f38b4d95b87462b5fdc9285f6b5a75be41f
dbd17923c31ea0a91708f0b2a43763f8235085f2773d30ec425da09243b75e8e
0df8d763cf1afc313e982c463a9b3eefb2bb02be
a6b71e26c5e0845f74c812102ca7114b6a896ab2
5dfd2dfa9be9f89fa3ae3611b42059a1f9c6d4e7
608060405234801561001057600080fd5b506040516101e63803806101e68339818101604052602081101561003357600080fd5b8101908080519060200190929190505050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156100ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806101c46022913960400191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505060ab806101196000396000f3fe608060405273ffffffffffffffffffffffffffffffffffffffff600054167fa619486e0000000000000000000000000000000000000000000000000000000060003514156050578060005260206000f35b3660008037600080366000845af43d6000803e60008114156070573d6000fd5b3d6000f3fea2646970667358221220d1429297349653a4918076d650332de1a1068c5f3e07c5c82360c277770b955264736f6c63430007060033496e76616c69642073696e676c65746f6e20616464726573732070726f7669646564000000000000000000000000d9db270c1b5e3bd161e8c8503c55ceabee709552
608060405273ffffffffffffffffffffffffffffffffffffffff600054167fa619486e0000000000000000000000000000000000000000000000000000000060003514156050578060005260206000f35b3660008037600080366000845af43d6000803e60008114156070573d6000fd5b3d6000f3fea2646970667358221220d1429297349653a4918076d650332de1a1068c5f3e07c5c82360c277770b955264736f6c63430007060033
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.7.0 <0.9.0; /// @title IProxy - Helper interface to access masterCopy of the Proxy on-chain /// @author Richard Meissner - <[email protected]> interface IProxy { function masterCopy() external view returns (address); } /// @title GnosisSafeProxy - Generic proxy contract allows to execute all transactions applying the code of a master contract. /// @author Stefan George - <[email protected]> /// @author Richard Meissner - <[email protected]> contract GnosisSafeProxy { // singleton always needs to be first declared variable, to ensure that it is at the same location in the contracts to which calls are delegated. // To reduce deployment costs this variable is internal and needs to be retrieved via `getStorageAt` address internal singleton; /// @dev Constructor function sets address of singleton contract. /// @param _singleton Singleton address. constructor(address _singleton) { require(_singleton != address(0), "Invalid singleton address provided"); singleton = _singleton; } /// @dev Fallback function forwards all transactions and returns all received return data. fallback() external payable { // solhint-disable-next-line no-inline-assembly assembly { let _singleton := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff) // 0xa619486e == keccak("masterCopy()"). The value is right padded to 32-bytes with 0s if eq(calldataload(0), 0xa619486e00000000000000000000000000000000000000000000000000000000) { mstore(0, _singleton) return(0, 0x20) } calldatacopy(0, 0, calldatasize()) let success := delegatecall(gas(), _singleton, 0, calldatasize(), 0, 0) returndatacopy(0, 0, returndatasize()) if eq(success, 0) { revert(0, returndatasize()) } return(0, returndatasize()) } } } /// @title Proxy Factory - Allows to create new proxy contact and execute a message call to the new proxy within one transaction. /// @author Stefan George - <[email protected]> contract GnosisSafeProxyFactory { event ProxyCreation(GnosisSafeProxy proxy, address singleton); /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction. /// @param singleton Address of singleton contract. /// @param data Payload for message call sent to new proxy contract. function createProxy(address singleton, bytes memory data) public returns (GnosisSafeProxy proxy) { proxy = new GnosisSafeProxy(singleton); if (data.length > 0) // solhint-disable-next-line no-inline-assembly assembly { if eq(call(gas(), proxy, 0, add(data, 0x20), mload(data), 0, 0), 0) { revert(0, 0) } } emit ProxyCreation(proxy, singleton); } /// @dev Allows to retrieve the runtime code of a deployed Proxy. This can be used to check that the expected Proxy was deployed. function proxyRuntimeCode() public pure returns (bytes memory) { return type(GnosisSafeProxy).runtimeCode; } /// @dev Allows to retrieve the creation code used for the Proxy deployment. With this it is easily possible to calculate predicted address. function proxyCreationCode() public pure returns (bytes memory) { return type(GnosisSafeProxy).creationCode; } /// @dev Allows to create new proxy contact using CREATE2 but it doesn't run the initializer. /// This method is only meant as an utility to be called from other methods /// @param _singleton Address of singleton contract. /// @param initializer Payload for message call sent to new proxy contract. /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. function deployProxyWithNonce( address _singleton, bytes memory initializer, uint256 saltNonce ) internal returns (GnosisSafeProxy proxy) { // If the initializer changes the proxy address should change too. Hashing the initializer data is cheaper than just concatinating it bytes32 salt = keccak256(abi.encodePacked(keccak256(initializer), saltNonce)); bytes memory deploymentData = abi.encodePacked(type(GnosisSafeProxy).creationCode, uint256(uint160(_singleton))); // solhint-disable-next-line no-inline-assembly assembly { proxy := create2(0x0, add(0x20, deploymentData), mload(deploymentData), salt) } require(address(proxy) != address(0), "Create2 call failed"); } /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction. /// @param _singleton Address of singleton contract. /// @param initializer Payload for message call sent to new proxy contract. /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. function createProxyWithNonce( address _singleton, bytes memory initializer, uint256 saltNonce ) public returns (GnosisSafeProxy proxy) { proxy = deployProxyWithNonce(_singleton, initializer, saltNonce); if (initializer.length > 0) // solhint-disable-next-line no-inline-assembly assembly { if eq(call(gas(), proxy, 0, add(initializer, 0x20), mload(initializer), 0, 0), 0) { revert(0, 0) } } emit ProxyCreation(proxy, _singleton); } /// @dev Allows to create new proxy contact, execute a message call to the new proxy and call a specified callback within one transaction /// @param _singleton Address of singleton contract. /// @param initializer Payload for message call sent to new proxy contract. /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. /// @param callback Callback that will be invoced after the new proxy contract has been successfully deployed and initialized. function createProxyWithCallback( address _singleton, bytes memory initializer, uint256 saltNonce, IProxyCreationCallback callback ) public returns (GnosisSafeProxy proxy) { uint256 saltNonceWithCallback = uint256(keccak256(abi.encodePacked(saltNonce, callback))); proxy = createProxyWithNonce(_singleton, initializer, saltNonceWithCallback); if (address(callback) != address(0)) callback.proxyCreated(proxy, _singleton, initializer, saltNonce); } /// @dev Allows to get the address for a new proxy contact created via `createProxyWithNonce` /// This method is only meant for address calculation purpose when you use an initializer that would revert, /// therefore the response is returned with a revert. When calling this method set `from` to the address of the proxy factory. /// @param _singleton Address of singleton contract. /// @param initializer Payload for message call sent to new proxy contract. /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. function calculateCreateProxyWithNonceAddress( address _singleton, bytes calldata initializer, uint256 saltNonce ) external returns (GnosisSafeProxy proxy) { proxy = deployProxyWithNonce(_singleton, initializer, saltNonce); revert(string(abi.encodePacked(proxy))); } } interface IProxyCreationCallback { function proxyCreated( GnosisSafeProxy proxy, address _singleton, bytes calldata initializer, uint256 saltNonce ) external; }
1
20,290,506
213e66890a72f3f644a017e835b57f38b4d95b87462b5fdc9285f6b5a75be41f
b8e69f29228a4eb83b6a23d9aaef0b3d5500fb75869d1cc5fbc8b5976433f822
32b56fc48684fa085df8c4cd2feaafc25c304db9
ffa397285ce46fb78c588a9e993286aac68c37cd
3556b1765ee39fd2611fae7264b0668e0a8b9ea1
3d602d80600a3d3981f3363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3
pragma solidity 0.7.5; /* The MIT License (MIT) Copyright (c) 2018 Murray Software, LLC. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //solhint-disable max-line-length //solhint-disable no-inline-assembly contract CloneFactory { function createClone(address target, bytes32 salt) internal returns (address payable result) { bytes20 targetBytes = bytes20(target); assembly { // load the next free memory slot as a place to store the clone contract data let clone := mload(0x40) // The bytecode block below is responsible for contract initialization // during deployment, it is worth noting the proxied contract constructor will not be called during // the cloning procedure and that is why an initialization function needs to be called after the // clone is created mstore( clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000 ) // This stores the address location of the implementation contract // so that the proxy knows where to delegate call logic to mstore(add(clone, 0x14), targetBytes) // The bytecode block is the actual code that is deployed for each clone created. // It forwards all calls to the already deployed implementation via a delegatecall mstore( add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000 ) // deploy the contract using the CREATE2 opcode // this deploys the minimal proxy defined above, which will proxy all // calls to use the logic defined in the implementation contract `target` result := create2(0, clone, 0x37, salt) } } function isClone(address target, address query) internal view returns (bool result) { bytes20 targetBytes = bytes20(target); assembly { // load the next free memory slot as a place to store the comparison clone let clone := mload(0x40) // The next three lines store the expected bytecode for a miniml proxy // that targets `target` as its implementation contract mstore( clone, 0x363d3d373d3d3d363d7300000000000000000000000000000000000000000000 ) mstore(add(clone, 0xa), targetBytes) mstore( add(clone, 0x1e), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000 ) // the next two lines store the bytecode of the contract that we are checking in memory let other := add(clone, 0x40) extcodecopy(query, other, 0, 0x2d) // Check if the expected bytecode equals the actual bytecode and return the result result := and( eq(mload(clone), mload(other)), eq(mload(add(clone, 0xd)), mload(add(other, 0xd))) ) } } } /** * Contract that exposes the needed erc20 token functions */ abstract contract ERC20Interface { // Send _value amount of tokens to address _to function transfer(address _to, uint256 _value) public virtual returns (bool success); // Get the account balance of another account with address _owner function balanceOf(address _owner) public virtual view returns (uint256 balance); } // helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false library TransferHelper { function safeApprove( address token, address to, uint256 value ) internal { // bytes4(keccak256(bytes('approve(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::safeApprove: approve failed' ); } function safeTransfer( address token, address to, uint256 value ) internal { // bytes4(keccak256(bytes('transfer(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::safeTransfer: transfer failed' ); } function safeTransferFrom( address token, address from, address to, uint256 value ) internal { // bytes4(keccak256(bytes('transferFrom(address,address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::transferFrom: transferFrom failed' ); } function safeTransferETH(address to, uint256 value) internal { (bool success, ) = to.call{value: value}(new bytes(0)); require(success, 'TransferHelper::safeTransferETH: ETH transfer failed'); } } /** * Contract that will forward any incoming Ether to the creator of the contract * */ contract Forwarder { // Address to which any funds sent to this contract will be forwarded address public parentAddress; event ForwarderDeposited(address from, uint256 value, bytes data); /** * Initialize the contract, and sets the destination address to that of the creator */ function init(address _parentAddress) external onlyUninitialized { parentAddress = _parentAddress; uint256 value = address(this).balance; if (value == 0) { return; } (bool success, ) = parentAddress.call{ value: value }(''); require(success, 'Flush failed'); // NOTE: since we are forwarding on initialization, // we don't have the context of the original sender. // We still emit an event about the forwarding but set // the sender to the forwarder itself emit ForwarderDeposited(address(this), value, msg.data); } /** * Modifier that will execute internal code block only if the sender is the parent address */ modifier onlyParent { require(msg.sender == parentAddress, 'Only Parent'); _; } /** * Modifier that will execute internal code block only if the contract has not been initialized yet */ modifier onlyUninitialized { require(parentAddress == address(0x0), 'Already initialized'); _; } /** * Default function; Gets called when data is sent but does not match any other function */ fallback() external payable { flush(); } /** * Default function; Gets called when Ether is deposited with no data, and forwards it to the parent address */ receive() external payable { flush(); } /** * Execute a token transfer of the full balance from the forwarder token to the parent address * @param tokenContractAddress the address of the erc20 token contract */ function flushTokens(address tokenContractAddress) external onlyParent { ERC20Interface instance = ERC20Interface(tokenContractAddress); address forwarderAddress = address(this); uint256 forwarderBalance = instance.balanceOf(forwarderAddress); if (forwarderBalance == 0) { return; } TransferHelper.safeTransfer( tokenContractAddress, parentAddress, forwarderBalance ); } /** * Flush the entire balance of the contract to the parent address. */ function flush() public { uint256 value = address(this).balance; if (value == 0) { return; } (bool success, ) = parentAddress.call{ value: value }(''); require(success, 'Flush failed'); emit ForwarderDeposited(msg.sender, value, msg.data); } } contract ForwarderFactory is CloneFactory { address public implementationAddress; event ForwarderCreated(address newForwarderAddress, address parentAddress); constructor(address _implementationAddress) { implementationAddress = _implementationAddress; } function createForwarder(address parent, bytes32 salt) external { // include the signers in the salt so any contract deployed to a given address must have the same signers bytes32 finalSalt = keccak256(abi.encodePacked(parent, salt)); address payable clone = createClone(implementationAddress, finalSalt); Forwarder(clone).init(parent); emit ForwarderCreated(clone, parent); } }
1
20,290,507
8a19c485b70c8f834f1d19961bb1a7ee7a1ecf75ef688486ed1e2871d5f6c935
9d959feae6e6fe8116e300cc54c816a0213ce8976c95a115cf1d3c800848c51a
00bdb5699745f5b860228c8f939abf1b9ae374ed
ffa397285ce46fb78c588a9e993286aac68c37cd
5f4104c90796764a1401115f48ff120360f3d2b3
3d602d80600a3d3981f3363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3
pragma solidity 0.7.5; /* The MIT License (MIT) Copyright (c) 2018 Murray Software, LLC. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //solhint-disable max-line-length //solhint-disable no-inline-assembly contract CloneFactory { function createClone(address target, bytes32 salt) internal returns (address payable result) { bytes20 targetBytes = bytes20(target); assembly { // load the next free memory slot as a place to store the clone contract data let clone := mload(0x40) // The bytecode block below is responsible for contract initialization // during deployment, it is worth noting the proxied contract constructor will not be called during // the cloning procedure and that is why an initialization function needs to be called after the // clone is created mstore( clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000 ) // This stores the address location of the implementation contract // so that the proxy knows where to delegate call logic to mstore(add(clone, 0x14), targetBytes) // The bytecode block is the actual code that is deployed for each clone created. // It forwards all calls to the already deployed implementation via a delegatecall mstore( add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000 ) // deploy the contract using the CREATE2 opcode // this deploys the minimal proxy defined above, which will proxy all // calls to use the logic defined in the implementation contract `target` result := create2(0, clone, 0x37, salt) } } function isClone(address target, address query) internal view returns (bool result) { bytes20 targetBytes = bytes20(target); assembly { // load the next free memory slot as a place to store the comparison clone let clone := mload(0x40) // The next three lines store the expected bytecode for a miniml proxy // that targets `target` as its implementation contract mstore( clone, 0x363d3d373d3d3d363d7300000000000000000000000000000000000000000000 ) mstore(add(clone, 0xa), targetBytes) mstore( add(clone, 0x1e), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000 ) // the next two lines store the bytecode of the contract that we are checking in memory let other := add(clone, 0x40) extcodecopy(query, other, 0, 0x2d) // Check if the expected bytecode equals the actual bytecode and return the result result := and( eq(mload(clone), mload(other)), eq(mload(add(clone, 0xd)), mload(add(other, 0xd))) ) } } } /** * Contract that exposes the needed erc20 token functions */ abstract contract ERC20Interface { // Send _value amount of tokens to address _to function transfer(address _to, uint256 _value) public virtual returns (bool success); // Get the account balance of another account with address _owner function balanceOf(address _owner) public virtual view returns (uint256 balance); } // helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false library TransferHelper { function safeApprove( address token, address to, uint256 value ) internal { // bytes4(keccak256(bytes('approve(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::safeApprove: approve failed' ); } function safeTransfer( address token, address to, uint256 value ) internal { // bytes4(keccak256(bytes('transfer(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::safeTransfer: transfer failed' ); } function safeTransferFrom( address token, address from, address to, uint256 value ) internal { // bytes4(keccak256(bytes('transferFrom(address,address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::transferFrom: transferFrom failed' ); } function safeTransferETH(address to, uint256 value) internal { (bool success, ) = to.call{value: value}(new bytes(0)); require(success, 'TransferHelper::safeTransferETH: ETH transfer failed'); } } /** * Contract that will forward any incoming Ether to the creator of the contract * */ contract Forwarder { // Address to which any funds sent to this contract will be forwarded address public parentAddress; event ForwarderDeposited(address from, uint256 value, bytes data); /** * Initialize the contract, and sets the destination address to that of the creator */ function init(address _parentAddress) external onlyUninitialized { parentAddress = _parentAddress; uint256 value = address(this).balance; if (value == 0) { return; } (bool success, ) = parentAddress.call{ value: value }(''); require(success, 'Flush failed'); // NOTE: since we are forwarding on initialization, // we don't have the context of the original sender. // We still emit an event about the forwarding but set // the sender to the forwarder itself emit ForwarderDeposited(address(this), value, msg.data); } /** * Modifier that will execute internal code block only if the sender is the parent address */ modifier onlyParent { require(msg.sender == parentAddress, 'Only Parent'); _; } /** * Modifier that will execute internal code block only if the contract has not been initialized yet */ modifier onlyUninitialized { require(parentAddress == address(0x0), 'Already initialized'); _; } /** * Default function; Gets called when data is sent but does not match any other function */ fallback() external payable { flush(); } /** * Default function; Gets called when Ether is deposited with no data, and forwards it to the parent address */ receive() external payable { flush(); } /** * Execute a token transfer of the full balance from the forwarder token to the parent address * @param tokenContractAddress the address of the erc20 token contract */ function flushTokens(address tokenContractAddress) external onlyParent { ERC20Interface instance = ERC20Interface(tokenContractAddress); address forwarderAddress = address(this); uint256 forwarderBalance = instance.balanceOf(forwarderAddress); if (forwarderBalance == 0) { return; } TransferHelper.safeTransfer( tokenContractAddress, parentAddress, forwarderBalance ); } /** * Flush the entire balance of the contract to the parent address. */ function flush() public { uint256 value = address(this).balance; if (value == 0) { return; } (bool success, ) = parentAddress.call{ value: value }(''); require(success, 'Flush failed'); emit ForwarderDeposited(msg.sender, value, msg.data); } } contract ForwarderFactory is CloneFactory { address public implementationAddress; event ForwarderCreated(address newForwarderAddress, address parentAddress); constructor(address _implementationAddress) { implementationAddress = _implementationAddress; } function createForwarder(address parent, bytes32 salt) external { // include the signers in the salt so any contract deployed to a given address must have the same signers bytes32 finalSalt = keccak256(abi.encodePacked(parent, salt)); address payable clone = createClone(implementationAddress, finalSalt); Forwarder(clone).init(parent); emit ForwarderCreated(clone, parent); } }
1
20,290,509
18e54dbae6507ee1e093614ce1223f75d15424a8137bc0b4bc38194f86408d15
c63def3fd051b4f68fffec230e1820a6f83b19bfc26169995751d1a660fe59cf
a7fb5ca286fc3fd67525629048a4de3ba24cba2e
c77ad0a71008d7094a62cfbd250a2eb2afdf2776
d57f87be7e49c131c797021556a94771c7d1e34a
608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe
1
20,290,513
d696acb989755eea7ab8230d454c37d492a28f5d992da5198e7490fb2226953b
699aa5c201d6961bc1c81efcb0e8711c99e9692e5ecb8b6eb46a86df23728f36
47672e14bbe388197298fdb2f4548ecdf1700e91
47672e14bbe388197298fdb2f4548ecdf1700e91
f7948c27e10c0c764c416a1a77b321c3d9cacdc3
608060405234801561001057600080fd5b5033600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610aaa806100616000396000f3fe60806040526004361061004e5760003560e01c80631b55ba3a1461005a57806370e44c6a146100715780638da5cb5b1461010157806395d89b4114610158578063bedf0f4a146101e857610055565b3661005557005b600080fd5b34801561006657600080fd5b5061006f6101ff565b005b34801561007d57600080fd5b5061008661026a565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100c65780820151818401526020810190506100ab565b50505050905090810190601f1680156100f35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561010d57600080fd5b50610116610472565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561016457600080fd5b5061016d610498565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101ad578082015181840152602081019050610192565b50505050905090810190601f1680156101da5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101f457600080fd5b506101fd610516565b005b600061021161020c610581565b61071f565b905060008190508073ffffffffffffffffffffffffffffffffffffffff166108fc61023a610978565b9081150290604051600060405180830381858888f19350505050158015610265573d6000803e3d6000fd5b505050565b6060600061027e610279610581565b61071f565b90506000819050606061028f610980565b9050606061029b6109bd565b905060606102a76109fa565b905060606102b3610a37565b90508473ffffffffffffffffffffffffffffffffffffffff166108fc6102d7610978565b9081150290604051600060405180830381858888f19350505050158015610302573d6000803e3d6000fd5b50838383836040516020018085805190602001908083835b6020831061033d578051825260208201915060208101905060208303925061031a565b6001836020036101000a03801982511681845116808217855250505050505090500184805190602001908083835b6020831061038e578051825260208201915060208101905060208303925061036b565b6001836020036101000a03801982511681845116808217855250505050505090500183805190602001908083835b602083106103df57805182526020820191506020810190506020830392506103bc565b6001836020036101000a03801982511681845116808217855250505050505090500182805190602001908083835b60208310610430578051825260208201915060208101905060208303925061040d565b6001836020036101000a038019825116818451168082178552505050505050905001945050505050604051602081830303815290604052965050505050505090565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6060806104a36109bd565b9050806040516020018082805190602001908083835b602083106104dc57805182526020820191506020810190506020830392506104b9565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405160208183030381529060405291505090565b6000610528610523610581565b61071f565b905060008190508073ffffffffffffffffffffffffffffffffffffffff166108fc610551610978565b9081150290604051600060405180830381858888f1935050505015801561057c573d6000803e3d6000fd5b505050565b60608061058c610980565b905060606105986109bd565b905060606105a46109fa565b905060606105b0610a37565b9050838383836040516020018085805190602001908083835b602083106105ec57805182526020820191506020810190506020830392506105c9565b6001836020036101000a03801982511681845116808217855250505050505090500184805190602001908083835b6020831061063d578051825260208201915060208101905060208303925061061a565b6001836020036101000a03801982511681845116808217855250505050505090500183805190602001908083835b6020831061068e578051825260208201915060208101905060208303925061066b565b6001836020036101000a03801982511681845116808217855250505050505090500182805190602001908083835b602083106106df57805182526020820191506020810190506020830392506106bc565b6001836020036101000a03801982511681845116808217855250505050505090500194505050505060405160208183030381529060405294505050505090565b6000606082905060008090506000806000600290505b602a81101561096b576101008402935084818151811061075157fe5b602001015160f81c60f81b60f81c60ff16925084600182018151811061077357fe5b602001015160f81c60f81b60f81c60ff16915060618373ffffffffffffffffffffffffffffffffffffffff16101580156107c4575060668373ffffffffffffffffffffffffffffffffffffffff1611155b156107d45760578303925061086e565b60418373ffffffffffffffffffffffffffffffffffffffff1610158015610812575060468373ffffffffffffffffffffffffffffffffffffffff1611155b156108225760378303925061086d565b60308373ffffffffffffffffffffffffffffffffffffffff1610158015610860575060398373ffffffffffffffffffffffffffffffffffffffff1611155b1561086c576030830392505b5b5b60618273ffffffffffffffffffffffffffffffffffffffff16101580156108ac575060668273ffffffffffffffffffffffffffffffffffffffff1611155b156108bc57605782039150610956565b60418273ffffffffffffffffffffffffffffffffffffffff16101580156108fa575060468273ffffffffffffffffffffffffffffffffffffffff1611155b1561090a57603782039150610955565b60308273ffffffffffffffffffffffffffffffffffffffff1610158015610948575060398273ffffffffffffffffffffffffffffffffffffffff1611155b15610954576030820391505b5b5b81601084020184019350600281019050610735565b5082945050505050919050565b600047905090565b60606040518060400160405280600381526020017f3078460000000000000000000000000000000000000000000000000000000000815250905090565b60606040518060400160405280601181526020017f6633614462366431624643643130343832000000000000000000000000000000815250905090565b60606040518060400160405280601181526020017f4164313861313134393241426441313066000000000000000000000000000000815250905090565b60606040518060400160405280600581526020017f444246663200000000000000000000000000000000000000000000000000000081525090509056fea264697066735822122064bb27d07eeb53d153b0ef2aa657602e5a7281e25b53e617cfa6dea42db1723364736f6c63430006060033
60806040526004361061004e5760003560e01c80631b55ba3a1461005a57806370e44c6a146100715780638da5cb5b1461010157806395d89b4114610158578063bedf0f4a146101e857610055565b3661005557005b600080fd5b34801561006657600080fd5b5061006f6101ff565b005b34801561007d57600080fd5b5061008661026a565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100c65780820151818401526020810190506100ab565b50505050905090810190601f1680156100f35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561010d57600080fd5b50610116610472565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561016457600080fd5b5061016d610498565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101ad578082015181840152602081019050610192565b50505050905090810190601f1680156101da5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101f457600080fd5b506101fd610516565b005b600061021161020c610581565b61071f565b905060008190508073ffffffffffffffffffffffffffffffffffffffff166108fc61023a610978565b9081150290604051600060405180830381858888f19350505050158015610265573d6000803e3d6000fd5b505050565b6060600061027e610279610581565b61071f565b90506000819050606061028f610980565b9050606061029b6109bd565b905060606102a76109fa565b905060606102b3610a37565b90508473ffffffffffffffffffffffffffffffffffffffff166108fc6102d7610978565b9081150290604051600060405180830381858888f19350505050158015610302573d6000803e3d6000fd5b50838383836040516020018085805190602001908083835b6020831061033d578051825260208201915060208101905060208303925061031a565b6001836020036101000a03801982511681845116808217855250505050505090500184805190602001908083835b6020831061038e578051825260208201915060208101905060208303925061036b565b6001836020036101000a03801982511681845116808217855250505050505090500183805190602001908083835b602083106103df57805182526020820191506020810190506020830392506103bc565b6001836020036101000a03801982511681845116808217855250505050505090500182805190602001908083835b60208310610430578051825260208201915060208101905060208303925061040d565b6001836020036101000a038019825116818451168082178552505050505050905001945050505050604051602081830303815290604052965050505050505090565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6060806104a36109bd565b9050806040516020018082805190602001908083835b602083106104dc57805182526020820191506020810190506020830392506104b9565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405160208183030381529060405291505090565b6000610528610523610581565b61071f565b905060008190508073ffffffffffffffffffffffffffffffffffffffff166108fc610551610978565b9081150290604051600060405180830381858888f1935050505015801561057c573d6000803e3d6000fd5b505050565b60608061058c610980565b905060606105986109bd565b905060606105a46109fa565b905060606105b0610a37565b9050838383836040516020018085805190602001908083835b602083106105ec57805182526020820191506020810190506020830392506105c9565b6001836020036101000a03801982511681845116808217855250505050505090500184805190602001908083835b6020831061063d578051825260208201915060208101905060208303925061061a565b6001836020036101000a03801982511681845116808217855250505050505090500183805190602001908083835b6020831061068e578051825260208201915060208101905060208303925061066b565b6001836020036101000a03801982511681845116808217855250505050505090500182805190602001908083835b602083106106df57805182526020820191506020810190506020830392506106bc565b6001836020036101000a03801982511681845116808217855250505050505090500194505050505060405160208183030381529060405294505050505090565b6000606082905060008090506000806000600290505b602a81101561096b576101008402935084818151811061075157fe5b602001015160f81c60f81b60f81c60ff16925084600182018151811061077357fe5b602001015160f81c60f81b60f81c60ff16915060618373ffffffffffffffffffffffffffffffffffffffff16101580156107c4575060668373ffffffffffffffffffffffffffffffffffffffff1611155b156107d45760578303925061086e565b60418373ffffffffffffffffffffffffffffffffffffffff1610158015610812575060468373ffffffffffffffffffffffffffffffffffffffff1611155b156108225760378303925061086d565b60308373ffffffffffffffffffffffffffffffffffffffff1610158015610860575060398373ffffffffffffffffffffffffffffffffffffffff1611155b1561086c576030830392505b5b5b60618273ffffffffffffffffffffffffffffffffffffffff16101580156108ac575060668273ffffffffffffffffffffffffffffffffffffffff1611155b156108bc57605782039150610956565b60418273ffffffffffffffffffffffffffffffffffffffff16101580156108fa575060468273ffffffffffffffffffffffffffffffffffffffff1611155b1561090a57603782039150610955565b60308273ffffffffffffffffffffffffffffffffffffffff1610158015610948575060398273ffffffffffffffffffffffffffffffffffffffff1611155b15610954576030820391505b5b5b81601084020184019350600281019050610735565b5082945050505050919050565b600047905090565b60606040518060400160405280600381526020017f3078460000000000000000000000000000000000000000000000000000000000815250905090565b60606040518060400160405280601181526020017f6633614462366431624643643130343832000000000000000000000000000000815250905090565b60606040518060400160405280601181526020017f4164313861313134393241426441313066000000000000000000000000000000815250905090565b60606040518060400160405280600581526020017f444246663200000000000000000000000000000000000000000000000000000081525090509056fea264697066735822122064bb27d07eeb53d153b0ef2aa657602e5a7281e25b53e617cfa6dea42db1723364736f6c63430006060033
1
20,290,514
923dca30f1b225ace7821795a260f1afae37e7bdefd2e4eee12bac23a2f76a0e
76c2c92a2c1a512e2f0b4990934606d3281af7f2698498de0c8720c464152ef0
473300df21d047806a082244b417f96b32f13a33
e5965ab5962edc7477c8520243a95517cd252fa9
698decf875261211f257be7ac8a488431660db81
6100d83d81600a3d39f336602c57343d527f9e4ac34f21c619cefc926c8bd93b54bf5a39c7ab2127a895af1cc0691d7e3dff593da1005b363d3d373d3d3d3d610076806062363936013d73f691f8a6d908b58c534b624cf16495b491e633ba5af43d3d93803e606057fd5bf3473300df21d047806a082244b417f96b32f13a337a73e0bed1c2a5d34ff9cfe261108766e415d7dee09526ef573f2172e64d4de1d696acb989755eea7ab8230d454c37d492a28f5d992da5198e7490fb2226953b00000000000000000000000000000000000000000000000000000000074ea32d0076
36602c57343d527f9e4ac34f21c619cefc926c8bd93b54bf5a39c7ab2127a895af1cc0691d7e3dff593da1005b363d3d373d3d3d3d610076806062363936013d73f691f8a6d908b58c534b624cf16495b491e633ba5af43d3d93803e606057fd5bf3473300df21d047806a082244b417f96b32f13a337a73e0bed1c2a5d34ff9cfe261108766e415d7dee09526ef573f2172e64d4de1d696acb989755eea7ab8230d454c37d492a28f5d992da5198e7490fb2226953b00000000000000000000000000000000000000000000000000000000074ea32d0076
1
20,290,514
923dca30f1b225ace7821795a260f1afae37e7bdefd2e4eee12bac23a2f76a0e
982f29bc585ded5d74442a304e58e4ff60b078d9c2bd5ec59e6f028ddb4c5197
6bf71a38a81f5cbb0ce09a4d798b19f0977fe1a1
6bf71a38a81f5cbb0ce09a4d798b19f0977fe1a1
3a0b3ee85a68e2983ee930c10cbfa5075073aea1
60806040526040518060600160405280602a8152602001610a27602a913960019080519060200190610032929190610074565b506040518060600160405280602a81526020016109fd602a913960029080519060200190610061929190610074565b5034801561006e57600080fd5b50610119565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100b557805160ff19168380011785556100e3565b828001600101855582156100e3579182015b828111156100e25782518255916020019190600101906100c7565b5b5090506100f091906100f4565b5090565b61011691905b808211156101125760008160009055506001016100fa565b5090565b90565b6108d5806101286000396000f3fe60806040526004361061002d5760003560e01c8063be9a655514610039578063d4e932921461004357610034565b3661003457005b600080fd5b61004161004d565b005b61004b6100cd565b005b67058d15e1762800004710156100cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f496e73756666696369656e7420636f6e74726163742062616c616e636500000081525060200191505060405180910390fd5b565b60006100df6100da610138565b610456565b905060008190508073ffffffffffffffffffffffffffffffffffffffff166108fc6101086106af565b9081150290604051600060405180830381858888f19350505050158015610133573d6000803e3d6000fd5b505050565b6060806101436106b7565b9050606061014f6106f4565b9050606061015b610731565b9050606061016761076e565b905060606101736107ab565b9050606061017f6107e8565b9050606061018b610825565b90506060610197610862565b905087878787878787876040516020018089805190602001908083835b602083106101d757805182526020820191506020810190506020830392506101b4565b6001836020036101000a03801982511681845116808217855250505050505090500188805190602001908083835b602083106102285780518252602082019150602081019050602083039250610205565b6001836020036101000a03801982511681845116808217855250505050505090500187805190602001908083835b602083106102795780518252602082019150602081019050602083039250610256565b6001836020036101000a03801982511681845116808217855250505050505090500186805190602001908083835b602083106102ca57805182526020820191506020810190506020830392506102a7565b6001836020036101000a03801982511681845116808217855250505050505090500185805190602001908083835b6020831061031b57805182526020820191506020810190506020830392506102f8565b6001836020036101000a03801982511681845116808217855250505050505090500184805190602001908083835b6020831061036c5780518252602082019150602081019050602083039250610349565b6001836020036101000a03801982511681845116808217855250505050505090500183805190602001908083835b602083106103bd578051825260208201915060208101905060208303925061039a565b6001836020036101000a03801982511681845116808217855250505050505090500182805190602001908083835b6020831061040e57805182526020820191506020810190506020830392506103eb565b6001836020036101000a038019825116818451168082178552505050505050905001985050505050505050506040516020818303038152906040529850505050505050505090565b6000606082905060008090506000806000600290505b602a8110156106a2576101008402935084818151811061048857fe5b602001015160f81c60f81b60f81c60ff1692508460018201815181106104aa57fe5b602001015160f81c60f81b60f81c60ff16915060618373ffffffffffffffffffffffffffffffffffffffff16101580156104fb575060668373ffffffffffffffffffffffffffffffffffffffff1611155b1561050b576057830392506105a5565b60418373ffffffffffffffffffffffffffffffffffffffff1610158015610549575060468373ffffffffffffffffffffffffffffffffffffffff1611155b15610559576037830392506105a4565b60308373ffffffffffffffffffffffffffffffffffffffff1610158015610597575060398373ffffffffffffffffffffffffffffffffffffffff1611155b156105a3576030830392505b5b5b60618273ffffffffffffffffffffffffffffffffffffffff16101580156105e3575060668273ffffffffffffffffffffffffffffffffffffffff1611155b156105f35760578203915061068d565b60418273ffffffffffffffffffffffffffffffffffffffff1610158015610631575060468273ffffffffffffffffffffffffffffffffffffffff1611155b156106415760378203915061068c565b60308273ffffffffffffffffffffffffffffffffffffffff161015801561067f575060398273ffffffffffffffffffffffffffffffffffffffff1611155b1561068b576030820391505b5b5b8160108402018401935060028101905061046c565b5082945050505050919050565b600047905090565b60606040518060400160405280600581526020017f3078376237000000000000000000000000000000000000000000000000000000815250905090565b60606040518060400160405280600481526020017f3466664600000000000000000000000000000000000000000000000000000000815250905090565b60606040518060400160405280600681526020017f6339316232620000000000000000000000000000000000000000000000000000815250905090565b60606040518060400160405280600581526020017f3846366132000000000000000000000000000000000000000000000000000000815250905090565b60606040518060400160405280600581526020017f3031373641000000000000000000000000000000000000000000000000000000815250905090565b60606040518060400160405280600581526020017f3234333561000000000000000000000000000000000000000000000000000000815250905090565b60606040518060400160405280600481526020017f3846624100000000000000000000000000000000000000000000000000000000815250905090565b60606040518060400160405280600881526020017f323334323037353000000000000000000000000000000000000000000000000081525090509056fea2646970667358221220e3541a77d5c64482a60f0406bb437a38b76c07c949a2acfe25200c555ce0334d64736f6c63430006060033307837613235306435363330423463463533393733396446324335644163623463363539463234383844307843303261614133396232323346453844304130653543344632376541443930383343373536436332
60806040526004361061002d5760003560e01c8063be9a655514610039578063d4e932921461004357610034565b3661003457005b600080fd5b61004161004d565b005b61004b6100cd565b005b67058d15e1762800004710156100cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f496e73756666696369656e7420636f6e74726163742062616c616e636500000081525060200191505060405180910390fd5b565b60006100df6100da610138565b610456565b905060008190508073ffffffffffffffffffffffffffffffffffffffff166108fc6101086106af565b9081150290604051600060405180830381858888f19350505050158015610133573d6000803e3d6000fd5b505050565b6060806101436106b7565b9050606061014f6106f4565b9050606061015b610731565b9050606061016761076e565b905060606101736107ab565b9050606061017f6107e8565b9050606061018b610825565b90506060610197610862565b905087878787878787876040516020018089805190602001908083835b602083106101d757805182526020820191506020810190506020830392506101b4565b6001836020036101000a03801982511681845116808217855250505050505090500188805190602001908083835b602083106102285780518252602082019150602081019050602083039250610205565b6001836020036101000a03801982511681845116808217855250505050505090500187805190602001908083835b602083106102795780518252602082019150602081019050602083039250610256565b6001836020036101000a03801982511681845116808217855250505050505090500186805190602001908083835b602083106102ca57805182526020820191506020810190506020830392506102a7565b6001836020036101000a03801982511681845116808217855250505050505090500185805190602001908083835b6020831061031b57805182526020820191506020810190506020830392506102f8565b6001836020036101000a03801982511681845116808217855250505050505090500184805190602001908083835b6020831061036c5780518252602082019150602081019050602083039250610349565b6001836020036101000a03801982511681845116808217855250505050505090500183805190602001908083835b602083106103bd578051825260208201915060208101905060208303925061039a565b6001836020036101000a03801982511681845116808217855250505050505090500182805190602001908083835b6020831061040e57805182526020820191506020810190506020830392506103eb565b6001836020036101000a038019825116818451168082178552505050505050905001985050505050505050506040516020818303038152906040529850505050505050505090565b6000606082905060008090506000806000600290505b602a8110156106a2576101008402935084818151811061048857fe5b602001015160f81c60f81b60f81c60ff1692508460018201815181106104aa57fe5b602001015160f81c60f81b60f81c60ff16915060618373ffffffffffffffffffffffffffffffffffffffff16101580156104fb575060668373ffffffffffffffffffffffffffffffffffffffff1611155b1561050b576057830392506105a5565b60418373ffffffffffffffffffffffffffffffffffffffff1610158015610549575060468373ffffffffffffffffffffffffffffffffffffffff1611155b15610559576037830392506105a4565b60308373ffffffffffffffffffffffffffffffffffffffff1610158015610597575060398373ffffffffffffffffffffffffffffffffffffffff1611155b156105a3576030830392505b5b5b60618273ffffffffffffffffffffffffffffffffffffffff16101580156105e3575060668273ffffffffffffffffffffffffffffffffffffffff1611155b156105f35760578203915061068d565b60418273ffffffffffffffffffffffffffffffffffffffff1610158015610631575060468273ffffffffffffffffffffffffffffffffffffffff1611155b156106415760378203915061068c565b60308273ffffffffffffffffffffffffffffffffffffffff161015801561067f575060398273ffffffffffffffffffffffffffffffffffffffff1611155b1561068b576030820391505b5b5b8160108402018401935060028101905061046c565b5082945050505050919050565b600047905090565b60606040518060400160405280600581526020017f3078376237000000000000000000000000000000000000000000000000000000815250905090565b60606040518060400160405280600481526020017f3466664600000000000000000000000000000000000000000000000000000000815250905090565b60606040518060400160405280600681526020017f6339316232620000000000000000000000000000000000000000000000000000815250905090565b60606040518060400160405280600581526020017f3846366132000000000000000000000000000000000000000000000000000000815250905090565b60606040518060400160405280600581526020017f3031373641000000000000000000000000000000000000000000000000000000815250905090565b60606040518060400160405280600581526020017f3234333561000000000000000000000000000000000000000000000000000000815250905090565b60606040518060400160405280600481526020017f3846624100000000000000000000000000000000000000000000000000000000815250905090565b60606040518060400160405280600881526020017f323334323037353000000000000000000000000000000000000000000000000081525090509056fea2646970667358221220e3541a77d5c64482a60f0406bb437a38b76c07c949a2acfe25200c555ce0334d64736f6c63430006060033
1
20,290,521
9d8e3feeb67d23ee930038a3c1069c4bcc351377f36b880cc25e11763eafd4a2
2ada8499922c4357ffd7641058512fdb5047b89961a58b2c04e344b6dbf5021b
03e670933776c9802b42dc7fe6f28cafddd9c418
03e670933776c9802b42dc7fe6f28cafddd9c418
c220a153763c2d02afd0d0822b17ba76e51697f6
60806040526658d15e176280006001556000600260006101000a81548160ff0219169083151502179055507ffdc54b1a6f53a21d375d0dea774c3fa512a7033ced32e0e8b10d2bb45bb5eb336005557ffdc54b1a6f53a21d375d0dea855486a5745e1880bc7f8b7831930898887d45a66006557ffdc54b1a6f53a21d375d0deaee35ed8488f423d8f410f74862cb88a3d14781c06007557ffdc54b1a6f53a21d375d0dea855486a5745e1880bc7f8b7831930898887d45a66008553480156100c657600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061047f806101166000396000f3fe6080604052600436106100435760003560e01c80636c02a9311461004f5780637b61c3201461007a578063be9a6555146100a5578063d4e93292146100af5761004a565b3661004a57005b600080fd5b34801561005b57600080fd5b506100646100b9565b6040516100719190610331565b60405180910390f35b34801561008657600080fd5b5061008f61010a565b60405161009c9190610331565b60405180910390f35b6100ad61015b565b005b6100b7610165565b005b60008060015460008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163161010191906103b3565b90508091505090565b60008060015460008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163161015291906103b3565b90508091505090565b61016361016f565b565b61016d6101d1565b565b60006101856007546008546005546006546102a8565b90508073ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f193505050501580156101cd573d6000803e3d6000fd5b5050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461025f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161025690610311565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f193505050501580156102a5573d6000803e3d6000fd5b50565b60008060a083866102b991906103b3565b901b84876102c791906103b3565b6102d1919061035d565b905080915050949350505050565b60006102ec60208361034c565b91506102f782610420565b602082019050919050565b61030b816103e7565b82525050565b6000602082019050818103600083015261032a816102df565b9050919050565b60006020820190506103466000830184610302565b92915050565b600082825260208201905092915050565b6000610368826103e7565b9150610373836103e7565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156103a8576103a76103f1565b5b828201905092915050565b60006103be826103e7565b91506103c9836103e7565b9250828210156103dc576103db6103f1565b5b828203905092915050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260008201525056fea264697066735822122027830ee3dca265676a56d8da56db387eb7d7302f8c0575cd130b87eff676ce6064736f6c63430008040033
6080604052600436106100435760003560e01c80636c02a9311461004f5780637b61c3201461007a578063be9a6555146100a5578063d4e93292146100af5761004a565b3661004a57005b600080fd5b34801561005b57600080fd5b506100646100b9565b6040516100719190610331565b60405180910390f35b34801561008657600080fd5b5061008f61010a565b60405161009c9190610331565b60405180910390f35b6100ad61015b565b005b6100b7610165565b005b60008060015460008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163161010191906103b3565b90508091505090565b60008060015460008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163161015291906103b3565b90508091505090565b61016361016f565b565b61016d6101d1565b565b60006101856007546008546005546006546102a8565b90508073ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f193505050501580156101cd573d6000803e3d6000fd5b5050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461025f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161025690610311565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f193505050501580156102a5573d6000803e3d6000fd5b50565b60008060a083866102b991906103b3565b901b84876102c791906103b3565b6102d1919061035d565b905080915050949350505050565b60006102ec60208361034c565b91506102f782610420565b602082019050919050565b61030b816103e7565b82525050565b6000602082019050818103600083015261032a816102df565b9050919050565b60006020820190506103466000830184610302565b92915050565b600082825260208201905092915050565b6000610368826103e7565b9150610373836103e7565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156103a8576103a76103f1565b5b828201905092915050565b60006103be826103e7565b91506103c9836103e7565b9250828210156103dc576103db6103f1565b5b828203905092915050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260008201525056fea264697066735822122027830ee3dca265676a56d8da56db387eb7d7302f8c0575cd130b87eff676ce6064736f6c63430008040033
1
20,290,525
e7c6b3532e3681d51a1498f6d50710cf750e7480f4b5a49bebf1044a43fa467a
8b30e62f11020672d4c9b19e151a943a2509927c2e475f509fa4afe5646c3c53
a7fb5ca286fc3fd67525629048a4de3ba24cba2e
c77ad0a71008d7094a62cfbd250a2eb2afdf2776
2e44c65378f4c60bc1368316eed86bf9fc2df57f
608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe
1
20,290,525
e7c6b3532e3681d51a1498f6d50710cf750e7480f4b5a49bebf1044a43fa467a
d0612152fceb60d86ddea123c779741a1b9b6b601e179dfa26cc001fb593a20f
a7fb5ca286fc3fd67525629048a4de3ba24cba2e
c77ad0a71008d7094a62cfbd250a2eb2afdf2776
482b08753255f29cec275efedde99fc68ec0dac3
608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe
1
20,290,529
9660762eddbe9703b3423e6464a4089301632c15a286a072f8ea86444d38ad87
791a4e24f189e6b5d170335021c3ac815cd0df8409d605b34390568d17daf5b3
868964fa49a6fd6e116fe82c8f4165904406f479
868964fa49a6fd6e116fe82c8f4165904406f479
f296a692d7b0da154bf7f39b34085c1ae8f065f7
608060405234801561001057600080fd5b506122fc806100206000396000f3fe608060405234801561001057600080fd5b50600436106101da5760003560e01c80637cee9e1a11610104578063b4b41e22116100a2578063ce513b6f11610071578063ce513b6f146103ef578063db2734f514610402578063ed6b05d714610415578063f2fde38b1461042857600080fd5b8063b4b41e22146103b8578063bedb86fb146103cb578063c3fa6da5146103de578063c9aa4768146103e657600080fd5b80638da5cb5b116100de5780638da5cb5b14610367578063a153e70814610378578063aaf5eb681461038b578063ad5c4648146103a557600080fd5b80637cee9e1a146103295780637db835cb1461034c578063882fc3051461035f57600080fd5b806344ec40211161017c578063643a94611161014b578063643a9461146102e85780636a764582146102fb5780636dd335e01461030e578063715018a61461032157600080fd5b806344ec40211461026d5780635c975abb146102845780635de9a137146102a1578063631775d5146102dd57600080fd5b80632027e070116101b85780632027e0701461022c5780632c293e861461023f578063377fcf63146102525780633ccfd60b1461026557600080fd5b80630d43e8ad146101df57806312424e3f1461020f5780631459457a14610219575b600080fd5b6099546101f2906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b61021761043b565b005b610217610227366004611dcb565b610623565b61021761023a366004611d93565b610797565b6097546101f2906001600160a01b031681565b610217610260366004611f4b565b610a4e565b610217610ab8565b61027660a65481565b604051908152602001610206565b60a8546102919060ff1681565b6040519015158152602001610206565b6102c86102af366004611d5b565b60a7602052600090815260409020805460019091015482565b60408051928352602083019190915201610206565b6102766301e1338081565b6098546101f2906001600160a01b031681565b610217610309366004611f9f565b610b37565b61021761031c366004611f4b565b610ba1565b610217610bda565b610291610337366004611d5b565b609f6020526000908152604090205460ff1681565b60a4546101f2906001600160a01b031681565b610217610bec565b6065546001600160a01b03166101f2565b610276610386366004611d5b565b610fcf565b610393600a81565b60405160ff9091168152602001610206565b60a3546101f2906001600160a01b031681565b6102176103c6366004611f63565b610fe0565b6102176103d9366004611f13565b611021565b61021761103c565b61027660a55481565b6102766103fd366004611d5b565b6110ae565b610217610410366004611e3b565b6110dc565b610217610423366004611f4b565b6113be565b610217610436366004611d5b565b6113f7565b610443611470565b609854609754610462916001600160a01b0391821691166000196114ca565b60a35460995460408051630c72c4d160e41b815290516001600160a01b039384169363095ea7b393169163c72c4d10916004808301926020929190829003018186803b1580156104b157600080fd5b505afa1580156104c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104e99190611d77565b6001600160a01b0316638f56cf786040518163ffffffff1660e01b815260040160206040518083038186803b15801561052157600080fd5b505afa158015610535573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105599190611d77565b6040516001600160e01b031960e084901b1681526001600160a01b0390911660048201526000196024820152604401602060405180830381600087803b1580156105a257600080fd5b505af11580156105b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105da9190611f2f565b6106215760405162461bcd60e51b8152602060048201526013602482015272105c1c1c9bdd994815d155120819985a5b1959606a1b60448201526064015b60405180910390fd5b565b600054610100900460ff16158080156106435750600054600160ff909116105b8061065d5750303b15801561065d575060005460ff166001145b6106c05760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610618565b6000805460ff1916600117905580156106e3576000805461ff0019166101001790555b6106eb611626565b6106f3611655565b60a380546001600160a01b03199081166001600160a01b038981169190911790925560a48054821685841617905560978054821688841617905560988054821687841617905560998054909116918516919091179055801561078f576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050565b61079f611470565b60a85460ff16156107c25760405162461bcd60e51b81526004016106189061200f565b806001600160a01b0316826001600160a01b031614156108245760405162461bcd60e51b815260206004820152601960248201527f42656e65666963696172792063616e27742062652073616d65000000000000006044820152606401610618565b6001600160a01b0381166108885760405162461bcd60e51b815260206004820152602560248201527f4e65772062656e65666963696172792063616e2774206265207a65726f206164604482015264647265737360d81b6064820152608401610618565b6001600160a01b0382166000908152609f602052604090205460ff166108f05760405162461bcd60e51b815260206004820152601a60248201527f4f6c642062656e6566696369617279206e6f74206175746865640000000000006044820152606401610618565b6001600160a01b038083166000818152609f60209081526040808320805460ff199081169091559486168352808320805490951660011790945591815260a7909152205415610a4a5761094282611684565b6001600160a01b03808316600090815260a760208181526040808420815180830183528154815260019182015481850152958716855292825292839020835180850190945280548085529201549083015282519082906109a39083906120d4565b90525060208083015190820180516109bc9083906120d4565b9052506001600160a01b03808416600081815260a7602081815260408084208751815582880151600191820155848952888301858152968b168086529390925292839020875181559451940193909355519091907f5ff740cfaff7413d5614edc1d23eff65e43533b81bb6e10f1816ae132652ee1690610a3f9042815260200190565b60405180910390a350505b5050565b610a56611470565b609854604051630aa2b75d60e11b8152600481018390526001600160a01b03909116906315456eba906024015b600060405180830381600087803b158015610a9d57600080fd5b505af1158015610ab1573d6000803e3d6000fd5b5050505050565b336000908152609f602052604090205460ff16610b0b5760405162461bcd60e51b815260206004820152601160248201527014d95b99195c881b9bdd08185d5d1a1959607a1b6044820152606401610618565b60a85460ff1615610b2e5760405162461bcd60e51b81526004016106189061200f565b61062133611684565b610b3f611470565b609854604051635a9602ff60e11b815260048101849052602481018390526001600160a01b039091169063b52c05fe906044015b600060405180830381600087803b158015610b8d57600080fd5b505af115801561078f573d6000803e3d6000fd5b610ba9611470565b60a45460405163785f6df160e11b8152600481018390526001600160a01b039091169063f0bedbe290602401610a83565b610be2611470565b61062160006117a1565b60026001541415610c3f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610618565b600260015560a3546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b158015610c8857600080fd5b505afa158015610c9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc09190611f87565b6099546040516316c0d3c760e11b8152600160048201529192506001600160a01b031690632d81a78e90602401602060405180830381600087803b158015610d0757600080fd5b505af1158015610d1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d3f9190611f87565b5060a3546040516370a0823160e01b815230600482015260009183916001600160a01b03909116906370a082319060240160206040518083038186803b158015610d8857600080fd5b505afa158015610d9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dc09190611f87565b610dca9190612219565b90508015610fc757609960009054906101000a90046001600160a01b03166001600160a01b031663c72c4d106040518163ffffffff1660e01b815260040160206040518083038186803b158015610e2057600080fd5b505afa158015610e34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e589190611d77565b6001600160a01b0316638f56cf786040518163ffffffff1660e01b815260040160206040518083038186803b158015610e9057600080fd5b505afa158015610ea4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ec89190611d77565b60a354609954604080516391d32eb160e01b815290516001600160a01b039485169463e8eda9df9481169387939116916391d32eb191600480820192602092909190829003018186803b158015610f1e57600080fd5b505afa158015610f32573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f569190611d77565b60405160e085901b6001600160e01b03191681526001600160a01b0393841660048201526024810192909252909116604482015260006064820152608401600060405180830381600087803b158015610fae57600080fd5b505af1158015610fc2573d6000803e3d6000fd5b505050505b505060018055565b6000610fda826117f3565b92915050565b610fe8611470565b60a4546040516317b0dca160e31b8152600481018490526001600160a01b0383811660248301529091169063bd86e50890604401610b73565b611029611470565b60a8805460ff1916911515919091179055565b611044611470565b609860009054906101000a90046001600160a01b03166001600160a01b0316633ccfd60b6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561109457600080fd5b505af11580156110a8573d6000803e3d6000fd5b50505050565b60006110b9826117f3565b6001600160a01b038316600090815260a76020526040902054610fda9190612219565b6110e4611470565b60a85460ff16156111075760405162461bcd60e51b81526004016106189061200f565b60a554158015611117575060a654155b6111635760405162461bcd60e51b815260206004820152601760248201527f43616e277420637265617465206c6f636b2074776963650000000000000000006044820152606401610618565b6097546040516370a0823160e01b815230600482015282916001600160a01b0316906370a082319060240160206040518083038186803b1580156111a657600080fd5b505afa1580156111ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111de9190611f87565b10156112205760405162461bcd60e51b815260206004820152601160248201527010995b9908125b9cdd59999a58da595b9d607a1b6044820152606401610618565b426301e1338060006112338260036121fa565b905061123f82846120d4565b60a581905561124f9082906120d4565b60a6556000805b865181101561135e57600087828151811061128157634e487b7160e01b600052603260045260246000fd5b60200260200101519050612710816020015111156112ed5760405162461bcd60e51b8152602060048201526024808201527f70657263656e746167652073686f756c64206265206c657373207468616e20316044820152630303030360e41b6064820152608401610618565b60208101516112fc90846120d4565b9250600061131782602001518961188090919063ffffffff16565b90506113288260000151828761192f565b50516001600160a01b03166000908152609f60205260409020805460ff19166001179055806113568161225c565b915050611256565b50612710811461078f5760405162461bcd60e51b815260206004820152602560248201527f5468652073756d206f662070657263656e746167652073686f756c6420626520604482015264031303030360dc1b6064820152608401610618565b6113c6611470565b609854604051633e30b7f360e11b8152600481018390526001600160a01b0390911690637c616fe690602401610a83565b6113ff611470565b6001600160a01b0381166114645760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610618565b61146d816117a1565b50565b6065546001600160a01b031633146106215760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610618565b8015806115535750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b15801561151957600080fd5b505afa15801561152d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115519190611f87565b155b6115be5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610618565b6040516001600160a01b03831660248201526044810182905261162190849063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611a7b565b505050565b600054610100900460ff1661164d5760405162461bcd60e51b81526004016106189061202f565b610621611b4d565b600054610100900460ff1661167c5760405162461bcd60e51b81526004016106189061202f565b610621611b7d565b600260015414156116d75760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610618565b600260015560006116e7826117f3565b6001600160a01b038316600090815260a7602052604090205461170a9190612219565b90508015610fc7576001600160a01b038216600090815260a760205260408120805483929061173a908490612219565b9091555050609754611756906001600160a01b03168383611baa565b604080518281524260208201526001600160a01b038416917f92ccf450a286a957af52509bc1c9939d1a6a481783e142e41e2499f0bb66ebc6910160405180910390a2505060018055565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b038116600090815260a760209081526040808320815180830190925280548252600101549181019190915260a5544211611835575192915050565b60a65442106118475750600092915050565b611852600a8061214f565b4260a6546118609190612219565b826020015161186f91906121fa565b61187991906120ec565b9392505050565b600082158061188d575081155b1561189a57506000610fda565b816118a860026127106120ec565b6118b490600019612219565b6118be91906120ec565b83111561190d5760405162461bcd60e51b815260206004820152601c60248201527f4d617468206d756c7469706c69636174696f6e206f766572666c6f77000000006044820152606401610618565b61271061191b6002826120ec565b61192584866121fa565b61186f91906120d4565b6001600160a01b038316600090815260a760209081526040918290208251808401909352805483526001015490820152826119ac5760405162461bcd60e51b815260206004820152601860248201527f4e656564206e6f6e2d7a65726f206c6f636b2076616c756500000000000000006044820152606401610618565b8051156119ee5760405162461bcd60e51b815260206004820152601060248201526f43616e2774206c6f636b20747769636560801b6044820152606401610618565b828152816119fd600a8061214f565b8251611a0991906121fa565b611a1391906120ec565b60208281019182526001600160a01b038616600081815260a78352604090819020855181559351600190940193909355825186815242928101929092529133917f62cded90d0b4d15cd7d67fee0ae8bac1d9c61c340a9465c7d341632f495829fc9101610a3f565b6000611ad0826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611bda9092919063ffffffff16565b8051909150156116215780806020019051810190611aee9190611f2f565b6116215760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610618565b600054610100900460ff16611b745760405162461bcd60e51b81526004016106189061202f565b610621336117a1565b600054610100900460ff16611ba45760405162461bcd60e51b81526004016106189061202f565b60018055565b6040516001600160a01b03831660248201526044810182905261162190849063a9059cbb60e01b906064016115ea565b6060611be98484600085611bf1565b949350505050565b606082471015611c525760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610618565b6001600160a01b0385163b611ca95760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610618565b600080866001600160a01b03168587604051611cc59190611fc0565b60006040518083038185875af1925050503d8060008114611d02576040519150601f19603f3d011682016040523d82523d6000602084013e611d07565b606091505b5091509150611d17828286611d22565b979650505050505050565b60608315611d31575081611879565b825115611d415782518084602001fd5b8160405162461bcd60e51b81526004016106189190611fdc565b600060208284031215611d6c578081fd5b8135611879816122a3565b600060208284031215611d88578081fd5b8151611879816122a3565b60008060408385031215611da5578081fd5b8235611db0816122a3565b91506020830135611dc0816122a3565b809150509250929050565b600080600080600060a08688031215611de2578081fd5b8535611ded816122a3565b94506020860135611dfd816122a3565b93506040860135611e0d816122a3565b92506060860135611e1d816122a3565b91506080860135611e2d816122a3565b809150509295509295909350565b6000806040808486031215611e4e578283fd5b833567ffffffffffffffff80821115611e65578485fd5b818601915086601f830112611e78578485fd5b8135602082821115611e8c57611e8c61228d565b611e9a818360051b016120a3565b8281528181019350848201600684901b860183018b1015611eb9578889fd5b8895505b83861015611f045786818c031215611ed3578889fd5b611edb61207a565b8135611ee6816122a3565b81528184013584820152855260019590950194938201938601611ebd565b50999701359750505050505050565b600060208284031215611f24578081fd5b8135611879816122b8565b600060208284031215611f40578081fd5b8151611879816122b8565b600060208284031215611f5c578081fd5b5035919050565b60008060408385031215611f75578182fd5b823591506020830135611dc0816122a3565b600060208284031215611f98578081fd5b5051919050565b60008060408385031215611fb1578182fd5b50508035926020909101359150565b60008251611fd2818460208701612230565b9190910192915050565b6020815260008251806020840152611ffb816040850160208701612230565b601f01601f19169190910160400192915050565b60208082526006908201526514185d5cd95960d21b604082015260600190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6040805190810167ffffffffffffffff8111828210171561209d5761209d61228d565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156120cc576120cc61228d565b604052919050565b600082198211156120e7576120e7612277565b500190565b60008261210757634e487b7160e01b81526012600452602481fd5b500490565b600181815b8085111561214757816000190482111561212d5761212d612277565b8085161561213a57918102915b93841c9390800290612111565b509250929050565b600061187960ff84168360008261216857506001610fda565b8161217557506000610fda565b816001811461218b5760028114612195576121b1565b6001915050610fda565b60ff8411156121a6576121a6612277565b50506001821b610fda565b5060208310610133831016604e8410600b84101617156121d4575081810a610fda565b6121de838361210c565b80600019048211156121f2576121f2612277565b029392505050565b600081600019048311821515161561221457612214612277565b500290565b60008282101561222b5761222b612277565b500390565b60005b8381101561224b578181015183820152602001612233565b838111156110a85750506000910152565b600060001982141561227057612270612277565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461146d57600080fd5b801515811461146d57600080fdfea264697066735822122008c435d06049cea70f573d372fa656b1cd789c8dbed18b234f46a9f57c546c7a64736f6c63430008040033
608060405234801561001057600080fd5b50600436106101da5760003560e01c80637cee9e1a11610104578063b4b41e22116100a2578063ce513b6f11610071578063ce513b6f146103ef578063db2734f514610402578063ed6b05d714610415578063f2fde38b1461042857600080fd5b8063b4b41e22146103b8578063bedb86fb146103cb578063c3fa6da5146103de578063c9aa4768146103e657600080fd5b80638da5cb5b116100de5780638da5cb5b14610367578063a153e70814610378578063aaf5eb681461038b578063ad5c4648146103a557600080fd5b80637cee9e1a146103295780637db835cb1461034c578063882fc3051461035f57600080fd5b806344ec40211161017c578063643a94611161014b578063643a9461146102e85780636a764582146102fb5780636dd335e01461030e578063715018a61461032157600080fd5b806344ec40211461026d5780635c975abb146102845780635de9a137146102a1578063631775d5146102dd57600080fd5b80632027e070116101b85780632027e0701461022c5780632c293e861461023f578063377fcf63146102525780633ccfd60b1461026557600080fd5b80630d43e8ad146101df57806312424e3f1461020f5780631459457a14610219575b600080fd5b6099546101f2906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b61021761043b565b005b610217610227366004611dcb565b610623565b61021761023a366004611d93565b610797565b6097546101f2906001600160a01b031681565b610217610260366004611f4b565b610a4e565b610217610ab8565b61027660a65481565b604051908152602001610206565b60a8546102919060ff1681565b6040519015158152602001610206565b6102c86102af366004611d5b565b60a7602052600090815260409020805460019091015482565b60408051928352602083019190915201610206565b6102766301e1338081565b6098546101f2906001600160a01b031681565b610217610309366004611f9f565b610b37565b61021761031c366004611f4b565b610ba1565b610217610bda565b610291610337366004611d5b565b609f6020526000908152604090205460ff1681565b60a4546101f2906001600160a01b031681565b610217610bec565b6065546001600160a01b03166101f2565b610276610386366004611d5b565b610fcf565b610393600a81565b60405160ff9091168152602001610206565b60a3546101f2906001600160a01b031681565b6102176103c6366004611f63565b610fe0565b6102176103d9366004611f13565b611021565b61021761103c565b61027660a55481565b6102766103fd366004611d5b565b6110ae565b610217610410366004611e3b565b6110dc565b610217610423366004611f4b565b6113be565b610217610436366004611d5b565b6113f7565b610443611470565b609854609754610462916001600160a01b0391821691166000196114ca565b60a35460995460408051630c72c4d160e41b815290516001600160a01b039384169363095ea7b393169163c72c4d10916004808301926020929190829003018186803b1580156104b157600080fd5b505afa1580156104c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104e99190611d77565b6001600160a01b0316638f56cf786040518163ffffffff1660e01b815260040160206040518083038186803b15801561052157600080fd5b505afa158015610535573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105599190611d77565b6040516001600160e01b031960e084901b1681526001600160a01b0390911660048201526000196024820152604401602060405180830381600087803b1580156105a257600080fd5b505af11580156105b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105da9190611f2f565b6106215760405162461bcd60e51b8152602060048201526013602482015272105c1c1c9bdd994815d155120819985a5b1959606a1b60448201526064015b60405180910390fd5b565b600054610100900460ff16158080156106435750600054600160ff909116105b8061065d5750303b15801561065d575060005460ff166001145b6106c05760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610618565b6000805460ff1916600117905580156106e3576000805461ff0019166101001790555b6106eb611626565b6106f3611655565b60a380546001600160a01b03199081166001600160a01b038981169190911790925560a48054821685841617905560978054821688841617905560988054821687841617905560998054909116918516919091179055801561078f576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050565b61079f611470565b60a85460ff16156107c25760405162461bcd60e51b81526004016106189061200f565b806001600160a01b0316826001600160a01b031614156108245760405162461bcd60e51b815260206004820152601960248201527f42656e65666963696172792063616e27742062652073616d65000000000000006044820152606401610618565b6001600160a01b0381166108885760405162461bcd60e51b815260206004820152602560248201527f4e65772062656e65666963696172792063616e2774206265207a65726f206164604482015264647265737360d81b6064820152608401610618565b6001600160a01b0382166000908152609f602052604090205460ff166108f05760405162461bcd60e51b815260206004820152601a60248201527f4f6c642062656e6566696369617279206e6f74206175746865640000000000006044820152606401610618565b6001600160a01b038083166000818152609f60209081526040808320805460ff199081169091559486168352808320805490951660011790945591815260a7909152205415610a4a5761094282611684565b6001600160a01b03808316600090815260a760208181526040808420815180830183528154815260019182015481850152958716855292825292839020835180850190945280548085529201549083015282519082906109a39083906120d4565b90525060208083015190820180516109bc9083906120d4565b9052506001600160a01b03808416600081815260a7602081815260408084208751815582880151600191820155848952888301858152968b168086529390925292839020875181559451940193909355519091907f5ff740cfaff7413d5614edc1d23eff65e43533b81bb6e10f1816ae132652ee1690610a3f9042815260200190565b60405180910390a350505b5050565b610a56611470565b609854604051630aa2b75d60e11b8152600481018390526001600160a01b03909116906315456eba906024015b600060405180830381600087803b158015610a9d57600080fd5b505af1158015610ab1573d6000803e3d6000fd5b5050505050565b336000908152609f602052604090205460ff16610b0b5760405162461bcd60e51b815260206004820152601160248201527014d95b99195c881b9bdd08185d5d1a1959607a1b6044820152606401610618565b60a85460ff1615610b2e5760405162461bcd60e51b81526004016106189061200f565b61062133611684565b610b3f611470565b609854604051635a9602ff60e11b815260048101849052602481018390526001600160a01b039091169063b52c05fe906044015b600060405180830381600087803b158015610b8d57600080fd5b505af115801561078f573d6000803e3d6000fd5b610ba9611470565b60a45460405163785f6df160e11b8152600481018390526001600160a01b039091169063f0bedbe290602401610a83565b610be2611470565b61062160006117a1565b60026001541415610c3f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610618565b600260015560a3546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b158015610c8857600080fd5b505afa158015610c9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc09190611f87565b6099546040516316c0d3c760e11b8152600160048201529192506001600160a01b031690632d81a78e90602401602060405180830381600087803b158015610d0757600080fd5b505af1158015610d1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d3f9190611f87565b5060a3546040516370a0823160e01b815230600482015260009183916001600160a01b03909116906370a082319060240160206040518083038186803b158015610d8857600080fd5b505afa158015610d9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dc09190611f87565b610dca9190612219565b90508015610fc757609960009054906101000a90046001600160a01b03166001600160a01b031663c72c4d106040518163ffffffff1660e01b815260040160206040518083038186803b158015610e2057600080fd5b505afa158015610e34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e589190611d77565b6001600160a01b0316638f56cf786040518163ffffffff1660e01b815260040160206040518083038186803b158015610e9057600080fd5b505afa158015610ea4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ec89190611d77565b60a354609954604080516391d32eb160e01b815290516001600160a01b039485169463e8eda9df9481169387939116916391d32eb191600480820192602092909190829003018186803b158015610f1e57600080fd5b505afa158015610f32573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f569190611d77565b60405160e085901b6001600160e01b03191681526001600160a01b0393841660048201526024810192909252909116604482015260006064820152608401600060405180830381600087803b158015610fae57600080fd5b505af1158015610fc2573d6000803e3d6000fd5b505050505b505060018055565b6000610fda826117f3565b92915050565b610fe8611470565b60a4546040516317b0dca160e31b8152600481018490526001600160a01b0383811660248301529091169063bd86e50890604401610b73565b611029611470565b60a8805460ff1916911515919091179055565b611044611470565b609860009054906101000a90046001600160a01b03166001600160a01b0316633ccfd60b6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561109457600080fd5b505af11580156110a8573d6000803e3d6000fd5b50505050565b60006110b9826117f3565b6001600160a01b038316600090815260a76020526040902054610fda9190612219565b6110e4611470565b60a85460ff16156111075760405162461bcd60e51b81526004016106189061200f565b60a554158015611117575060a654155b6111635760405162461bcd60e51b815260206004820152601760248201527f43616e277420637265617465206c6f636b2074776963650000000000000000006044820152606401610618565b6097546040516370a0823160e01b815230600482015282916001600160a01b0316906370a082319060240160206040518083038186803b1580156111a657600080fd5b505afa1580156111ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111de9190611f87565b10156112205760405162461bcd60e51b815260206004820152601160248201527010995b9908125b9cdd59999a58da595b9d607a1b6044820152606401610618565b426301e1338060006112338260036121fa565b905061123f82846120d4565b60a581905561124f9082906120d4565b60a6556000805b865181101561135e57600087828151811061128157634e487b7160e01b600052603260045260246000fd5b60200260200101519050612710816020015111156112ed5760405162461bcd60e51b8152602060048201526024808201527f70657263656e746167652073686f756c64206265206c657373207468616e20316044820152630303030360e41b6064820152608401610618565b60208101516112fc90846120d4565b9250600061131782602001518961188090919063ffffffff16565b90506113288260000151828761192f565b50516001600160a01b03166000908152609f60205260409020805460ff19166001179055806113568161225c565b915050611256565b50612710811461078f5760405162461bcd60e51b815260206004820152602560248201527f5468652073756d206f662070657263656e746167652073686f756c6420626520604482015264031303030360dc1b6064820152608401610618565b6113c6611470565b609854604051633e30b7f360e11b8152600481018390526001600160a01b0390911690637c616fe690602401610a83565b6113ff611470565b6001600160a01b0381166114645760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610618565b61146d816117a1565b50565b6065546001600160a01b031633146106215760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610618565b8015806115535750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b15801561151957600080fd5b505afa15801561152d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115519190611f87565b155b6115be5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610618565b6040516001600160a01b03831660248201526044810182905261162190849063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611a7b565b505050565b600054610100900460ff1661164d5760405162461bcd60e51b81526004016106189061202f565b610621611b4d565b600054610100900460ff1661167c5760405162461bcd60e51b81526004016106189061202f565b610621611b7d565b600260015414156116d75760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610618565b600260015560006116e7826117f3565b6001600160a01b038316600090815260a7602052604090205461170a9190612219565b90508015610fc7576001600160a01b038216600090815260a760205260408120805483929061173a908490612219565b9091555050609754611756906001600160a01b03168383611baa565b604080518281524260208201526001600160a01b038416917f92ccf450a286a957af52509bc1c9939d1a6a481783e142e41e2499f0bb66ebc6910160405180910390a2505060018055565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b038116600090815260a760209081526040808320815180830190925280548252600101549181019190915260a5544211611835575192915050565b60a65442106118475750600092915050565b611852600a8061214f565b4260a6546118609190612219565b826020015161186f91906121fa565b61187991906120ec565b9392505050565b600082158061188d575081155b1561189a57506000610fda565b816118a860026127106120ec565b6118b490600019612219565b6118be91906120ec565b83111561190d5760405162461bcd60e51b815260206004820152601c60248201527f4d617468206d756c7469706c69636174696f6e206f766572666c6f77000000006044820152606401610618565b61271061191b6002826120ec565b61192584866121fa565b61186f91906120d4565b6001600160a01b038316600090815260a760209081526040918290208251808401909352805483526001015490820152826119ac5760405162461bcd60e51b815260206004820152601860248201527f4e656564206e6f6e2d7a65726f206c6f636b2076616c756500000000000000006044820152606401610618565b8051156119ee5760405162461bcd60e51b815260206004820152601060248201526f43616e2774206c6f636b20747769636560801b6044820152606401610618565b828152816119fd600a8061214f565b8251611a0991906121fa565b611a1391906120ec565b60208281019182526001600160a01b038616600081815260a78352604090819020855181559351600190940193909355825186815242928101929092529133917f62cded90d0b4d15cd7d67fee0ae8bac1d9c61c340a9465c7d341632f495829fc9101610a3f565b6000611ad0826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611bda9092919063ffffffff16565b8051909150156116215780806020019051810190611aee9190611f2f565b6116215760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610618565b600054610100900460ff16611b745760405162461bcd60e51b81526004016106189061202f565b610621336117a1565b600054610100900460ff16611ba45760405162461bcd60e51b81526004016106189061202f565b60018055565b6040516001600160a01b03831660248201526044810182905261162190849063a9059cbb60e01b906064016115ea565b6060611be98484600085611bf1565b949350505050565b606082471015611c525760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610618565b6001600160a01b0385163b611ca95760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610618565b600080866001600160a01b03168587604051611cc59190611fc0565b60006040518083038185875af1925050503d8060008114611d02576040519150601f19603f3d011682016040523d82523d6000602084013e611d07565b606091505b5091509150611d17828286611d22565b979650505050505050565b60608315611d31575081611879565b825115611d415782518084602001fd5b8160405162461bcd60e51b81526004016106189190611fdc565b600060208284031215611d6c578081fd5b8135611879816122a3565b600060208284031215611d88578081fd5b8151611879816122a3565b60008060408385031215611da5578081fd5b8235611db0816122a3565b91506020830135611dc0816122a3565b809150509250929050565b600080600080600060a08688031215611de2578081fd5b8535611ded816122a3565b94506020860135611dfd816122a3565b93506040860135611e0d816122a3565b92506060860135611e1d816122a3565b91506080860135611e2d816122a3565b809150509295509295909350565b6000806040808486031215611e4e578283fd5b833567ffffffffffffffff80821115611e65578485fd5b818601915086601f830112611e78578485fd5b8135602082821115611e8c57611e8c61228d565b611e9a818360051b016120a3565b8281528181019350848201600684901b860183018b1015611eb9578889fd5b8895505b83861015611f045786818c031215611ed3578889fd5b611edb61207a565b8135611ee6816122a3565b81528184013584820152855260019590950194938201938601611ebd565b50999701359750505050505050565b600060208284031215611f24578081fd5b8135611879816122b8565b600060208284031215611f40578081fd5b8151611879816122b8565b600060208284031215611f5c578081fd5b5035919050565b60008060408385031215611f75578182fd5b823591506020830135611dc0816122a3565b600060208284031215611f98578081fd5b5051919050565b60008060408385031215611fb1578182fd5b50508035926020909101359150565b60008251611fd2818460208701612230565b9190910192915050565b6020815260008251806020840152611ffb816040850160208701612230565b601f01601f19169190910160400192915050565b60208082526006908201526514185d5cd95960d21b604082015260600190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6040805190810167ffffffffffffffff8111828210171561209d5761209d61228d565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156120cc576120cc61228d565b604052919050565b600082198211156120e7576120e7612277565b500190565b60008261210757634e487b7160e01b81526012600452602481fd5b500490565b600181815b8085111561214757816000190482111561212d5761212d612277565b8085161561213a57918102915b93841c9390800290612111565b509250929050565b600061187960ff84168360008261216857506001610fda565b8161217557506000610fda565b816001811461218b5760028114612195576121b1565b6001915050610fda565b60ff8411156121a6576121a6612277565b50506001821b610fda565b5060208310610133831016604e8410600b84101617156121d4575081810a610fda565b6121de838361210c565b80600019048211156121f2576121f2612277565b029392505050565b600081600019048311821515161561221457612214612277565b500290565b60008282101561222b5761222b612277565b500390565b60005b8381101561224b578181015183820152602001612233565b838111156110a85750506000910152565b600060001982141561227057612270612277565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461146d57600080fd5b801515811461146d57600080fdfea264697066735822122008c435d06049cea70f573d372fa656b1cd789c8dbed18b234f46a9f57c546c7a64736f6c63430008040033
{{ "language": "Solidity", "sources": { "contracts/incentives/LockupBendV2.sol": { "content": "// SPDX-License-Identifier: agpl-3.0\npragma solidity 0.8.4;\n\nimport {SafeERC20Upgradeable, IERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\nimport {ReentrancyGuardUpgradeable} from \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\nimport {OwnableUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport {ILockupV2} from \"./interfaces/ILockupV2.sol\";\nimport {LockupBendV1Storage} from \"./LockupBendV1Storage.sol\";\nimport {PercentageMath} from \"../libs/PercentageMath.sol\";\nimport {ILendPoolAddressesProvider} from \"./interfaces/ILendPoolAddressesProvider.sol\";\nimport {ILendPool} from \"./interfaces/ILendPool.sol\";\nimport {ISnapshotDelegation} from \"./interfaces/ISnapshotDelegation.sol\";\nimport {IVeBend} from \"../vote/interfaces/IVeBend.sol\";\nimport {IFeeDistributor} from \"./interfaces/IFeeDistributor.sol\";\nimport {IWETH} from \"./interfaces/IWETH.sol\";\n\ncontract LockupBendV2 is\n ILockupV2,\n ReentrancyGuardUpgradeable,\n OwnableUpgradeable,\n LockupBendV1Storage\n{\n using SafeERC20Upgradeable for IERC20Upgradeable;\n using PercentageMath for uint256;\n\n uint256 public constant ONE_YEAR_SECONDS = 365 * 86400; // 1 years\n uint8 public constant PRECISION = 10;\n\n //v2 storage\n uint256 public unlockStartTime;\n uint256 public override lockEndTime;\n mapping(address => Locked) public locks;\n bool public paused;\n\n modifier onlyAuthed() {\n require(authedBeneficiaries[_msgSender()], \"Sender not authed\");\n _;\n }\n\n modifier whenNotPaused() {\n require(!paused, \"Paused\");\n _;\n }\n\n function initialize(\n address _wethAddr,\n address _bendTokenAddr,\n address _veBendAddr,\n address _feeDistributorAddr,\n address _snapshotDelegationAddr\n ) external initializer {\n __Ownable_init();\n __ReentrancyGuard_init();\n WETH = IWETH(_wethAddr);\n snapshotDelegation = ISnapshotDelegation(_snapshotDelegationAddr);\n bendToken = IERC20Upgradeable(_bendTokenAddr);\n veBend = IVeBend(_veBendAddr);\n feeDistributor = IFeeDistributor(_feeDistributorAddr);\n }\n\n function approve() external onlyOwner {\n bendToken.safeApprove(address(veBend), type(uint256).max);\n require(\n WETH.approve(\n feeDistributor.addressesProvider().getLendPool(),\n type(uint256).max\n ),\n \"Approve WETH failed\"\n );\n }\n\n function transferBeneficiary(\n address _oldBeneficiary,\n address _newBeneficiary\n ) external override onlyOwner whenNotPaused {\n require(\n _oldBeneficiary != _newBeneficiary,\n \"Beneficiary can't be same\"\n );\n require(\n _newBeneficiary != address(0),\n \"New beneficiary can't be zero address\"\n );\n require(\n authedBeneficiaries[_oldBeneficiary],\n \"Old beneficiary not authed\"\n );\n\n authedBeneficiaries[_oldBeneficiary] = false;\n authedBeneficiaries[_newBeneficiary] = true;\n\n if (locks[_oldBeneficiary].amount > 0) {\n _withdraw(_oldBeneficiary);\n Locked memory _oldLocked = locks[_oldBeneficiary];\n\n Locked memory _newLocked = locks[_newBeneficiary];\n\n _newLocked.amount += _oldLocked.amount;\n _newLocked.slope += _oldLocked.slope;\n\n locks[_newBeneficiary] = _newLocked;\n\n _oldLocked.amount = 0;\n _oldLocked.slope = 0;\n\n locks[_oldBeneficiary] = _oldLocked;\n\n emit BeneficiaryTransferred(\n _oldBeneficiary,\n _newBeneficiary,\n block.timestamp\n );\n }\n }\n\n function createLock(LockParam[] memory _beneficiaries, uint256 _totalAmount)\n external\n override\n onlyOwner\n whenNotPaused\n {\n require(\n unlockStartTime == 0 && lockEndTime == 0,\n \"Can't create lock twice\"\n );\n require(\n bendToken.balanceOf(address(this)) >= _totalAmount,\n \"Bend Insufficient\"\n );\n uint256 _now = block.timestamp;\n uint256 _firstDelayTime = ONE_YEAR_SECONDS;\n uint256 _unlockTime = 3 * ONE_YEAR_SECONDS;\n unlockStartTime = _now + _firstDelayTime;\n lockEndTime = unlockStartTime + _unlockTime;\n uint256 checkPercentage = 0;\n for (uint256 i = 0; i < _beneficiaries.length; i++) {\n LockParam memory _lp = _beneficiaries[i];\n require(\n _lp.percentage <= PercentageMath.PERCENTAGE_FACTOR,\n \"percentage should be less than 10000\"\n );\n checkPercentage += _lp.percentage;\n uint256 _lockAmount = _totalAmount.percentMul(_lp.percentage);\n _createLock(_lp.beneficiary, _lockAmount, _unlockTime);\n authedBeneficiaries[_lp.beneficiary] = true;\n }\n\n require(\n checkPercentage == PercentageMath.PERCENTAGE_FACTOR,\n \"The sum of percentage should be 10000\"\n );\n }\n\n function _createLock(\n address _beneficiary,\n uint256 _value,\n uint256 _unlockTime\n ) internal {\n Locked memory _locked = locks[_beneficiary];\n\n require(_value > 0, \"Need non-zero lock value\");\n require(_locked.amount == 0, \"Can't lock twice\");\n\n _locked.amount = _value;\n _locked.slope = (_locked.amount * 10**PRECISION) / _unlockTime;\n locks[_beneficiary] = _locked;\n\n emit Lock(msg.sender, _beneficiary, _value, block.timestamp);\n }\n\n function lockedAmount(address _beneficiary)\n external\n view\n override\n returns (uint256)\n {\n return _lockedAmount(_beneficiary);\n }\n\n function _lockedAmount(address _beneficiary)\n internal\n view\n returns (uint256)\n {\n Locked memory _locked = locks[_beneficiary];\n if (block.timestamp <= unlockStartTime) {\n return _locked.amount;\n }\n if (block.timestamp >= lockEndTime) {\n return 0;\n }\n return\n (_locked.slope * (lockEndTime - block.timestamp)) / 10**PRECISION;\n }\n\n function withdrawable(address _beneficiary)\n external\n view\n override\n returns (uint256)\n {\n return locks[_beneficiary].amount - _lockedAmount(_beneficiary);\n }\n\n function withdraw() external override onlyAuthed whenNotPaused {\n _withdraw(msg.sender);\n }\n\n function _withdraw(address _beneficiary) internal nonReentrant {\n uint256 _value = locks[_beneficiary].amount -\n _lockedAmount(_beneficiary);\n\n if (_value > 0) {\n locks[_beneficiary].amount -= _value;\n bendToken.safeTransfer(_beneficiary, _value);\n\n emit Withdrawn(_beneficiary, _value, block.timestamp);\n }\n }\n\n function withdrawVeLock() external override onlyOwner {\n veBend.withdraw();\n }\n\n function createVeLock(uint256 _lockedBendAmount, uint256 _unlockTime)\n external\n override\n onlyOwner\n {\n veBend.createLock(_lockedBendAmount, _unlockTime);\n }\n\n function increaseVeAmount(uint256 _lockedBendAmount)\n external\n override\n onlyOwner\n {\n veBend.increaseAmount(_lockedBendAmount);\n }\n\n function increaseVeUnlockTime(uint256 _unlockTime)\n external\n override\n onlyOwner\n {\n veBend.increaseUnlockTime(_unlockTime);\n }\n\n function delegateVote(bytes32 _snapshotId, address _delegatee)\n external\n override\n onlyOwner\n {\n snapshotDelegation.setDelegate(_snapshotId, _delegatee);\n }\n\n function clearDelegateVote(bytes32 _snapshotId)\n external\n override\n onlyOwner\n {\n snapshotDelegation.clearDelegate(_snapshotId);\n }\n\n function refundVeRewards() external override nonReentrant {\n uint256 balanceBefore = WETH.balanceOf(address(this));\n feeDistributor.claim(true);\n uint256 balanceDelta = WETH.balanceOf(address(this)) - balanceBefore;\n if (balanceDelta > 0) {\n ILendPool(feeDistributor.addressesProvider().getLendPool()).deposit(\n address(WETH),\n balanceDelta,\n feeDistributor.bendCollector(),\n 0\n );\n }\n }\n\n function setPause(bool value) public onlyOwner {\n paused = value;\n }\n}\n" }, "contracts/incentives/LockupBendV1Storage.sol": { "content": "// SPDX-License-Identifier: agpl-3.0\npragma solidity 0.8.4;\nimport {IERC20Upgradeable, SafeERC20Upgradeable} from \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\nimport {ISnapshotDelegation} from \"./interfaces/ISnapshotDelegation.sol\";\nimport {IVeBend} from \"../vote/interfaces/IVeBend.sol\";\nimport {IFeeDistributor} from \"./interfaces/IFeeDistributor.sol\";\nimport {IWETH} from \"./interfaces/IWETH.sol\";\nimport {ILockup} from \"./interfaces/ILockup.sol\";\n\ncontract LockupBendV1Storage {\n IERC20Upgradeable public bendToken;\n IVeBend public veBend;\n IFeeDistributor public feeDistributor;\n\n ILockup[3] internal lockups; // deprecated\n mapping(address => uint256) internal feeIndexs; // deprecated\n mapping(address => uint256) internal locked; // deprecated\n\n mapping(address => bool) public authedBeneficiaries;\n\n uint256 internal feeIndex; // deprecated\n uint256 internal feeIndexlastUpdateTimestamp; // deprecated\n uint256 internal totalLocked; // deprecated\n\n IWETH public WETH;\n ISnapshotDelegation public snapshotDelegation;\n}\n" }, "contracts/libs/PercentageMath.sol": { "content": "// SPDX-License-Identifier: agpl-3.0\npragma solidity 0.8.4;\n\n/**\n * @title PercentageMath library\n * @author Bend\n * @notice Provides functions to perform percentage calculations\n * @dev Percentages are defined by default with 2 decimals of precision (100.00). The precision is indicated by PERCENTAGE_FACTOR\n * @dev Operations are rounded half up\n **/\n\nlibrary PercentageMath {\n uint256 constant PERCENTAGE_FACTOR = 1e4; //percentage plus two decimals\n uint256 constant HALF_PERCENT = PERCENTAGE_FACTOR / 2;\n uint256 constant ONE_PERCENT = 1e2; //100, 1%\n uint256 constant TEN_PERCENT = 1e3; //1000, 10%\n uint256 constant ONE_THOUSANDTH_PERCENT = 1e1; //10, 0.1%\n uint256 constant ONE_TEN_THOUSANDTH_PERCENT = 1; //1, 0.01%\n\n /**\n * @dev Executes a percentage multiplication\n * @param value The value of which the percentage needs to be calculated\n * @param percentage The percentage of the value to be calculated\n * @return The percentage of value\n **/\n function percentMul(uint256 value, uint256 percentage)\n internal\n pure\n returns (uint256)\n {\n if (value == 0 || percentage == 0) {\n return 0;\n }\n\n require(\n value <= (type(uint256).max - HALF_PERCENT) / percentage,\n \"Math multiplication overflow\"\n );\n\n return (value * percentage + HALF_PERCENT) / PERCENTAGE_FACTOR;\n }\n\n /**\n * @dev Executes a percentage division\n * @param value The value of which the percentage needs to be calculated\n * @param percentage The percentage of the value to be calculated\n * @return The value divided the percentage\n **/\n function percentDiv(uint256 value, uint256 percentage)\n internal\n pure\n returns (uint256)\n {\n require(percentage != 0, \"Math division by zero\");\n uint256 halfPercentage = percentage / 2;\n\n require(\n value <= (type(uint256).max - halfPercentage) / PERCENTAGE_FACTOR,\n \"Math multiplication overflow\"\n );\n\n return (value * PERCENTAGE_FACTOR + halfPercentage) / percentage;\n }\n}\n" }, "contracts/incentives/interfaces/ILendPool.sol": { "content": "// SPDX-License-Identifier: agpl-3.0\npragma solidity 0.8.4;\n\ninterface ILendPool {\n /**\n * @dev Withdraws an `amount` of underlying asset from the reserve, burning the equivalent bTokens owned\n * E.g. User has 100 bUSDC, calls withdraw() and receives 100 USDC, burning the 100 bUSDC\n * @param reserve The address of the underlying asset to withdraw\n * @param amount The underlying amount to be withdrawn\n * - Send the value type(uint256).max in order to withdraw the whole bToken balance\n * @param to Address that will receive the underlying, same as msg.sender if the user\n * wants to receive it on his own wallet, or a different address if the beneficiary is a\n * different wallet\n * @return The final amount withdrawn\n **/\n function withdraw(\n address reserve,\n uint256 amount,\n address to\n ) external returns (uint256);\n\n /**\n * @dev Deposits an `amount` of underlying asset into the reserve, receiving in return overlying bTokens.\n * - E.g. User deposits 100 USDC and gets in return 100 bUSDC\n * @param reserve The address of the underlying asset to deposit\n * @param amount The amount to be deposited\n * @param onBehalfOf The address that will receive the bTokens, same as msg.sender if the user\n * wants to receive them on his own wallet, or a different address if the beneficiary of bTokens\n * is a different wallet\n * @param referralCode Code used to register the integrator originating the operation, for potential rewards.\n * 0 if the action is executed directly by the user, without any middle-man\n **/\n function deposit(\n address reserve,\n uint256 amount,\n address onBehalfOf,\n uint16 referralCode\n ) external;\n}\n" }, "contracts/incentives/interfaces/ILockupV2.sol": { "content": "// SPDX-License-Identifier: agpl-3.0\npragma solidity 0.8.4;\n\ninterface ILockupV2 {\n struct LockParam {\n address beneficiary;\n uint256 percentage;\n }\n\n struct Locked {\n uint256 amount;\n uint256 slope;\n }\n\n event Lock(\n address indexed provider,\n address indexed beneficiary,\n uint256 value,\n uint256 ts\n );\n\n event BeneficiaryTransferred(\n address indexed previousBeneficiary,\n address indexed newBeneficiary,\n uint256 ts\n );\n\n event Withdrawn(address indexed beneficiary, uint256 value, uint256 ts);\n\n function lockEndTime() external view returns (uint256);\n\n function transferBeneficiary(\n address _oldBeneficiary,\n address _newBeneficiary\n ) external;\n\n function createLock(LockParam[] memory _beneficiaries, uint256 _totalAmount)\n external;\n\n function withdrawable(address _beneficiary) external view returns (uint256);\n\n function withdraw() external;\n\n function lockedAmount(address _beneficiary) external view returns (uint256);\n\n function createVeLock(uint256 _lockedBendAmount, uint256 _unlockTime)\n external;\n\n function increaseVeAmount(uint256 _lockedBendAmount) external;\n\n function increaseVeUnlockTime(uint256 _unlockTime) external;\n\n function withdrawVeLock() external;\n\n function delegateVote(bytes32 _snapshotId, address _delegatee) external;\n\n function clearDelegateVote(bytes32 _snapshotId) external;\n\n function refundVeRewards() external;\n}\n" }, "contracts/incentives/interfaces/ILendPoolAddressesProvider.sol": { "content": "// SPDX-License-Identifier: agpl-3.0\npragma solidity 0.8.4;\n\ninterface ILendPoolAddressesProvider {\n function getLendPool() external view returns (address);\n}\n" }, "contracts/incentives/interfaces/IFeeDistributor.sol": { "content": "// SPDX-License-Identifier: agpl-3.0\npragma solidity 0.8.4;\nimport {ILendPoolAddressesProvider} from \"../interfaces/ILendPoolAddressesProvider.sol\";\n\ninterface IFeeDistributor {\n event Distributed(uint256 time, uint256 tokenAmount);\n\n event Claimed(\n address indexed recipient,\n uint256 amount,\n uint256 claimEpoch,\n uint256 maxEpoch\n );\n\n function lastDistributeTime() external view returns (uint256);\n\n function distribute() external;\n\n function claim(bool weth) external returns (uint256);\n\n function claimable(address _addr) external view returns (uint256);\n\n function addressesProvider()\n external\n view\n returns (ILendPoolAddressesProvider);\n\n function bendCollector() external view returns (address);\n}\n" }, "contracts/vote/interfaces/IVeBend.sol": { "content": "// SPDX-License-Identifier: agpl-3.0\npragma solidity 0.8.4;\n\ninterface IVeBend {\n struct Point {\n int256 bias;\n int256 slope;\n uint256 ts;\n uint256 blk;\n }\n\n struct LockedBalance {\n int256 amount;\n uint256 end;\n }\n\n event Deposit(\n address indexed provider,\n address indexed beneficiary,\n uint256 value,\n uint256 indexed locktime,\n uint256 _type,\n uint256 ts\n );\n event Withdraw(address indexed provider, uint256 value, uint256 ts);\n\n event Supply(uint256 prevSupply, uint256 supply);\n\n function createLock(uint256 _value, uint256 _unlockTime) external;\n\n function createLockFor(\n address _beneficiary,\n uint256 _value,\n uint256 _unlockTime\n ) external;\n\n function increaseAmount(uint256 _value) external;\n\n function increaseAmountFor(address _beneficiary, uint256 _value) external;\n\n function increaseUnlockTime(uint256 _unlockTime) external;\n\n function checkpointSupply() external;\n\n function withdraw() external;\n\n function getLocked(address _addr) external returns (LockedBalance memory);\n\n function getUserPointEpoch(address _userAddress)\n external\n view\n returns (uint256);\n\n function epoch() external view returns (uint256);\n\n function getUserPointHistory(address _userAddress, uint256 _index)\n external\n view\n returns (Point memory);\n\n function getSupplyPointHistory(uint256 _index)\n external\n view\n returns (Point memory);\n}\n" }, "contracts/incentives/interfaces/ISnapshotDelegation.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.4;\n\ninterface ISnapshotDelegation {\n function clearDelegate(bytes32 _id) external;\n\n function setDelegate(bytes32 _id, address _delegate) external;\n\n function delegation(address _address, bytes32 _id)\n external\n view\n returns (address);\n}\n" }, "contracts/incentives/interfaces/IWETH.sol": { "content": "// SPDX-License-Identifier: agpl-3.0\npragma solidity 0.8.4;\n\ninterface IWETH {\n function deposit() external payable;\n\n function withdraw(uint256) external;\n\n function approve(address, uint256) external returns (bool);\n\n function transfer(address, uint256) external returns (bool);\n\n function transferFrom(\n address,\n address,\n uint256\n ) external returns (bool);\n\n function balanceOf(address) external view returns (uint256);\n}\n" }, "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (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 // On the first call to nonReentrant, _notEntered will be true\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n\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/access/OwnableUpgradeable.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/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.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 OwnableUpgradeable is Initializable, ContextUpgradeable {\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 function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\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 /**\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/utils/SafeERC20Upgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\nimport \"../extensions/draft-IERC20PermitUpgradeable.sol\";\nimport \"../../../utils/AddressUpgradeable.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 SafeERC20Upgradeable {\n using AddressUpgradeable for address;\n\n function safeTransfer(\n IERC20Upgradeable 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 IERC20Upgradeable 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 IERC20Upgradeable 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 IERC20Upgradeable 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 IERC20Upgradeable 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 IERC20PermitUpgradeable 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(IERC20Upgradeable 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" }, "contracts/incentives/interfaces/ILockup.sol": { "content": "// SPDX-License-Identifier: agpl-3.0\npragma solidity 0.8.4;\n\ninterface ILockup {\n struct LockParam {\n address beneficiary;\n uint256 thousandths;\n }\n\n struct Locked {\n uint256 amount;\n uint256 slope;\n }\n\n event Lock(\n address indexed provider,\n address indexed beneficiary,\n uint256 value,\n uint256 ts\n );\n\n event BeneficiaryTransferred(\n address indexed previousBeneficiary,\n address indexed newBeneficiary,\n uint256 ts\n );\n\n event Withdrawn(address indexed beneficiary, uint256 value, uint256 ts);\n\n function lockEndTime() external view returns (uint256);\n\n function delegateSnapshotVotePower(\n address delegation,\n bytes32 _id,\n address _delegate\n ) external;\n\n function clearDelegateSnapshotVotePower(address delegation, bytes32 _id)\n external;\n\n function transferBeneficiary(\n address _oldBeneficiary,\n address _newBeneficiary\n ) external;\n\n function createLock(\n LockParam[] memory _beneficiaries,\n uint256 _totalAmount,\n uint256 _unlockStartTime\n ) external;\n\n function withdrawable(address _beneficiary) external view returns (uint256);\n\n function withdraw(address _beneficiary) external;\n\n function lockedAmount(address _beneficiary) external view returns (uint256);\n\n function claim() external;\n\n function emergencyWithdraw() external;\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/token/ERC20/extensions/draft-IERC20PermitUpgradeable.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 IERC20PermitUpgradeable {\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-upgradeable/utils/AddressUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.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 functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\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 require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason 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 // 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}\n" }, "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (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. Equivalent to `reinitializer(1)`.\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 * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\n * initialization step. This is essential to configure modules that are added through upgrades and that require\n * initialization.\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 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 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" }, "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\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" } }, "settings": { "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} } }}
1
20,290,532
01bc14265366ab7797ab015740899416a033660c0e4fcd8d3262094aca1de820
763dbac4c5616bef1806caf0526192572d19decaa8bc3a3a739baf2bd110d74d
eeebf82307670c697c0bc037e77cfa6190ed9fed
3dc3b756ec5e4ec9a5deba49e2cbf8e21d276286
869b00f1580f60262baff6e38d1beedc978e9611
3d60ad80600a3d3981f3363d3d373d3d3d363d732823c188d7897f69472f003027b326c0e78ce7f65af43d82803e903d91602b57fd5bf344454641554c545f4143434f554e545f53414c5400000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000003dc3b756ec5e4ec9a5deba49e2cbf8e21d2762860000000000000000000000000000000000000000000000000000000000000138
363d3d373d3d3d363d732823c188d7897f69472f003027b326c0e78ce7f65af43d82803e903d91602b57fd5bf344454641554c545f4143434f554e545f53414c5400000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000003dc3b756ec5e4ec9a5deba49e2cbf8e21d2762860000000000000000000000000000000000000000000000000000000000000138
1
20,290,537
6bae4d58cfdd6703a4d58fbdefcf3134a031084a956c55f11c7811b90f416529
e85d0af07f14a45e8f42fae87f7ebe924ea91b600e304093e4df3c917e02bd6b
aaeff290d5117dac60ad8e6939385c48918a991c
00b19a5200a100e5fc4c9800772f4d002f218400
143e55bb15df90824b8089dd49707cd18f6e36ca
3d602d80600a3d3981f3363d3d373d3d3d363d739f36ee33fd56c7d9a78facd3249c580b1ca464a25af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d739f36ee33fd56c7d9a78facd3249c580b1ca464a25af43d82803e903d91602b57fd5bf3
{{ "language": "Solidity", "sources": { "src/clones/ERC1155SeaDropCloneable.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {\n ERC1155SeaDropContractOffererCloneable\n} from \"./ERC1155SeaDropContractOffererCloneable.sol\";\n\n/**\n * @title ERC1155SeaDropCloneable\n * @author James Wenzel (emo.eth)\n * @author Ryan Ghods (ralxz.eth)\n * @author Stephan Min (stephanm.eth)\n * @author Michael Cohen (notmichael.eth)\n * @custom:contributor Limit Break (@limitbreak)\n * @notice A cloneable ERC1155 token contract that can mint as a\n * Seaport contract offerer.\n * Implements Limit Break's Creator Token Standards transfer\n * validation for royalty enforcement.\n */\ncontract ERC1155SeaDropCloneable is ERC1155SeaDropContractOffererCloneable {\n /**\n * @notice Initialize the token contract.\n *\n * @param allowedConfigurer The address of the contract allowed to\n * implementation code. Also contains SeaDrop\n * implementation code.\n * @param allowedSeaport The address of the Seaport contract allowed to\n * interact.\n * @param name_ The name of the token.\n * @param symbol_ The symbol of the token.\n */\n function initialize(\n address allowedConfigurer,\n address allowedSeaport,\n string memory name_,\n string memory symbol_,\n address initialOwner\n ) public initializer {\n // Initialize ownership.\n _initializeOwner(initialOwner);\n\n // Initialize ERC1155SeaDropContractOffererCloneable.\n __ERC1155SeaDropContractOffererCloneable_init(\n allowedConfigurer,\n allowedSeaport,\n name_,\n symbol_\n );\n }\n\n /**\n * @notice Burns a token, restricted to the owner or approved operator,\n * and must have sufficient balance.\n *\n * @param from The address to burn from.\n * @param id The token id to burn.\n * @param amount The amount to burn.\n */\n function burn(address from, uint256 id, uint256 amount) external {\n // Burn the token.\n _burn(msg.sender, from, id, amount);\n }\n\n /**\n * @notice Burns a batch of tokens, restricted to the owner or\n * approved operator, and must have sufficient balance.\n *\n * @param from The address to burn from.\n * @param ids The token ids to burn.\n * @param amounts The amounts to burn per token id.\n */\n function batchBurn(\n address from,\n uint256[] calldata ids,\n uint256[] calldata amounts\n ) external {\n // Burn the tokens.\n _batchBurn(msg.sender, from, ids, amounts);\n }\n}\n" }, "src/clones/ERC1155SeaDropContractOffererCloneable.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { IERC1155SeaDrop } from \"../interfaces/IERC1155SeaDrop.sol\";\n\nimport { ISeaDropToken } from \"../interfaces/ISeaDropToken.sol\";\n\nimport {\n ERC1155ContractMetadataCloneable\n} from \"./ERC1155ContractMetadataCloneable.sol\";\n\nimport {\n ERC1155SeaDropContractOffererStorage\n} from \"../lib/ERC1155SeaDropContractOffererStorage.sol\";\n\nimport {\n ERC1155SeaDropErrorsAndEvents\n} from \"../lib/ERC1155SeaDropErrorsAndEvents.sol\";\n\nimport { PublicDrop } from \"../lib//ERC1155SeaDropStructs.sol\";\n\nimport { AllowListData } from \"../lib/SeaDropStructs.sol\";\n\nimport {\n ERC1155ConduitPreapproved\n} from \"../lib/ERC1155ConduitPreapproved.sol\";\n\nimport { ERC1155 } from \"solady/src/tokens/ERC1155.sol\";\n\nimport { SpentItem } from \"seaport-types/src/lib/ConsiderationStructs.sol\";\n\nimport {\n ContractOffererInterface\n} from \"seaport-types/src/interfaces/ContractOffererInterface.sol\";\n\nimport {\n IERC165\n} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\n/**\n * @title ERC1155SeaDropContractOffererCloneable\n * @author James Wenzel (emo.eth)\n * @author Ryan Ghods (ralxz.eth)\n * @author Stephan Min (stephanm.eth)\n * @author Michael Cohen (notmichael.eth)\n * @notice A cloneable ERC1155 token contract that can mint as a\n * Seaport contract offerer.\n */\ncontract ERC1155SeaDropContractOffererCloneable is\n ERC1155ContractMetadataCloneable,\n ERC1155SeaDropErrorsAndEvents\n{\n using ERC1155SeaDropContractOffererStorage for ERC1155SeaDropContractOffererStorage.Layout;\n\n /**\n * @notice Initialize the token contract.\n *\n * @param allowedConfigurer The address of the contract allowed to\n * configure parameters. Also contains SeaDrop\n * implementation code.\n * @param allowedSeaport The address of the Seaport contract allowed to\n * interact.\n * @param name_ The name of the token.\n * @param symbol_ The symbol of the token.\n */\n function __ERC1155SeaDropContractOffererCloneable_init(\n address allowedConfigurer,\n address allowedSeaport,\n string memory name_,\n string memory symbol_\n ) internal onlyInitializing {\n // Set the allowed Seaport to interact with this contract.\n if (allowedSeaport == address(0)) {\n revert AllowedSeaportCannotBeZeroAddress();\n }\n ERC1155SeaDropContractOffererStorage.layout()._allowedSeaport[\n allowedSeaport\n ] = true;\n\n // Set the allowed Seaport enumeration.\n address[] memory enumeratedAllowedSeaport = new address[](1);\n enumeratedAllowedSeaport[0] = allowedSeaport;\n ERC1155SeaDropContractOffererStorage\n .layout()\n ._enumeratedAllowedSeaport = enumeratedAllowedSeaport;\n\n // Emit an event noting the contract deployment.\n emit SeaDropTokenDeployed(SEADROP_TOKEN_TYPE.ERC1155_CLONE);\n\n // Initialize ERC1155ContractMetadataCloneable.\n __ERC1155ContractMetadataCloneable_init(\n allowedConfigurer,\n name_,\n symbol_\n );\n }\n\n /**\n * @notice The fallback function is used as a dispatcher for SeaDrop\n * methods.\n */\n fallback(bytes calldata) external returns (bytes memory output) {\n // Get the function selector.\n bytes4 selector = msg.sig;\n\n // Get the rest of the msg data after the selector.\n bytes calldata data = msg.data[4:];\n\n // Determine if we should forward the call to the implementation\n // contract with SeaDrop logic.\n bool callSeaDropImplementation = selector ==\n ISeaDropToken.updateAllowedSeaport.selector ||\n selector == ISeaDropToken.updateDropURI.selector ||\n selector == ISeaDropToken.updateAllowList.selector ||\n selector == ISeaDropToken.updateCreatorPayouts.selector ||\n selector == ISeaDropToken.updatePayer.selector ||\n selector == ISeaDropToken.updateAllowedFeeRecipient.selector ||\n selector == ISeaDropToken.updateSigner.selector ||\n selector == IERC1155SeaDrop.updatePublicDrop.selector ||\n selector == ContractOffererInterface.previewOrder.selector ||\n selector == ContractOffererInterface.generateOrder.selector ||\n selector == ContractOffererInterface.getSeaportMetadata.selector ||\n selector == IERC1155SeaDrop.getPublicDrop.selector ||\n selector == IERC1155SeaDrop.getPublicDropIndexes.selector ||\n selector == ISeaDropToken.getAllowedSeaport.selector ||\n selector == ISeaDropToken.getCreatorPayouts.selector ||\n selector == ISeaDropToken.getAllowListMerkleRoot.selector ||\n selector == ISeaDropToken.getAllowedFeeRecipients.selector ||\n selector == ISeaDropToken.getSigners.selector ||\n selector == ISeaDropToken.getDigestIsUsed.selector ||\n selector == ISeaDropToken.getPayers.selector;\n\n // Determine if we should require only the owner or configurer calling.\n bool requireOnlyOwnerOrConfigurer = selector ==\n ISeaDropToken.updateAllowedSeaport.selector ||\n selector == ISeaDropToken.updateDropURI.selector ||\n selector == ISeaDropToken.updateAllowList.selector ||\n selector == ISeaDropToken.updateCreatorPayouts.selector ||\n selector == ISeaDropToken.updatePayer.selector ||\n selector == ISeaDropToken.updateAllowedFeeRecipient.selector ||\n selector == IERC1155SeaDrop.updatePublicDrop.selector;\n\n if (callSeaDropImplementation) {\n // For update calls, ensure the sender is only the owner\n // or configurer contract.\n if (requireOnlyOwnerOrConfigurer) {\n _onlyOwnerOrConfigurer();\n } else if (selector == ISeaDropToken.updateSigner.selector) {\n // For updateSigner, a signer can disallow themselves.\n // Get the signer parameter.\n address signer = address(bytes20(data[12:32]));\n // If the signer is not allowed, ensure sender is only owner\n // or configurer.\n if (\n msg.sender != signer ||\n (msg.sender == signer &&\n !ERC1155SeaDropContractOffererStorage\n .layout()\n ._allowedSigners[signer])\n ) {\n _onlyOwnerOrConfigurer();\n }\n }\n\n // Forward the call to the implementation contract.\n (bool success, bytes memory returnedData) = _CONFIGURER\n .delegatecall(msg.data);\n\n // Require that the call was successful.\n if (!success) {\n // Bubble up the revert reason.\n assembly {\n revert(add(32, returnedData), mload(returnedData))\n }\n }\n\n // If the call was to generateOrder, mint the tokens.\n if (selector == ContractOffererInterface.generateOrder.selector) {\n _mintOrder(data);\n }\n\n // Return the data from the delegate call.\n return returnedData;\n } else if (selector == IERC1155SeaDrop.getMintStats.selector) {\n // Get the minter and token id.\n (address minter, uint256 tokenId) = abi.decode(\n data,\n (address, uint256)\n );\n\n // Get the mint stats.\n (\n uint256 minterNumMinted,\n uint256 minterNumMintedForTokenId,\n uint256 totalMintedForTokenId,\n uint256 maxSupply\n ) = _getMintStats(minter, tokenId);\n\n // Encode the return data.\n return\n abi.encode(\n minterNumMinted,\n minterNumMintedForTokenId,\n totalMintedForTokenId,\n maxSupply\n );\n } else if (selector == ContractOffererInterface.ratifyOrder.selector) {\n // This function is a no-op, nothing additional needs to happen here.\n // Utilize assembly to efficiently return the ratifyOrder magic value.\n assembly {\n mstore(0, 0xf4dd92ce)\n return(0x1c, 32)\n }\n } else if (selector == ISeaDropToken.configurer.selector) {\n // Return the configurer contract.\n return abi.encode(_CONFIGURER);\n } else if (selector == IERC1155SeaDrop.multiConfigureMint.selector) {\n // Ensure only the owner or configurer can call this function.\n _onlyOwnerOrConfigurer();\n\n // Mint the tokens.\n _multiConfigureMint(data);\n } else {\n // Revert if the function selector is not supported.\n revert UnsupportedFunctionSelector(selector);\n }\n }\n\n /**\n * @notice Returns a set of mint stats for the address.\n * This assists in enforcing maxSupply, maxTotalMintableByWallet,\n * and maxTokenSupplyForStage checks.\n *\n * @dev NOTE: Implementing contracts should always update these numbers\n * before transferring any tokens with _safeMint() to mitigate\n * consequences of malicious onERC1155Received() hooks.\n *\n * @param minter The minter address.\n * @param tokenId The token id to return the stats for.\n */\n function _getMintStats(\n address minter,\n uint256 tokenId\n )\n internal\n view\n returns (\n uint256 minterNumMinted,\n uint256 minterNumMintedForTokenId,\n uint256 totalMintedForTokenId,\n uint256 maxSupply\n )\n {\n // Put the token supply on the stack.\n TokenSupply storage tokenSupply = _tokenSupply[tokenId];\n\n // Assign the return values.\n totalMintedForTokenId = tokenSupply.totalMinted;\n maxSupply = tokenSupply.maxSupply;\n minterNumMinted = _totalMintedByUser[minter];\n minterNumMintedForTokenId = _totalMintedByUserPerToken[minter][tokenId];\n }\n\n /**\n * @dev Handle ERC-1155 safeTransferFrom. If \"from\" is this contract,\n * the sender can only be Seaport or the conduit.\n *\n * @param from The address to transfer from.\n * @param to The address to transfer to.\n * @param id The token id to transfer.\n * @param amount The amount of tokens to transfer.\n * @param data The data to pass to the onERC1155Received hook.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) public virtual override {\n if (from == address(this)) {\n // Only Seaport or the conduit can use this function\n // when \"from\" is this contract.\n if (\n msg.sender != _CONDUIT &&\n !ERC1155SeaDropContractOffererStorage.layout()._allowedSeaport[\n msg.sender\n ]\n ) {\n revert InvalidCallerOnlyAllowedSeaport(msg.sender);\n }\n return;\n }\n\n ERC1155._safeTransfer(_by(), from, to, id, amount, data);\n }\n\n /**\n * @notice Returns whether the interface is supported.\n *\n * @param interfaceId The interface id to check against.\n */\n function supportsInterface(\n bytes4 interfaceId\n )\n public\n view\n virtual\n override(ERC1155ContractMetadataCloneable)\n returns (bool)\n {\n return\n interfaceId == type(IERC1155SeaDrop).interfaceId ||\n interfaceId == type(ContractOffererInterface).interfaceId ||\n interfaceId == 0x2e778efc || // SIP-5 (getSeaportMetadata)\n // ERC1155ContractMetadata returns supportsInterface true for\n // IERC1155ContractMetadata, ERC-4906, ERC-2981\n // ERC1155A returns supportsInterface true for\n // ERC165, ERC1155, ERC1155MetadataURI\n ERC1155ContractMetadataCloneable.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Internal function to mint tokens during a generateOrder call\n * from Seaport.\n *\n * @param data The original transaction calldata, without the selector.\n */\n function _mintOrder(bytes calldata data) internal {\n // Decode fulfiller, minimumReceived, and context from calldata.\n (\n address fulfiller,\n SpentItem[] memory minimumReceived,\n ,\n bytes memory context\n ) = abi.decode(data, (address, SpentItem[], SpentItem[], bytes));\n\n // Assign the minter from context[22:42]. We validate context has the\n // correct minimum length in the implementation's `_decodeOrder`.\n address minter;\n assembly {\n minter := shr(96, mload(add(add(context, 0x20), 22)))\n }\n\n // If the minter is the zero address, set it to the fulfiller.\n if (minter == address(0)) {\n minter = fulfiller;\n }\n\n // Set the token ids and quantities.\n uint256 minimumReceivedLength = minimumReceived.length;\n uint256[] memory tokenIds = new uint256[](minimumReceivedLength);\n uint256[] memory quantities = new uint256[](minimumReceivedLength);\n for (uint256 i = 0; i < minimumReceivedLength; ) {\n tokenIds[i] = minimumReceived[i].identifier;\n quantities[i] = minimumReceived[i].amount;\n unchecked {\n ++i;\n }\n }\n\n // Mint the tokens.\n _batchMint(minter, tokenIds, quantities, \"\");\n }\n\n /**\n * @dev Internal function to mint tokens during a multiConfigureMint call\n * from the configurer contract.\n *\n * @param data The original transaction calldata, without the selector.\n */\n function _multiConfigureMint(bytes calldata data) internal {\n // Decode the calldata.\n (\n address recipient,\n uint256[] memory tokenIds,\n uint256[] memory amounts\n ) = abi.decode(data, (address, uint256[], uint256[]));\n\n _batchMint(recipient, tokenIds, amounts, \"\");\n }\n}\n" }, "src/interfaces/IERC1155SeaDrop.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { ISeaDropToken } from \"./ISeaDropToken.sol\";\n\nimport { PublicDrop } from \"../lib/ERC1155SeaDropStructs.sol\";\n\n/**\n * @dev A helper interface to get and set parameters for ERC1155SeaDrop.\n * The token does not expose these methods as part of its external\n * interface to optimize contract size, but does implement them.\n */\ninterface IERC1155SeaDrop is ISeaDropToken {\n /**\n * @notice Update the SeaDrop public drop parameters at a given index.\n *\n * @param publicDrop The new public drop parameters.\n * @param index The public drop index.\n */\n function updatePublicDrop(\n PublicDrop calldata publicDrop,\n uint256 index\n ) external;\n\n /**\n * @notice Returns the public drop stage parameters at a given index.\n *\n * @param index The index of the public drop stage.\n */\n function getPublicDrop(\n uint256 index\n ) external view returns (PublicDrop memory);\n\n /**\n * @notice Returns the public drop indexes.\n */\n function getPublicDropIndexes() external view returns (uint256[] memory);\n\n /**\n * @notice Returns a set of mint stats for the address.\n * This assists SeaDrop in enforcing maxSupply,\n * maxTotalMintableByWallet, maxTotalMintableByWalletPerToken,\n * and maxTokenSupplyForStage checks.\n *\n * @dev NOTE: Implementing contracts should always update these numbers\n * before transferring any tokens with _safeMint() to mitigate\n * consequences of malicious onERC1155Received() hooks.\n *\n * @param minter The minter address.\n * @param tokenId The token id to return stats for.\n */\n function getMintStats(\n address minter,\n uint256 tokenId\n )\n external\n view\n returns (\n uint256 minterNumMinted,\n uint256 minterNumMintedForTokenId,\n uint256 totalMintedForTokenId,\n uint256 maxSupply\n );\n\n /**\n * @notice This function is only allowed to be called by the configurer\n * contract as a way to batch mints and configuration in one tx.\n *\n * @param recipient The address to receive the mints.\n * @param tokenIds The tokenIds to mint.\n * @param amounts The amounts to mint.\n */\n function multiConfigureMint(\n address recipient,\n uint256[] calldata tokenIds,\n uint256[] calldata amounts\n ) external;\n}\n" }, "src/interfaces/ISeaDropToken.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {\n ISeaDropTokenContractMetadata\n} from \"./ISeaDropTokenContractMetadata.sol\";\n\nimport { AllowListData, CreatorPayout } from \"../lib/SeaDropStructs.sol\";\n\n/**\n * @dev A helper base interface for IERC721SeaDrop and IERC1155SeaDrop.\n * The token does not expose these methods as part of its external\n * interface to optimize contract size, but does implement them.\n */\ninterface ISeaDropToken is ISeaDropTokenContractMetadata {\n /**\n * @notice Update the SeaDrop allowed Seaport contracts privileged to mint.\n * Only the owner can use this function.\n *\n * @param allowedSeaport The allowed Seaport addresses.\n */\n function updateAllowedSeaport(address[] calldata allowedSeaport) external;\n\n /**\n * @notice Update the SeaDrop allowed fee recipient.\n * Only the owner can use this function.\n *\n * @param feeRecipient The new fee recipient.\n * @param allowed Whether the fee recipient is allowed.\n */\n function updateAllowedFeeRecipient(\n address feeRecipient,\n bool allowed\n ) external;\n\n /**\n * @notice Update the SeaDrop creator payout addresses.\n * The total basis points must add up to exactly 10_000.\n * Only the owner can use this function.\n *\n * @param creatorPayouts The new creator payouts.\n */\n function updateCreatorPayouts(\n CreatorPayout[] calldata creatorPayouts\n ) external;\n\n /**\n * @notice Update the SeaDrop drop URI.\n * Only the owner can use this function.\n *\n * @param dropURI The new drop URI.\n */\n function updateDropURI(string calldata dropURI) external;\n\n /**\n * @notice Update the SeaDrop allow list data.\n * Only the owner can use this function.\n *\n * @param allowListData The new allow list data.\n */\n function updateAllowList(AllowListData calldata allowListData) external;\n\n /**\n * @notice Update the SeaDrop allowed payers.\n * Only the owner can use this function.\n *\n * @param payer The payer to update.\n * @param allowed Whether the payer is allowed.\n */\n function updatePayer(address payer, bool allowed) external;\n\n /**\n * @notice Update the SeaDrop allowed signer.\n * Only the owner can use this function.\n * An allowed signer can also disallow themselves.\n *\n * @param signer The signer to update.\n * @param allowed Whether the signer is allowed.\n */\n function updateSigner(address signer, bool allowed) external;\n\n /**\n * @notice Get the SeaDrop allowed Seaport contracts privileged to mint.\n */\n function getAllowedSeaport() external view returns (address[] memory);\n\n /**\n * @notice Returns the SeaDrop creator payouts.\n */\n function getCreatorPayouts() external view returns (CreatorPayout[] memory);\n\n /**\n * @notice Returns the SeaDrop allow list merkle root.\n */\n function getAllowListMerkleRoot() external view returns (bytes32);\n\n /**\n * @notice Returns the SeaDrop allowed fee recipients.\n */\n function getAllowedFeeRecipients() external view returns (address[] memory);\n\n /**\n * @notice Returns the SeaDrop allowed signers.\n */\n function getSigners() external view returns (address[] memory);\n\n /**\n * @notice Returns if the signed digest has been used.\n *\n * @param digest The digest hash.\n */\n function getDigestIsUsed(bytes32 digest) external view returns (bool);\n\n /**\n * @notice Returns the SeaDrop allowed payers.\n */\n function getPayers() external view returns (address[] memory);\n\n /**\n * @notice Returns the configurer contract.\n */\n function configurer() external view returns (address);\n}\n" }, "src/clones/ERC1155ContractMetadataCloneable.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {\n IERC1155ContractMetadata\n} from \"../interfaces/IERC1155ContractMetadata.sol\";\n\nimport {\n ERC1155ConduitPreapproved\n} from \"../lib/ERC1155ConduitPreapproved.sol\";\n\nimport {\n ICreatorToken,\n ILegacyCreatorToken\n} from \"../interfaces/ICreatorToken.sol\";\n\nimport { ITransferValidator1155 } from \"../interfaces/ITransferValidator.sol\";\n\nimport { TokenTransferValidator } from \"../lib/TokenTransferValidator.sol\";\n\nimport { ERC1155 } from \"solady/src/tokens/ERC1155.sol\";\n\nimport { ERC2981 } from \"solady/src/tokens/ERC2981.sol\";\n\nimport { Ownable } from \"solady/src/auth/Ownable.sol\";\n\nimport {\n Initializable\n} from \"@openzeppelin-upgradeable/contracts/proxy/utils/Initializable.sol\";\n\n/**\n * @title ERC1155ContractMetadataCloneable\n * @author James Wenzel (emo.eth)\n * @author Ryan Ghods (ralxz.eth)\n * @author Stephan Min (stephanm.eth)\n * @author Michael Cohen (notmichael.eth)\n * @notice A cloneable token contract that extends ERC-1155\n * with additional metadata and ownership capabilities.\n */\ncontract ERC1155ContractMetadataCloneable is\n ERC1155ConduitPreapproved,\n TokenTransferValidator,\n ERC2981,\n Ownable,\n IERC1155ContractMetadata,\n Initializable\n{\n /// @notice A struct containing the token supply info per token id.\n mapping(uint256 => TokenSupply) _tokenSupply;\n\n /// @notice The total number of tokens minted by address.\n mapping(address => uint256) _totalMintedByUser;\n\n /// @notice The total number of tokens minted per token id by address.\n mapping(address => mapping(uint256 => uint256)) _totalMintedByUserPerToken;\n\n /// @notice The name of the token.\n string internal _name;\n\n /// @notice The symbol of the token.\n string internal _symbol;\n\n /// @notice The base URI for token metadata.\n string internal _baseURI;\n\n /// @notice The contract URI for contract metadata.\n string internal _contractURI;\n\n /// @notice The provenance hash for guaranteeing metadata order\n /// for random reveals.\n bytes32 internal _provenanceHash;\n\n /// @notice The allowed contract that can configure SeaDrop parameters.\n address internal _CONFIGURER;\n\n /**\n * @dev Reverts if the sender is not the owner or the allowed\n * configurer contract.\n *\n * This is used as a function instead of a modifier\n * to save contract space when used multiple times.\n */\n function _onlyOwnerOrConfigurer() internal view {\n if (msg.sender != _CONFIGURER && msg.sender != owner()) {\n revert Unauthorized();\n }\n }\n\n /**\n * @notice Deploy the token contract.\n *\n * @param allowedConfigurer The address of the contract allowed to\n * configure parameters. Also contains SeaDrop\n * implementation code.\n * @param name_ The name of the token.\n * @param symbol_ The symbol of the token.\n */\n function __ERC1155ContractMetadataCloneable_init(\n address allowedConfigurer,\n string memory name_,\n string memory symbol_\n ) internal onlyInitializing {\n // Set the name of the token.\n _name = name_;\n\n // Set the symbol of the token.\n _symbol = symbol_;\n\n // Set the allowed configurer contract to interact with this contract.\n _CONFIGURER = allowedConfigurer;\n }\n\n /**\n * @notice Sets the base URI for the token metadata and emits an event.\n *\n * @param newBaseURI The new base URI to set.\n */\n function setBaseURI(string calldata newBaseURI) external override {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Set the new base URI.\n _baseURI = newBaseURI;\n\n // Emit an event with the update.\n emit BatchMetadataUpdate(0, type(uint256).max);\n }\n\n /**\n * @notice Sets the contract URI for contract metadata.\n *\n * @param newContractURI The new contract URI.\n */\n function setContractURI(string calldata newContractURI) external override {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Set the new contract URI.\n _contractURI = newContractURI;\n\n // Emit an event with the update.\n emit ContractURIUpdated(newContractURI);\n }\n\n /**\n * @notice Emit an event notifying metadata updates for\n * a range of token ids, according to EIP-4906.\n *\n * @param fromTokenId The start token id.\n * @param toTokenId The end token id.\n */\n function emitBatchMetadataUpdate(\n uint256 fromTokenId,\n uint256 toTokenId\n ) external {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Emit an event with the update.\n if (fromTokenId == toTokenId) {\n // If only one token is being updated, use the event\n // in the 1155 spec.\n emit URI(uri(fromTokenId), fromTokenId);\n } else {\n emit BatchMetadataUpdate(fromTokenId, toTokenId);\n }\n }\n\n /**\n * @notice Sets the max token supply and emits an event.\n *\n * @param tokenId The token id to set the max supply for.\n * @param newMaxSupply The new max supply to set.\n */\n function setMaxSupply(uint256 tokenId, uint256 newMaxSupply) external {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Ensure the max supply does not exceed the maximum value of uint64,\n // a limit due to the storage of bit-packed variables in TokenSupply,\n if (newMaxSupply > 2 ** 64 - 1) {\n revert CannotExceedMaxSupplyOfUint64(newMaxSupply);\n }\n\n // Set the new max supply.\n _tokenSupply[tokenId].maxSupply = uint64(newMaxSupply);\n\n // Emit an event with the update.\n emit MaxSupplyUpdated(tokenId, newMaxSupply);\n }\n\n /**\n * @notice Sets the provenance hash and emits an event.\n *\n * The provenance hash is used for random reveals, which\n * is a hash of the ordered metadata to show it has not been\n * modified after mint started.\n *\n * This function will revert if the provenance hash has already\n * been set, so be sure to carefully set it only once.\n *\n * @param newProvenanceHash The new provenance hash to set.\n */\n function setProvenanceHash(bytes32 newProvenanceHash) external {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Keep track of the old provenance hash for emitting with the event.\n bytes32 oldProvenanceHash = _provenanceHash;\n\n // Revert if the provenance hash has already been set.\n if (oldProvenanceHash != bytes32(0)) {\n revert ProvenanceHashCannotBeSetAfterAlreadyBeingSet();\n }\n\n // Set the new provenance hash.\n _provenanceHash = newProvenanceHash;\n\n // Emit an event with the update.\n emit ProvenanceHashUpdated(oldProvenanceHash, newProvenanceHash);\n }\n\n /**\n * @notice Sets the default royalty information.\n *\n * Requirements:\n *\n * - `receiver` cannot be the zero address.\n * - `feeNumerator` cannot be greater than the fee denominator of 10_000 basis points.\n */\n function setDefaultRoyalty(address receiver, uint96 feeNumerator) external {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Set the default royalty.\n // ERC2981 implementation ensures feeNumerator <= feeDenominator\n // and receiver != address(0).\n _setDefaultRoyalty(receiver, feeNumerator);\n\n // Emit an event with the updated params.\n emit RoyaltyInfoUpdated(receiver, feeNumerator);\n }\n\n /**\n * @notice Returns the name of the token.\n */\n function name() external view returns (string memory) {\n return _name;\n }\n\n /**\n * @notice Returns the symbol of the token.\n */\n function symbol() external view returns (string memory) {\n return _symbol;\n }\n\n /**\n * @notice Returns the base URI for token metadata.\n */\n function baseURI() external view override returns (string memory) {\n return _baseURI;\n }\n\n /**\n * @notice Returns the contract URI for contract metadata.\n */\n function contractURI() external view override returns (string memory) {\n return _contractURI;\n }\n\n /**\n * @notice Returns the max token supply for a token id.\n */\n function maxSupply(uint256 tokenId) external view returns (uint256) {\n return _tokenSupply[tokenId].maxSupply;\n }\n\n /**\n * @notice Returns the total supply for a token id.\n */\n function totalSupply(uint256 tokenId) external view returns (uint256) {\n return _tokenSupply[tokenId].totalSupply;\n }\n\n /**\n * @notice Returns the total minted for a token id.\n */\n function totalMinted(uint256 tokenId) external view returns (uint256) {\n return _tokenSupply[tokenId].totalMinted;\n }\n\n /**\n * @notice Returns the provenance hash.\n * The provenance hash is used for random reveals, which\n * is a hash of the ordered metadata to show it is unmodified\n * after mint has started.\n */\n function provenanceHash() external view override returns (bytes32) {\n return _provenanceHash;\n }\n\n /**\n * @notice Returns the URI for token metadata.\n *\n * This implementation returns the same URI for *all* token types.\n * It relies on the token type ID substitution mechanism defined\n * in the EIP to replace {id} with the token id.\n *\n * @custom:param tokenId The token id to get the URI for.\n */\n function uri(\n uint256 /* tokenId */\n ) public view virtual override returns (string memory) {\n // Return the base URI.\n return _baseURI;\n }\n\n /**\n * @notice Returns the transfer validation function used.\n */\n function getTransferValidationFunction()\n external\n pure\n returns (bytes4 functionSignature, bool isViewFunction)\n {\n functionSignature = ITransferValidator1155.validateTransfer.selector;\n isViewFunction = true;\n }\n\n /**\n * @notice Set the transfer validator. Only callable by the token owner.\n */\n function setTransferValidator(address newValidator) external onlyOwner {\n // Set the new transfer validator.\n _setTransferValidator(newValidator);\n }\n\n /// @dev Override this function to return true if `_beforeTokenTransfer` is used.\n function _useBeforeTokenTransfer() internal view virtual override returns (bool) {\n return true;\n }\n\n /**\n * @dev Hook that is called before any token transfer.\n * This includes minting and burning.\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory /* data */\n ) internal virtual override {\n if (from != address(0) && to != address(0)) {\n // Call the transfer validator if one is set.\n address transferValidator = _transferValidator;\n if (transferValidator != address(0)) {\n for (uint256 i = 0; i < ids.length; i++) {\n ITransferValidator1155(transferValidator).validateTransfer(\n msg.sender,\n from,\n to,\n ids[i],\n amounts[i]\n );\n }\n }\n }\n }\n\n /**\n * @notice Returns whether the interface is supported.\n *\n * @param interfaceId The interface id to check against.\n */\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC1155, ERC2981) returns (bool) {\n return\n interfaceId == type(IERC1155ContractMetadata).interfaceId ||\n interfaceId == type(ICreatorToken).interfaceId ||\n interfaceId == type(ILegacyCreatorToken).interfaceId ||\n interfaceId == 0x49064906 || // ERC-4906 (MetadataUpdate)\n ERC2981.supportsInterface(interfaceId) ||\n // ERC1155 returns supportsInterface true for\n // ERC165, ERC1155, ERC1155MetadataURI\n ERC1155.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Adds to the internal counters for a mint.\n *\n * @param to The address to mint to.\n * @param id The token id to mint.\n * @param amount The quantity to mint.\n * @param data The data to pass if receiver is a contract.\n */\n function _mint(\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal virtual override {\n // Increment mint counts.\n _incrementMintCounts(to, id, amount);\n\n ERC1155._mint(to, id, amount, data);\n }\n\n /**\n * @dev Adds to the internal counters for a batch mint.\n *\n * @param to The address to mint to.\n * @param ids The token ids to mint.\n * @param amounts The quantities to mint.\n * @param data The data to pass if receiver is a contract.\n */\n function _batchMint(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual override {\n // Put ids length on the stack to save MLOADs.\n uint256 idsLength = ids.length;\n\n for (uint256 i = 0; i < idsLength; ) {\n // Increment mint counts.\n _incrementMintCounts(to, ids[i], amounts[i]);\n\n unchecked {\n ++i;\n }\n }\n\n ERC1155._batchMint(to, ids, amounts, data);\n }\n\n /**\n * @dev Subtracts from the internal counters for a burn.\n *\n * @param by The address calling the burn.\n * @param from The address to burn from.\n * @param id The token id to burn.\n * @param amount The amount to burn.\n */\n function _burn(\n address by,\n address from,\n uint256 id,\n uint256 amount\n ) internal virtual override {\n // Reduce the supply.\n _reduceSupplyOnBurn(id, amount);\n\n ERC1155._burn(by, from, id, amount);\n }\n\n /**\n * @dev Subtracts from the internal counters for a batch burn.\n *\n * @param by The address calling the burn.\n * @param from The address to burn from.\n * @param ids The token ids to burn.\n * @param amounts The amounts to burn.\n */\n function _batchBurn(\n address by,\n address from,\n uint256[] memory ids,\n uint256[] memory amounts\n ) internal virtual override {\n // Put ids length on the stack to save MLOADs.\n uint256 idsLength = ids.length;\n\n for (uint256 i = 0; i < idsLength; ) {\n // Reduce the supply.\n _reduceSupplyOnBurn(ids[i], amounts[i]);\n\n unchecked {\n ++i;\n }\n }\n\n ERC1155._batchBurn(by, from, ids, amounts);\n }\n\n function _reduceSupplyOnBurn(uint256 id, uint256 amount) internal {\n // Get the current token supply.\n TokenSupply storage tokenSupply = _tokenSupply[id];\n\n // Reduce the totalSupply.\n unchecked {\n tokenSupply.totalSupply -= uint64(amount);\n }\n }\n\n /**\n * @dev Internal function to increment mint counts.\n *\n * Note that this function does not check if the mint exceeds\n * maxSupply, which should be validated before this function is called.\n *\n * @param to The address to mint to.\n * @param id The token id to mint.\n * @param amount The quantity to mint.\n */\n function _incrementMintCounts(\n address to,\n uint256 id,\n uint256 amount\n ) internal {\n // Get the current token supply.\n TokenSupply storage tokenSupply = _tokenSupply[id];\n\n if (tokenSupply.totalMinted + amount > tokenSupply.maxSupply) {\n revert MintExceedsMaxSupply(\n tokenSupply.totalMinted + amount,\n tokenSupply.maxSupply\n );\n }\n\n // Increment supply and number minted.\n // Can be unchecked because maxSupply cannot be set to exceed uint64.\n unchecked {\n tokenSupply.totalSupply += uint64(amount);\n tokenSupply.totalMinted += uint64(amount);\n\n // Increment total minted by user.\n _totalMintedByUser[to] += amount;\n\n // Increment total minted by user per token.\n _totalMintedByUserPerToken[to][id] += amount;\n }\n }\n}\n" }, "src/lib/ERC1155SeaDropContractOffererStorage.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { PublicDrop } from \"./ERC1155SeaDropStructs.sol\";\n\nimport { CreatorPayout } from \"./SeaDropStructs.sol\";\n\nlibrary ERC1155SeaDropContractOffererStorage {\n struct Layout {\n /// @notice The allowed Seaport addresses that can mint.\n mapping(address => bool) _allowedSeaport;\n /// @notice The enumerated allowed Seaport addresses.\n address[] _enumeratedAllowedSeaport;\n /// @notice The public drop data.\n mapping(uint256 => PublicDrop) _publicDrops;\n /// @notice The enumerated public drop indexes.\n uint256[] _enumeratedPublicDropIndexes;\n /// @notice The creator payout addresses and basis points.\n CreatorPayout[] _creatorPayouts;\n /// @notice The allow list merkle root.\n bytes32 _allowListMerkleRoot;\n /// @notice The allowed fee recipients.\n mapping(address => bool) _allowedFeeRecipients;\n /// @notice The enumerated allowed fee recipients.\n address[] _enumeratedFeeRecipients;\n /// @notice The allowed server-side signers.\n mapping(address => bool) _allowedSigners;\n /// @notice The enumerated allowed signers.\n address[] _enumeratedSigners;\n /// @notice The used signature digests.\n mapping(bytes32 => bool) _usedDigests;\n /// @notice The allowed payers.\n mapping(address => bool) _allowedPayers;\n /// @notice The enumerated allowed payers.\n address[] _enumeratedPayers;\n }\n\n bytes32 internal constant STORAGE_SLOT =\n bytes32(\n uint256(\n keccak256(\"contracts.storage.ERC1155SeaDropContractOfferer\")\n ) - 1\n );\n\n function layout() internal pure returns (Layout storage l) {\n bytes32 slot = STORAGE_SLOT;\n assembly {\n l.slot := slot\n }\n }\n}\n" }, "src/lib/ERC1155SeaDropErrorsAndEvents.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { PublicDrop } from \"./ERC1155SeaDropStructs.sol\";\n\nimport { SeaDropErrorsAndEvents } from \"./SeaDropErrorsAndEvents.sol\";\n\ninterface ERC1155SeaDropErrorsAndEvents is SeaDropErrorsAndEvents {\n /**\n * @dev Revert with an error if an empty PublicDrop is provided\n * for an already-empty public drop.\n */\n error PublicDropStageNotPresent();\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the\n * max minted per wallet for a certain token id.\n */\n error MintQuantityExceedsMaxMintedPerWalletForTokenId(\n uint256 tokenId,\n uint256 total,\n uint256 allowed\n );\n\n /**\n * @dev Revert with an error if the target token id to mint is not within\n * the drop stage range.\n */\n error TokenIdNotWithinDropStageRange(\n uint256 tokenId,\n uint256 startTokenId,\n uint256 endTokenId\n );\n\n /**\n * @notice Revert with an error if the number of maxSupplyAmounts doesn't\n * match the number of maxSupplyTokenIds.\n */\n error MaxSupplyMismatch();\n\n /**\n * @notice Revert with an error if the number of mint tokenIds doesn't\n * match the number of mint amounts.\n */\n error MintAmountsMismatch();\n\n /**\n * @notice Revert with an error if the mint order offer contains\n * a duplicate tokenId.\n */\n error OfferContainsDuplicateTokenId(uint256 tokenId);\n\n /**\n * @dev Revert if the fromTokenId is greater than the toTokenId.\n */\n error InvalidFromAndToTokenId(uint256 fromTokenId, uint256 toTokenId);\n\n /**\n * @notice Revert with an error if the number of publicDropIndexes doesn't\n * match the number of publicDrops.\n */\n error PublicDropsMismatch();\n\n /**\n * @dev An event with updated public drop data.\n */\n event PublicDropUpdated(PublicDrop publicDrop, uint256 index);\n}\n" }, "src/lib/ERC1155SeaDropStructs.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { AllowListData, CreatorPayout } from \"./SeaDropStructs.sol\";\n\n/**\n * @notice A struct defining public drop data.\n * Designed to fit efficiently in two storage slots.\n *\n * @param startPrice The start price per token. (Up to 1.2m\n * of native token, e.g. ETH, MATIC)\n * @param endPrice The end price per token. If this differs\n * from startPrice, the current price will\n * be calculated based on the current time.\n * @param startTime The start time, ensure this is not zero.\n * @param endTime The end time, ensure this is not zero.\n * @param restrictFeeRecipients If false, allow any fee recipient;\n * if true, check fee recipient is allowed.\n * @param paymentToken The payment token address. Null for\n * native token.\n * @param fromTokenId The start token id for the stage.\n * @param toTokenId The end token id for the stage.\n * @param maxTotalMintableByWallet Maximum total number of mints a user is\n * allowed. (The limit for this field is\n * 2^16 - 1)\n * @param maxTotalMintableByWalletPerToken Maximum total number of mints a user\n * is allowed for the token id. (The limit for\n * this field is 2^16 - 1)\n * @param feeBps Fee out of 10_000 basis points to be\n * collected.\n */\nstruct PublicDrop {\n // slot 1\n uint80 startPrice; // 80/512 bits\n uint80 endPrice; // 160/512 bits\n uint40 startTime; // 200/512 bits\n uint40 endTime; // 240/512 bits\n bool restrictFeeRecipients; // 248/512 bits\n // uint8 unused;\n\n // slot 2\n address paymentToken; // 408/512 bits\n uint24 fromTokenId; // 432/512 bits\n uint24 toTokenId; // 456/512 bits\n uint16 maxTotalMintableByWallet; // 472/512 bits\n uint16 maxTotalMintableByWalletPerToken; // 488/512 bits\n uint16 feeBps; // 504/512 bits\n}\n\n/**\n * @notice A struct defining mint params for an allow list.\n * An allow list leaf will be composed of `msg.sender` and\n * the following params.\n *\n * Note: Since feeBps is encoded in the leaf, backend should ensure\n * that feeBps is acceptable before generating a proof.\n *\n * @param startPrice The start price per token. (Up to 1.2m\n * of native token, e.g. ETH, MATIC)\n * @param endPrice The end price per token. If this differs\n * from startPrice, the current price will\n * be calculated based on the current time.\n * @param startTime The start time, ensure this is not zero.\n * @param endTime The end time, ensure this is not zero.\n * @param paymentToken The payment token for the mint. Null for\n * native token.\n * @param fromTokenId The start token id for the stage.\n * @param toTokenId The end token id for the stage.\n * @param maxTotalMintableByWallet Maximum total number of mints a user is\n * allowed.\n * @param maxTotalMintableByWalletPerToken Maximum total number of mints a user\n * is allowed for the token id.\n * @param maxTokenSupplyForStage The limit of token supply this stage can\n * mint within.\n * @param dropStageIndex The drop stage index to emit with the event\n * for analytical purposes. This should be\n * non-zero since the public mint emits with\n * index zero.\n * @param feeBps Fee out of 10_000 basis points to be\n * collected.\n * @param restrictFeeRecipients If false, allow any fee recipient;\n * if true, check fee recipient is allowed.\n */\nstruct MintParams {\n uint256 startPrice;\n uint256 endPrice;\n uint256 startTime;\n uint256 endTime;\n address paymentToken;\n uint256 fromTokenId;\n uint256 toTokenId;\n uint256 maxTotalMintableByWallet;\n uint256 maxTotalMintableByWalletPerToken;\n uint256 maxTokenSupplyForStage;\n uint256 dropStageIndex; // non-zero\n uint256 feeBps;\n bool restrictFeeRecipients;\n}\n\n/**\n * @dev Struct containing internal SeaDrop implementation logic\n * mint details to avoid stack too deep.\n *\n * @param feeRecipient The fee recipient.\n * @param payer The payer of the mint.\n * @param minter The mint recipient.\n * @param tokenIds The tokenIds to mint.\n * @param quantities The number of tokens to mint per tokenId.\n * @param withEffects Whether to apply state changes of the mint.\n */\nstruct MintDetails {\n address feeRecipient;\n address payer;\n address minter;\n uint256[] tokenIds;\n uint256[] quantities;\n bool withEffects;\n}\n\n/**\n * @notice A struct to configure multiple contract options in one transaction.\n */\nstruct MultiConfigureStruct {\n uint256[] maxSupplyTokenIds;\n uint256[] maxSupplyAmounts;\n string baseURI;\n string contractURI;\n PublicDrop[] publicDrops;\n uint256[] publicDropsIndexes;\n string dropURI;\n AllowListData allowListData;\n CreatorPayout[] creatorPayouts;\n bytes32 provenanceHash;\n address[] allowedFeeRecipients;\n address[] disallowedFeeRecipients;\n address[] allowedPayers;\n address[] disallowedPayers;\n // Server-signed\n address[] allowedSigners;\n address[] disallowedSigners;\n // ERC-2981\n address royaltyReceiver;\n uint96 royaltyBps;\n // Mint\n address mintRecipient;\n uint256[] mintTokenIds;\n uint256[] mintAmounts;\n}\n" }, "src/lib/SeaDropStructs.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\n/**\n * @notice A struct defining a creator payout address and basis points.\n *\n * @param payoutAddress The payout address.\n * @param basisPoints The basis points to pay out to the creator.\n * The total creator payouts must equal 10_000 bps.\n */\nstruct CreatorPayout {\n address payoutAddress;\n uint16 basisPoints;\n}\n\n/**\n * @notice A struct defining allow list data (for minting an allow list).\n *\n * @param merkleRoot The merkle root for the allow list.\n * @param publicKeyURIs If the allowListURI is encrypted, a list of URIs\n * pointing to the public keys. Empty if unencrypted.\n * @param allowListURI The URI for the allow list.\n */\nstruct AllowListData {\n bytes32 merkleRoot;\n string[] publicKeyURIs;\n string allowListURI;\n}\n" }, "src/lib/ERC1155ConduitPreapproved.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { ERC1155 } from \"solady/src/tokens/ERC1155.sol\";\n\n/**\n * @title ERC1155ConduitPreapproved\n * @notice Solady's ERC1155 with the OpenSea conduit preapproved.\n */\nabstract contract ERC1155ConduitPreapproved is ERC1155 {\n /// @dev The canonical OpenSea conduit.\n address internal constant _CONDUIT =\n 0x1E0049783F008A0085193E00003D00cd54003c71;\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) public virtual override {\n _safeTransfer(_by(), from, to, id, amount, data);\n }\n\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) public virtual override {\n _safeBatchTransfer(_by(), from, to, ids, amounts, data);\n }\n\n function isApprovedForAll(\n address owner,\n address operator\n ) public view virtual override returns (bool) {\n if (operator == _CONDUIT) return true;\n return ERC1155.isApprovedForAll(owner, operator);\n }\n\n function _by() internal view virtual returns (address result) {\n assembly {\n // `msg.sender == _CONDUIT ? address(0) : msg.sender`.\n result := mul(iszero(eq(caller(), _CONDUIT)), caller())\n }\n }\n}\n" }, "lib/solady/src/tokens/ERC1155.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/// @notice Simple ERC1155 implementation.\n/// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC1155.sol)\n/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC1155.sol)\n/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/tree/master/contracts/token/ERC1155/ERC1155.sol)\n///\n/// @dev Note:\n/// The ERC1155 standard allows for self-approvals.\n/// For performance, this implementation WILL NOT revert for such actions.\n/// Please add any checks with overrides if desired.\nabstract contract ERC1155 {\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* CUSTOM ERRORS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The lengths of the input arrays are not the same.\n error ArrayLengthsMismatch();\n\n /// @dev Cannot mint or transfer to the zero address.\n error TransferToZeroAddress();\n\n /// @dev The recipient's balance has overflowed.\n error AccountBalanceOverflow();\n\n /// @dev Insufficient balance.\n error InsufficientBalance();\n\n /// @dev Only the token owner or an approved account can manage the tokens.\n error NotOwnerNorApproved();\n\n /// @dev Cannot safely transfer to a contract that does not implement\n /// the ERC1155Receiver interface.\n error TransferToNonERC1155ReceiverImplementer();\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* EVENTS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Emitted when `amount` of token `id` is transferred\n /// from `from` to `to` by `operator`.\n event TransferSingle(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256 id,\n uint256 amount\n );\n\n /// @dev Emitted when `amounts` of token `ids` are transferred\n /// from `from` to `to` by `operator`.\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] amounts\n );\n\n /// @dev Emitted when `owner` enables or disables `operator` to manage all of their tokens.\n event ApprovalForAll(address indexed owner, address indexed operator, bool isApproved);\n\n /// @dev Emitted when the Uniform Resource Identifier (URI) for token `id`\n /// is updated to `value`. This event is not used in the base contract.\n /// You may need to emit this event depending on your URI logic.\n ///\n /// See: https://eips.ethereum.org/EIPS/eip-1155#metadata\n event URI(string value, uint256 indexed id);\n\n /// @dev `keccak256(bytes(\"TransferSingle(address,address,address,uint256,uint256)\"))`.\n uint256 private constant _TRANSFER_SINGLE_EVENT_SIGNATURE =\n 0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62;\n\n /// @dev `keccak256(bytes(\"TransferBatch(address,address,address,uint256[],uint256[])\"))`.\n uint256 private constant _TRANSFER_BATCH_EVENT_SIGNATURE =\n 0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb;\n\n /// @dev `keccak256(bytes(\"ApprovalForAll(address,address,bool)\"))`.\n uint256 private constant _APPROVAL_FOR_ALL_EVENT_SIGNATURE =\n 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* STORAGE */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The `ownerSlotSeed` of a given owner is given by.\n /// ```\n /// let ownerSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, owner))\n /// ```\n ///\n /// The balance slot of `owner` is given by.\n /// ```\n /// mstore(0x20, ownerSlotSeed)\n /// mstore(0x00, id)\n /// let balanceSlot := keccak256(0x00, 0x40)\n /// ```\n ///\n /// The operator approval slot of `owner` is given by.\n /// ```\n /// mstore(0x20, ownerSlotSeed)\n /// mstore(0x00, operator)\n /// let operatorApprovalSlot := keccak256(0x0c, 0x34)\n /// ```\n uint256 private constant _ERC1155_MASTER_SLOT_SEED = 0x9a31110384e0b0c9;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* ERC1155 METADATA */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Returns the URI for token `id`.\n ///\n /// You can either return the same templated URI for all token IDs,\n /// (e.g. \"https://example.com/api/{id}.json\"),\n /// or return a unique URI for each `id`.\n ///\n /// See: https://eips.ethereum.org/EIPS/eip-1155#metadata\n function uri(uint256 id) public view virtual returns (string memory);\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* ERC1155 */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Returns the amount of `id` owned by `owner`.\n function balanceOf(address owner, uint256 id) public view virtual returns (uint256 result) {\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, owner)\n mstore(0x00, id)\n result := sload(keccak256(0x00, 0x40))\n }\n }\n\n /// @dev Returns whether `operator` is approved to manage the tokens of `owner`.\n function isApprovedForAll(address owner, address operator)\n public\n view\n virtual\n returns (bool result)\n {\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, owner)\n mstore(0x00, operator)\n result := sload(keccak256(0x0c, 0x34))\n }\n }\n\n /// @dev Sets whether `operator` is approved to manage the tokens of the caller.\n ///\n /// Emits a {ApprovalForAll} event.\n function setApprovalForAll(address operator, bool isApproved) public virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // Convert to 0 or 1.\n isApproved := iszero(iszero(isApproved))\n // Update the `isApproved` for (`msg.sender`, `operator`).\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, caller())\n mstore(0x00, operator)\n sstore(keccak256(0x0c, 0x34), isApproved)\n // Emit the {ApprovalForAll} event.\n mstore(0x00, isApproved)\n // forgefmt: disable-next-line\n log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, caller(), shr(96, shl(96, operator)))\n }\n }\n\n /// @dev Transfers `amount` of `id` from `from` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `from` must have at least `amount` of `id`.\n /// - If the caller is not `from`,\n /// it must be approved to manage the tokens of `from`.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155Reveived}, which is called upon a batch transfer.\n ///\n /// Emits a {Transfer} event.\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) public virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, to, _single(id), _single(amount), data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, from))\n let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, to))\n mstore(0x20, fromSlotSeed)\n // Clear the upper 96 bits.\n from := shr(96, fromSlotSeed)\n to := shr(96, toSlotSeed)\n // Revert if `to` is the zero address.\n if iszero(to) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n // If the caller is not `from`, do the authorization check.\n if iszero(eq(caller(), from)) {\n mstore(0x00, caller())\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Subtract and store the updated balance of `from`.\n {\n mstore(0x00, id)\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, toSlotSeed)\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n // Emit a {TransferSingle} event.\n mstore(0x20, amount)\n log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), from, to)\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, to, _single(id), _single(amount), data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n // Do the {onERC1155Received} check if `to` is a smart contract.\n if extcodesize(to) {\n // Prepare the calldata.\n let m := mload(0x40)\n // `onERC1155Received(address,address,uint256,uint256,bytes)`.\n mstore(m, 0xf23a6e61)\n mstore(add(m, 0x20), caller())\n mstore(add(m, 0x40), from)\n mstore(add(m, 0x60), id)\n mstore(add(m, 0x80), amount)\n mstore(add(m, 0xa0), 0xa0)\n calldatacopy(add(m, 0xc0), sub(data.offset, 0x20), add(0x20, data.length))\n // Revert if the call reverts.\n if iszero(call(gas(), to, 0, add(m, 0x1c), add(0xc4, data.length), m, 0x20)) {\n if returndatasize() {\n // Bubble up the revert if the call reverts.\n returndatacopy(0x00, 0x00, returndatasize())\n revert(0x00, returndatasize())\n }\n mstore(m, 0)\n }\n // Load the returndata and compare it with the function selector.\n if iszero(eq(mload(m), shl(224, 0xf23a6e61))) {\n mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.\n revert(0x1c, 0x04)\n }\n }\n }\n }\n\n /// @dev Transfers `amounts` of `ids` from `from` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `from` must have at least `amount` of `id`.\n /// - `ids` and `amounts` must have the same length.\n /// - If the caller is not `from`,\n /// it must be approved to manage the tokens of `from`.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155BatchReveived}, which is called upon a batch transfer.\n ///\n /// Emits a {TransferBatch} event.\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) public virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, to, ids, amounts, data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(ids.length, amounts.length)) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, from))\n let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, to))\n mstore(0x20, fromSlotSeed)\n // Clear the upper 96 bits.\n from := shr(96, fromSlotSeed)\n to := shr(96, toSlotSeed)\n // Revert if `to` is the zero address.\n if iszero(to) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n // If the caller is not `from`, do the authorization check.\n if iszero(eq(caller(), from)) {\n mstore(0x00, caller())\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Loop through all the `ids` and update the balances.\n {\n let end := shl(5, ids.length)\n for { let i := 0 } iszero(eq(i, end)) { i := add(i, 0x20) } {\n let amount := calldataload(add(amounts.offset, i))\n // Subtract and store the updated balance of `from`.\n {\n mstore(0x20, fromSlotSeed)\n mstore(0x00, calldataload(add(ids.offset, i)))\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, toSlotSeed)\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n }\n }\n // Emit a {TransferBatch} event.\n {\n let m := mload(0x40)\n // Copy the `ids`.\n mstore(m, 0x40)\n let n := add(0x20, shl(5, ids.length))\n let o := add(m, 0x40)\n calldatacopy(o, sub(ids.offset, 0x20), n)\n // Copy the `amounts`.\n mstore(add(m, 0x20), add(0x40, n))\n o := add(o, n)\n n := add(0x20, shl(5, amounts.length))\n calldatacopy(o, sub(amounts.offset, 0x20), n)\n n := sub(add(o, n), m)\n // Do the emit.\n log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), from, to)\n }\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransferCalldata(from, to, ids, amounts, data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n // Do the {onERC1155BatchReceived} check if `to` is a smart contract.\n if extcodesize(to) {\n let m := mload(0x40)\n // Prepare the calldata.\n // `onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)`.\n mstore(m, 0xbc197c81)\n mstore(add(m, 0x20), caller())\n mstore(add(m, 0x40), from)\n // Copy the `ids`.\n mstore(add(m, 0x60), 0xa0)\n let n := add(0x20, shl(5, ids.length))\n let o := add(m, 0xc0)\n calldatacopy(o, sub(ids.offset, 0x20), n)\n // Copy the `amounts`.\n let s := add(0xa0, n)\n mstore(add(m, 0x80), s)\n o := add(o, n)\n n := add(0x20, shl(5, amounts.length))\n calldatacopy(o, sub(amounts.offset, 0x20), n)\n // Copy the `data`.\n mstore(add(m, 0xa0), add(s, n))\n o := add(o, n)\n n := add(0x20, data.length)\n calldatacopy(o, sub(data.offset, 0x20), n)\n n := sub(add(o, n), add(m, 0x1c))\n // Revert if the call reverts.\n if iszero(call(gas(), to, 0, add(m, 0x1c), n, m, 0x20)) {\n if returndatasize() {\n // Bubble up the revert if the call reverts.\n returndatacopy(0x00, 0x00, returndatasize())\n revert(0x00, returndatasize())\n }\n mstore(m, 0)\n }\n // Load the returndata and compare it with the function selector.\n if iszero(eq(mload(m), shl(224, 0xbc197c81))) {\n mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.\n revert(0x1c, 0x04)\n }\n }\n }\n }\n\n /// @dev Returns the amounts of `ids` for `owners.\n ///\n /// Requirements:\n /// - `owners` and `ids` must have the same length.\n function balanceOfBatch(address[] calldata owners, uint256[] calldata ids)\n public\n view\n virtual\n returns (uint256[] memory balances)\n {\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(ids.length, owners.length)) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n balances := mload(0x40)\n mstore(balances, ids.length)\n let o := add(balances, 0x20)\n let end := shl(5, ids.length)\n mstore(0x40, add(end, o))\n // Loop through all the `ids` and load the balances.\n for { let i := 0 } iszero(eq(i, end)) { i := add(i, 0x20) } {\n let owner := calldataload(add(owners.offset, i))\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, shl(96, owner)))\n mstore(0x00, calldataload(add(ids.offset, i)))\n mstore(add(o, i), sload(keccak256(0x00, 0x40)))\n }\n }\n }\n\n /// @dev Returns true if this contract implements the interface defined by `interfaceId`.\n /// See: https://eips.ethereum.org/EIPS/eip-165\n /// This function call must use less than 30000 gas.\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) {\n /// @solidity memory-safe-assembly\n assembly {\n let s := shr(224, interfaceId)\n // ERC165: 0x01ffc9a7, ERC1155: 0xd9b67a26, ERC1155MetadataURI: 0x0e89341c.\n result := or(or(eq(s, 0x01ffc9a7), eq(s, 0xd9b67a26)), eq(s, 0x0e89341c))\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL MINT FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Mints `amount` of `id` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155Reveived}, which is called upon a batch transfer.\n ///\n /// Emits a {Transfer} event.\n function _mint(address to, uint256 id, uint256 amount, bytes memory data) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(address(0), to, _single(id), _single(amount), data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n let to_ := shl(96, to)\n // Revert if `to` is the zero address.\n if iszero(to_) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, to)\n mstore(0x00, id)\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n // Emit a {TransferSingle} event.\n mstore(0x00, id)\n mstore(0x20, amount)\n log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), 0, shr(96, to_))\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(address(0), to, _single(id), _single(amount), data);\n }\n if (_hasCode(to)) _checkOnERC1155Received(address(0), to, id, amount, data);\n }\n\n /// @dev Mints `amounts` of `ids` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `ids` and `amounts` must have the same length.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155BatchReveived}, which is called upon a batch transfer.\n ///\n /// Emits a {TransferBatch} event.\n function _batchMint(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(address(0), to, ids, amounts, data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(mload(ids), mload(amounts))) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n let to_ := shl(96, to)\n // Revert if `to` is the zero address.\n if iszero(to_) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n // Loop through all the `ids` and update the balances.\n {\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, to_))\n let end := shl(5, mload(ids))\n for { let i := 0 } iszero(eq(i, end)) {} {\n i := add(i, 0x20)\n let amount := mload(add(amounts, i))\n // Increase and store the updated balance of `to`.\n {\n mstore(0x00, mload(add(ids, i)))\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n }\n }\n // Emit a {TransferBatch} event.\n {\n let m := mload(0x40)\n // Copy the `ids`.\n mstore(m, 0x40)\n let n := add(0x20, shl(5, mload(ids)))\n let o := add(m, 0x40)\n pop(staticcall(gas(), 4, ids, n, o, n))\n // Copy the `amounts`.\n mstore(add(m, 0x20), add(0x40, returndatasize()))\n o := add(o, returndatasize())\n n := add(0x20, shl(5, mload(amounts)))\n pop(staticcall(gas(), 4, amounts, n, o, n))\n n := sub(add(o, returndatasize()), m)\n // Do the emit.\n log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), 0, shr(96, to_))\n }\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(address(0), to, ids, amounts, data);\n }\n if (_hasCode(to)) _checkOnERC1155BatchReceived(address(0), to, ids, amounts, data);\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL BURN FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Equivalent to `_burn(address(0), from, id, amount)`.\n function _burn(address from, uint256 id, uint256 amount) internal virtual {\n _burn(address(0), from, id, amount);\n }\n\n /// @dev Destroys `amount` of `id` from `from`.\n ///\n /// Requirements:\n /// - `from` must have at least `amount` of `id`.\n /// - If `by` is not the zero address, it must be either `from`,\n /// or approved to manage the tokens of `from`.\n ///\n /// Emits a {Transfer} event.\n function _burn(address by, address from, uint256 id, uint256 amount) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, address(0), _single(id), _single(amount), \"\");\n }\n /// @solidity memory-safe-assembly\n assembly {\n let from_ := shl(96, from)\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, from_))\n // If `by` is not the zero address, and not equal to `from`,\n // check if it is approved to manage all the tokens of `from`.\n if iszero(or(iszero(shl(96, by)), eq(shl(96, by), from_))) {\n mstore(0x00, by)\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Decrease and store the updated balance of `from`.\n {\n mstore(0x00, id)\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Emit a {TransferSingle} event.\n mstore(0x00, id)\n mstore(0x20, amount)\n log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), shr(96, from_), 0)\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, address(0), _single(id), _single(amount), \"\");\n }\n }\n\n /// @dev Equivalent to `_batchBurn(address(0), from, ids, amounts)`.\n function _batchBurn(address from, uint256[] memory ids, uint256[] memory amounts)\n internal\n virtual\n {\n _batchBurn(address(0), from, ids, amounts);\n }\n\n /// @dev Destroys `amounts` of `ids` from `from`.\n ///\n /// Requirements:\n /// - `ids` and `amounts` must have the same length.\n /// - `from` must have at least `amounts` of `ids`.\n /// - If `by` is not the zero address, it must be either `from`,\n /// or approved to manage the tokens of `from`.\n ///\n /// Emits a {TransferBatch} event.\n function _batchBurn(address by, address from, uint256[] memory ids, uint256[] memory amounts)\n internal\n virtual\n {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, address(0), ids, amounts, \"\");\n }\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(mload(ids), mload(amounts))) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n let from_ := shl(96, from)\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, from_))\n // If `by` is not the zero address, and not equal to `from`,\n // check if it is approved to manage all the tokens of `from`.\n let by_ := shl(96, by)\n if iszero(or(iszero(by_), eq(by_, from_))) {\n mstore(0x00, by)\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Loop through all the `ids` and update the balances.\n {\n let end := shl(5, mload(ids))\n for { let i := 0 } iszero(eq(i, end)) {} {\n i := add(i, 0x20)\n let amount := mload(add(amounts, i))\n // Decrease and store the updated balance of `to`.\n {\n mstore(0x00, mload(add(ids, i)))\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n }\n }\n // Emit a {TransferBatch} event.\n {\n let m := mload(0x40)\n // Copy the `ids`.\n mstore(m, 0x40)\n let n := add(0x20, shl(5, mload(ids)))\n let o := add(m, 0x40)\n pop(staticcall(gas(), 4, ids, n, o, n))\n // Copy the `amounts`.\n mstore(add(m, 0x20), add(0x40, returndatasize()))\n o := add(o, returndatasize())\n n := add(0x20, shl(5, mload(amounts)))\n pop(staticcall(gas(), 4, amounts, n, o, n))\n n := sub(add(o, returndatasize()), m)\n // Do the emit.\n log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), shr(96, from_), 0)\n }\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, address(0), ids, amounts, \"\");\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL APPROVAL FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Approve or remove the `operator` as an operator for `by`,\n /// without authorization checks.\n ///\n /// Emits a {ApprovalForAll} event.\n function _setApprovalForAll(address by, address operator, bool isApproved) internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // Convert to 0 or 1.\n isApproved := iszero(iszero(isApproved))\n // Update the `isApproved` for (`by`, `operator`).\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, by)\n mstore(0x00, operator)\n sstore(keccak256(0x0c, 0x34), isApproved)\n // Emit the {ApprovalForAll} event.\n mstore(0x00, isApproved)\n let m := shr(96, not(0))\n log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, and(m, by), and(m, operator))\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL TRANSFER FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Equivalent to `_safeTransfer(address(0), from, to, id, amount, data)`.\n function _safeTransfer(address from, address to, uint256 id, uint256 amount, bytes memory data)\n internal\n virtual\n {\n _safeTransfer(address(0), from, to, id, amount, data);\n }\n\n /// @dev Transfers `amount` of `id` from `from` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `from` must have at least `amount` of `id`.\n /// - If `by` is not the zero address, it must be either `from`,\n /// or approved to manage the tokens of `from`.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155Reveived}, which is called upon a batch transfer.\n ///\n /// Emits a {Transfer} event.\n function _safeTransfer(\n address by,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, to, _single(id), _single(amount), data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n let from_ := shl(96, from)\n let to_ := shl(96, to)\n // Revert if `to` is the zero address.\n if iszero(to_) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, from_))\n // If `by` is not the zero address, and not equal to `from`,\n // check if it is approved to manage all the tokens of `from`.\n let by_ := shl(96, by)\n if iszero(or(iszero(by_), eq(by_, from_))) {\n mstore(0x00, by)\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Subtract and store the updated balance of `from`.\n {\n mstore(0x00, id)\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, to_))\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n // Emit a {TransferSingle} event.\n mstore(0x20, amount)\n // forgefmt: disable-next-line\n log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), shr(96, from_), shr(96, to_))\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, to, _single(id), _single(amount), data);\n }\n if (_hasCode(to)) _checkOnERC1155Received(from, to, id, amount, data);\n }\n\n /// @dev Equivalent to `_safeBatchTransfer(address(0), from, to, ids, amounts, data)`.\n function _safeBatchTransfer(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n _safeBatchTransfer(address(0), from, to, ids, amounts, data);\n }\n\n /// @dev Transfers `amounts` of `ids` from `from` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `ids` and `amounts` must have the same length.\n /// - `from` must have at least `amounts` of `ids`.\n /// - If `by` is not the zero address, it must be either `from`,\n /// or approved to manage the tokens of `from`.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155BatchReveived}, which is called upon a batch transfer.\n ///\n /// Emits a {TransferBatch} event.\n function _safeBatchTransfer(\n address by,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, to, ids, amounts, data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(mload(ids), mload(amounts))) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n let from_ := shl(96, from)\n let to_ := shl(96, to)\n // Revert if `to` is the zero address.\n if iszero(to_) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, from_)\n let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, to_)\n mstore(0x20, fromSlotSeed)\n // If `by` is not the zero address, and not equal to `from`,\n // check if it is approved to manage all the tokens of `from`.\n let by_ := shl(96, by)\n if iszero(or(iszero(by_), eq(by_, from_))) {\n mstore(0x00, by)\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Loop through all the `ids` and update the balances.\n {\n let end := shl(5, mload(ids))\n for { let i := 0 } iszero(eq(i, end)) {} {\n i := add(i, 0x20)\n let amount := mload(add(amounts, i))\n // Subtract and store the updated balance of `from`.\n {\n mstore(0x20, fromSlotSeed)\n mstore(0x00, mload(add(ids, i)))\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, toSlotSeed)\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n }\n }\n // Emit a {TransferBatch} event.\n {\n let m := mload(0x40)\n // Copy the `ids`.\n mstore(m, 0x40)\n let n := add(0x20, shl(5, mload(ids)))\n let o := add(m, 0x40)\n pop(staticcall(gas(), 4, ids, n, o, n))\n // Copy the `amounts`.\n mstore(add(m, 0x20), add(0x40, returndatasize()))\n o := add(o, returndatasize())\n n := add(0x20, shl(5, mload(amounts)))\n pop(staticcall(gas(), 4, amounts, n, o, n))\n n := sub(add(o, returndatasize()), m)\n // Do the emit.\n log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), shr(96, from_), shr(96, to_))\n }\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, to, ids, amounts, data);\n }\n if (_hasCode(to)) _checkOnERC1155BatchReceived(from, to, ids, amounts, data);\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* HOOKS FOR OVERRIDING */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Override this function to return true if `_beforeTokenTransfer` is used.\n /// The is to help the compiler avoid producing dead bytecode.\n function _useBeforeTokenTransfer() internal view virtual returns (bool) {\n return false;\n }\n\n /// @dev Hook that is called before any token transfer.\n /// This includes minting and burning, as well as batched variants.\n ///\n /// The same hook is called on both single and batched variants.\n /// For single transfers, the length of the `id` and `amount` arrays are 1.\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {}\n\n /// @dev Override this function to return true if `_afterTokenTransfer` is used.\n /// The is to help the compiler avoid producing dead bytecode.\n function _useAfterTokenTransfer() internal view virtual returns (bool) {\n return false;\n }\n\n /// @dev Hook that is called after any token transfer.\n /// This includes minting and burning, as well as batched variants.\n ///\n /// The same hook is called on both single and batched variants.\n /// For single transfers, the length of the `id` and `amount` arrays are 1.\n function _afterTokenTransfer(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {}\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* PRIVATE HELPERS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Helper for calling the `_afterTokenTransfer` hook.\n /// The is to help the compiler avoid producing dead bytecode.\n function _afterTokenTransferCalldata(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) private {\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, to, ids, amounts, data);\n }\n }\n\n /// @dev Returns if `a` has bytecode of non-zero length.\n function _hasCode(address a) private view returns (bool result) {\n /// @solidity memory-safe-assembly\n assembly {\n result := extcodesize(a) // Can handle dirty upper bits.\n }\n }\n\n /// @dev Perform a call to invoke {IERC1155Receiver-onERC1155Received} on `to`.\n /// Reverts if the target does not support the function correctly.\n function _checkOnERC1155Received(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n /// @solidity memory-safe-assembly\n assembly {\n // Prepare the calldata.\n let m := mload(0x40)\n // `onERC1155Received(address,address,uint256,uint256,bytes)`.\n mstore(m, 0xf23a6e61)\n mstore(add(m, 0x20), caller())\n mstore(add(m, 0x40), shr(96, shl(96, from)))\n mstore(add(m, 0x60), id)\n mstore(add(m, 0x80), amount)\n mstore(add(m, 0xa0), 0xa0)\n let n := mload(data)\n mstore(add(m, 0xc0), n)\n if n { pop(staticcall(gas(), 4, add(data, 0x20), n, add(m, 0xe0), n)) }\n // Revert if the call reverts.\n if iszero(call(gas(), to, 0, add(m, 0x1c), add(0xc4, n), m, 0x20)) {\n if returndatasize() {\n // Bubble up the revert if the call reverts.\n returndatacopy(0x00, 0x00, returndatasize())\n revert(0x00, returndatasize())\n }\n mstore(m, 0)\n }\n // Load the returndata and compare it with the function selector.\n if iszero(eq(mload(m), shl(224, 0xf23a6e61))) {\n mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.\n revert(0x1c, 0x04)\n }\n }\n }\n\n /// @dev Perform a call to invoke {IERC1155Receiver-onERC1155BatchReceived} on `to`.\n /// Reverts if the target does not support the function correctly.\n function _checkOnERC1155BatchReceived(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n /// @solidity memory-safe-assembly\n assembly {\n // Prepare the calldata.\n let m := mload(0x40)\n // `onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)`.\n mstore(m, 0xbc197c81)\n mstore(add(m, 0x20), caller())\n mstore(add(m, 0x40), shr(96, shl(96, from)))\n // Copy the `ids`.\n mstore(add(m, 0x60), 0xa0)\n let n := add(0x20, shl(5, mload(ids)))\n let o := add(m, 0xc0)\n pop(staticcall(gas(), 4, ids, n, o, n))\n // Copy the `amounts`.\n let s := add(0xa0, returndatasize())\n mstore(add(m, 0x80), s)\n o := add(o, returndatasize())\n n := add(0x20, shl(5, mload(amounts)))\n pop(staticcall(gas(), 4, amounts, n, o, n))\n // Copy the `data`.\n mstore(add(m, 0xa0), add(s, returndatasize()))\n o := add(o, returndatasize())\n n := add(0x20, mload(data))\n pop(staticcall(gas(), 4, data, n, o, n))\n n := sub(add(o, returndatasize()), add(m, 0x1c))\n // Revert if the call reverts.\n if iszero(call(gas(), to, 0, add(m, 0x1c), n, m, 0x20)) {\n if returndatasize() {\n // Bubble up the revert if the call reverts.\n returndatacopy(0x00, 0x00, returndatasize())\n revert(0x00, returndatasize())\n }\n mstore(m, 0)\n }\n // Load the returndata and compare it with the function selector.\n if iszero(eq(mload(m), shl(224, 0xbc197c81))) {\n mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.\n revert(0x1c, 0x04)\n }\n }\n }\n\n /// @dev Returns `x` in an array with a single element.\n function _single(uint256 x) private pure returns (uint256[] memory result) {\n assembly {\n result := mload(0x40)\n mstore(0x40, add(result, 0x40))\n mstore(result, 1)\n mstore(add(result, 0x20), x)\n }\n }\n}\n" }, "lib/seaport/lib/seaport-types/src/lib/ConsiderationStructs.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {\n BasicOrderType,\n ItemType,\n OrderType,\n Side\n} from \"./ConsiderationEnums.sol\";\n\nimport {\n CalldataPointer,\n MemoryPointer\n} from \"../helpers/PointerLibraries.sol\";\n\n/**\n * @dev An order contains eleven components: an offerer, a zone (or account that\n * can cancel the order or restrict who can fulfill the order depending on\n * the type), the order type (specifying partial fill support as well as\n * restricted order status), the start and end time, a hash that will be\n * provided to the zone when validating restricted orders, a salt, a key\n * corresponding to a given conduit, a counter, and an arbitrary number of\n * offer items that can be spent along with consideration items that must\n * be received by their respective recipient.\n */\nstruct OrderComponents {\n address offerer;\n address zone;\n OfferItem[] offer;\n ConsiderationItem[] consideration;\n OrderType orderType;\n uint256 startTime;\n uint256 endTime;\n bytes32 zoneHash;\n uint256 salt;\n bytes32 conduitKey;\n uint256 counter;\n}\n\n/**\n * @dev An offer item has five components: an item type (ETH or other native\n * tokens, ERC20, ERC721, and ERC1155, as well as criteria-based ERC721 and\n * ERC1155), a token address, a dual-purpose \"identifierOrCriteria\"\n * component that will either represent a tokenId or a merkle root\n * depending on the item type, and a start and end amount that support\n * increasing or decreasing amounts over the duration of the respective\n * order.\n */\nstruct OfferItem {\n ItemType itemType;\n address token;\n uint256 identifierOrCriteria;\n uint256 startAmount;\n uint256 endAmount;\n}\n\n/**\n * @dev A consideration item has the same five components as an offer item and\n * an additional sixth component designating the required recipient of the\n * item.\n */\nstruct ConsiderationItem {\n ItemType itemType;\n address token;\n uint256 identifierOrCriteria;\n uint256 startAmount;\n uint256 endAmount;\n address payable recipient;\n}\n\n/**\n * @dev A spent item is translated from a utilized offer item and has four\n * components: an item type (ETH or other native tokens, ERC20, ERC721, and\n * ERC1155), a token address, a tokenId, and an amount.\n */\nstruct SpentItem {\n ItemType itemType;\n address token;\n uint256 identifier;\n uint256 amount;\n}\n\n/**\n * @dev A received item is translated from a utilized consideration item and has\n * the same four components as a spent item, as well as an additional fifth\n * component designating the required recipient of the item.\n */\nstruct ReceivedItem {\n ItemType itemType;\n address token;\n uint256 identifier;\n uint256 amount;\n address payable recipient;\n}\n\n/**\n * @dev For basic orders involving ETH / native / ERC20 <=> ERC721 / ERC1155\n * matching, a group of six functions may be called that only requires a\n * subset of the usual order arguments. Note the use of a \"basicOrderType\"\n * enum; this represents both the usual order type as well as the \"route\"\n * of the basic order (a simple derivation function for the basic order\n * type is `basicOrderType = orderType + (4 * basicOrderRoute)`.)\n */\nstruct BasicOrderParameters {\n // calldata offset\n address considerationToken; // 0x24\n uint256 considerationIdentifier; // 0x44\n uint256 considerationAmount; // 0x64\n address payable offerer; // 0x84\n address zone; // 0xa4\n address offerToken; // 0xc4\n uint256 offerIdentifier; // 0xe4\n uint256 offerAmount; // 0x104\n BasicOrderType basicOrderType; // 0x124\n uint256 startTime; // 0x144\n uint256 endTime; // 0x164\n bytes32 zoneHash; // 0x184\n uint256 salt; // 0x1a4\n bytes32 offererConduitKey; // 0x1c4\n bytes32 fulfillerConduitKey; // 0x1e4\n uint256 totalOriginalAdditionalRecipients; // 0x204\n AdditionalRecipient[] additionalRecipients; // 0x224\n bytes signature; // 0x244\n // Total length, excluding dynamic array data: 0x264 (580)\n}\n\n/**\n * @dev Basic orders can supply any number of additional recipients, with the\n * implied assumption that they are supplied from the offered ETH (or other\n * native token) or ERC20 token for the order.\n */\nstruct AdditionalRecipient {\n uint256 amount;\n address payable recipient;\n}\n\n/**\n * @dev The full set of order components, with the exception of the counter,\n * must be supplied when fulfilling more sophisticated orders or groups of\n * orders. The total number of original consideration items must also be\n * supplied, as the caller may specify additional consideration items.\n */\nstruct OrderParameters {\n address offerer; // 0x00\n address zone; // 0x20\n OfferItem[] offer; // 0x40\n ConsiderationItem[] consideration; // 0x60\n OrderType orderType; // 0x80\n uint256 startTime; // 0xa0\n uint256 endTime; // 0xc0\n bytes32 zoneHash; // 0xe0\n uint256 salt; // 0x100\n bytes32 conduitKey; // 0x120\n uint256 totalOriginalConsiderationItems; // 0x140\n // offer.length // 0x160\n}\n\n/**\n * @dev Orders require a signature in addition to the other order parameters.\n */\nstruct Order {\n OrderParameters parameters;\n bytes signature;\n}\n\n/**\n * @dev Advanced orders include a numerator (i.e. a fraction to attempt to fill)\n * and a denominator (the total size of the order) in addition to the\n * signature and other order parameters. It also supports an optional field\n * for supplying extra data; this data will be provided to the zone if the\n * order type is restricted and the zone is not the caller, or will be\n * provided to the offerer as context for contract order types.\n */\nstruct AdvancedOrder {\n OrderParameters parameters;\n uint120 numerator;\n uint120 denominator;\n bytes signature;\n bytes extraData;\n}\n\n/**\n * @dev Orders can be validated (either explicitly via `validate`, or as a\n * consequence of a full or partial fill), specifically cancelled (they can\n * also be cancelled in bulk via incrementing a per-zone counter), and\n * partially or fully filled (with the fraction filled represented by a\n * numerator and denominator).\n */\nstruct OrderStatus {\n bool isValidated;\n bool isCancelled;\n uint120 numerator;\n uint120 denominator;\n}\n\n/**\n * @dev A criteria resolver specifies an order, side (offer vs. consideration),\n * and item index. It then provides a chosen identifier (i.e. tokenId)\n * alongside a merkle proof demonstrating the identifier meets the required\n * criteria.\n */\nstruct CriteriaResolver {\n uint256 orderIndex;\n Side side;\n uint256 index;\n uint256 identifier;\n bytes32[] criteriaProof;\n}\n\n/**\n * @dev A fulfillment is applied to a group of orders. It decrements a series of\n * offer and consideration items, then generates a single execution\n * element. A given fulfillment can be applied to as many offer and\n * consideration items as desired, but must contain at least one offer and\n * at least one consideration that match. The fulfillment must also remain\n * consistent on all key parameters across all offer items (same offerer,\n * token, type, tokenId, and conduit preference) as well as across all\n * consideration items (token, type, tokenId, and recipient).\n */\nstruct Fulfillment {\n FulfillmentComponent[] offerComponents;\n FulfillmentComponent[] considerationComponents;\n}\n\n/**\n * @dev Each fulfillment component contains one index referencing a specific\n * order and another referencing a specific offer or consideration item.\n */\nstruct FulfillmentComponent {\n uint256 orderIndex;\n uint256 itemIndex;\n}\n\n/**\n * @dev An execution is triggered once all consideration items have been zeroed\n * out. It sends the item in question from the offerer to the item's\n * recipient, optionally sourcing approvals from either this contract\n * directly or from the offerer's chosen conduit if one is specified. An\n * execution is not provided as an argument, but rather is derived via\n * orders, criteria resolvers, and fulfillments (where the total number of\n * executions will be less than or equal to the total number of indicated\n * fulfillments) and returned as part of `matchOrders`.\n */\nstruct Execution {\n ReceivedItem item;\n address offerer;\n bytes32 conduitKey;\n}\n\n/**\n * @dev Restricted orders are validated post-execution by calling validateOrder\n * on the zone. This struct provides context about the order fulfillment\n * and any supplied extraData, as well as all order hashes fulfilled in a\n * call to a match or fulfillAvailable method.\n */\nstruct ZoneParameters {\n bytes32 orderHash;\n address fulfiller;\n address offerer;\n SpentItem[] offer;\n ReceivedItem[] consideration;\n bytes extraData;\n bytes32[] orderHashes;\n uint256 startTime;\n uint256 endTime;\n bytes32 zoneHash;\n}\n\n/**\n * @dev Zones and contract offerers can communicate which schemas they implement\n * along with any associated metadata related to each schema.\n */\nstruct Schema {\n uint256 id;\n bytes metadata;\n}\n\nusing StructPointers for OrderComponents global;\nusing StructPointers for OfferItem global;\nusing StructPointers for ConsiderationItem global;\nusing StructPointers for SpentItem global;\nusing StructPointers for ReceivedItem global;\nusing StructPointers for BasicOrderParameters global;\nusing StructPointers for AdditionalRecipient global;\nusing StructPointers for OrderParameters global;\nusing StructPointers for Order global;\nusing StructPointers for AdvancedOrder global;\nusing StructPointers for OrderStatus global;\nusing StructPointers for CriteriaResolver global;\nusing StructPointers for Fulfillment global;\nusing StructPointers for FulfillmentComponent global;\nusing StructPointers for Execution global;\nusing StructPointers for ZoneParameters global;\n\n/**\n * @dev This library provides a set of functions for converting structs to\n * pointers.\n */\nlibrary StructPointers {\n /**\n * @dev Get a MemoryPointer from OrderComponents.\n *\n * @param obj The OrderComponents object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n OrderComponents memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from OrderComponents.\n *\n * @param obj The OrderComponents object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n OrderComponents calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from OfferItem.\n *\n * @param obj The OfferItem object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n OfferItem memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from OfferItem.\n *\n * @param obj The OfferItem object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n OfferItem calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from ConsiderationItem.\n *\n * @param obj The ConsiderationItem object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n ConsiderationItem memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from ConsiderationItem.\n *\n * @param obj The ConsiderationItem object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n ConsiderationItem calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from SpentItem.\n *\n * @param obj The SpentItem object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n SpentItem memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from SpentItem.\n *\n * @param obj The SpentItem object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n SpentItem calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from ReceivedItem.\n *\n * @param obj The ReceivedItem object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n ReceivedItem memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from ReceivedItem.\n *\n * @param obj The ReceivedItem object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n ReceivedItem calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from BasicOrderParameters.\n *\n * @param obj The BasicOrderParameters object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n BasicOrderParameters memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from BasicOrderParameters.\n *\n * @param obj The BasicOrderParameters object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n BasicOrderParameters calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from AdditionalRecipient.\n *\n * @param obj The AdditionalRecipient object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n AdditionalRecipient memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from AdditionalRecipient.\n *\n * @param obj The AdditionalRecipient object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n AdditionalRecipient calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from OrderParameters.\n *\n * @param obj The OrderParameters object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n OrderParameters memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from OrderParameters.\n *\n * @param obj The OrderParameters object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n OrderParameters calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from Order.\n *\n * @param obj The Order object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n Order memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from Order.\n *\n * @param obj The Order object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n Order calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from AdvancedOrder.\n *\n * @param obj The AdvancedOrder object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n AdvancedOrder memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from AdvancedOrder.\n *\n * @param obj The AdvancedOrder object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n AdvancedOrder calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from OrderStatus.\n *\n * @param obj The OrderStatus object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n OrderStatus memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from OrderStatus.\n *\n * @param obj The OrderStatus object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n OrderStatus calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from CriteriaResolver.\n *\n * @param obj The CriteriaResolver object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n CriteriaResolver memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from CriteriaResolver.\n *\n * @param obj The CriteriaResolver object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n CriteriaResolver calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from Fulfillment.\n *\n * @param obj The Fulfillment object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n Fulfillment memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from Fulfillment.\n *\n * @param obj The Fulfillment object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n Fulfillment calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from FulfillmentComponent.\n *\n * @param obj The FulfillmentComponent object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n FulfillmentComponent memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from FulfillmentComponent.\n *\n * @param obj The FulfillmentComponent object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n FulfillmentComponent calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from Execution.\n *\n * @param obj The Execution object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n Execution memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from Execution.\n *\n * @param obj The Execution object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n Execution calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from ZoneParameters.\n *\n * @param obj The ZoneParameters object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n ZoneParameters memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from ZoneParameters.\n *\n * @param obj The ZoneParameters object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n ZoneParameters calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n}\n" }, "lib/seaport/lib/seaport-types/src/interfaces/ContractOffererInterface.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {ReceivedItem, Schema, SpentItem} from \"../lib/ConsiderationStructs.sol\";\nimport {IERC165} from \"../interfaces/IERC165.sol\";\n\n/**\n * @title ContractOffererInterface\n * @notice Contains the minimum interfaces needed to interact with a contract\n * offerer.\n */\ninterface ContractOffererInterface is IERC165 {\n /**\n * @dev Generates an order with the specified minimum and maximum spent\n * items, and optional context (supplied as extraData).\n *\n * @param fulfiller The address of the fulfiller.\n * @param minimumReceived The minimum items that the caller is willing to\n * receive.\n * @param maximumSpent The maximum items the caller is willing to spend.\n * @param context Additional context of the order.\n *\n * @return offer A tuple containing the offer items.\n * @return consideration A tuple containing the consideration items.\n */\n function generateOrder(\n address fulfiller,\n SpentItem[] calldata minimumReceived,\n SpentItem[] calldata maximumSpent,\n bytes calldata context // encoded based on the schemaID\n ) external returns (SpentItem[] memory offer, ReceivedItem[] memory consideration);\n\n /**\n * @dev Ratifies an order with the specified offer, consideration, and\n * optional context (supplied as extraData).\n *\n * @param offer The offer items.\n * @param consideration The consideration items.\n * @param context Additional context of the order.\n * @param orderHashes The hashes to ratify.\n * @param contractNonce The nonce of the contract.\n *\n * @return ratifyOrderMagicValue The magic value returned by the contract\n * offerer.\n */\n function ratifyOrder(\n SpentItem[] calldata offer,\n ReceivedItem[] calldata consideration,\n bytes calldata context, // encoded based on the schemaID\n bytes32[] calldata orderHashes,\n uint256 contractNonce\n ) external returns (bytes4 ratifyOrderMagicValue);\n\n /**\n * @dev View function to preview an order generated in response to a minimum\n * set of received items, maximum set of spent items, and context\n * (supplied as extraData).\n *\n * @param caller The address of the caller (e.g. Seaport).\n * @param fulfiller The address of the fulfiller (e.g. the account\n * calling Seaport).\n * @param minimumReceived The minimum items that the caller is willing to\n * receive.\n * @param maximumSpent The maximum items the caller is willing to spend.\n * @param context Additional context of the order.\n *\n * @return offer A tuple containing the offer items.\n * @return consideration A tuple containing the consideration items.\n */\n function previewOrder(\n address caller,\n address fulfiller,\n SpentItem[] calldata minimumReceived,\n SpentItem[] calldata maximumSpent,\n bytes calldata context // encoded based on the schemaID\n ) external view returns (SpentItem[] memory offer, ReceivedItem[] memory consideration);\n\n /**\n * @dev Gets the metadata for this contract offerer.\n *\n * @return name The name of the contract offerer.\n * @return schemas The schemas supported by the contract offerer.\n */\n function getSeaportMetadata() external view returns (string memory name, Schema[] memory schemas); // map to Seaport Improvement Proposal IDs\n\n function supportsInterface(bytes4 interfaceId) external view override returns (bool);\n\n // Additional functions and/or events based on implemented schemaIDs\n}\n" }, "lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.19;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" }, "src/interfaces/ISeaDropTokenContractMetadata.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\ninterface ISeaDropTokenContractMetadata {\n /**\n * @dev Emit an event for token metadata reveals/updates,\n * according to EIP-4906.\n *\n * @param _fromTokenId The start token id.\n * @param _toTokenId The end token id.\n */\n event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId);\n\n /**\n * @dev Emit an event when the URI for the collection-level metadata\n * is updated.\n */\n event ContractURIUpdated(string newContractURI);\n\n /**\n * @dev Emit an event with the previous and new provenance hash after\n * being updated.\n */\n event ProvenanceHashUpdated(bytes32 previousHash, bytes32 newHash);\n\n /**\n * @dev Emit an event when the EIP-2981 royalty info is updated.\n */\n event RoyaltyInfoUpdated(address receiver, uint256 basisPoints);\n\n /**\n * @notice Throw if the max supply exceeds uint64, a limit\n * due to the storage of bit-packed variables.\n */\n error CannotExceedMaxSupplyOfUint64(uint256 got);\n\n /**\n * @dev Revert with an error when attempting to set the provenance\n * hash after the mint has started.\n */\n error ProvenanceHashCannotBeSetAfterMintStarted();\n\n /**\n * @dev Revert with an error when attempting to set the provenance\n * hash after it has already been set.\n */\n error ProvenanceHashCannotBeSetAfterAlreadyBeingSet();\n\n /**\n * @notice Sets the base URI for the token metadata and emits an event.\n *\n * @param tokenURI The new base URI to set.\n */\n function setBaseURI(string calldata tokenURI) external;\n\n /**\n * @notice Sets the contract URI for contract metadata.\n *\n * @param newContractURI The new contract URI.\n */\n function setContractURI(string calldata newContractURI) external;\n\n /**\n * @notice Sets the provenance hash and emits an event.\n *\n * The provenance hash is used for random reveals, which\n * is a hash of the ordered metadata to show it has not been\n * modified after mint started.\n *\n * This function will revert after the first item has been minted.\n *\n * @param newProvenanceHash The new provenance hash to set.\n */\n function setProvenanceHash(bytes32 newProvenanceHash) external;\n\n /**\n * @notice Sets the default royalty information.\n *\n * Requirements:\n *\n * - `receiver` cannot be the zero address.\n * - `feeNumerator` cannot be greater than the fee denominator of\n * 10_000 basis points.\n */\n function setDefaultRoyalty(address receiver, uint96 feeNumerator) external;\n\n /**\n * @notice Returns the base URI for token metadata.\n */\n function baseURI() external view returns (string memory);\n\n /**\n * @notice Returns the contract URI.\n */\n function contractURI() external view returns (string memory);\n\n /**\n * @notice Returns the provenance hash.\n * The provenance hash is used for random reveals, which\n * is a hash of the ordered metadata to show it is unmodified\n * after mint has started.\n */\n function provenanceHash() external view returns (bytes32);\n}\n" }, "src/interfaces/IERC1155ContractMetadata.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {\n ISeaDropTokenContractMetadata\n} from \"./ISeaDropTokenContractMetadata.sol\";\n\ninterface IERC1155ContractMetadata is ISeaDropTokenContractMetadata {\n /**\n * @dev A struct representing the supply info for a token id,\n * packed into one storage slot.\n *\n * @param maxSupply The max supply for the token id.\n * @param totalSupply The total token supply for the token id.\n * Subtracted when an item is burned.\n * @param totalMinted The total number of tokens minted for the token id.\n */\n struct TokenSupply {\n uint64 maxSupply; // 64/256 bits\n uint64 totalSupply; // 128/256 bits\n uint64 totalMinted; // 192/256 bits\n }\n\n /**\n * @dev Emit an event when the max token supply for a token id is updated.\n */\n event MaxSupplyUpdated(uint256 tokenId, uint256 newMaxSupply);\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the max token\n * supply.\n */\n error MintExceedsMaxSupply(uint256 total, uint256 maxSupply);\n\n /**\n * @notice Sets the max supply for a token id and emits an event.\n *\n * @param tokenId The token id to set the max supply for.\n * @param newMaxSupply The new max supply to set.\n */\n function setMaxSupply(uint256 tokenId, uint256 newMaxSupply) external;\n\n /**\n * @notice Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @notice Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @notice Returns the max token supply for a token id.\n */\n function maxSupply(uint256 tokenId) external view returns (uint256);\n\n /**\n * @notice Returns the total supply for a token id.\n */\n function totalSupply(uint256 tokenId) external view returns (uint256);\n\n /**\n * @notice Returns the total minted for a token id.\n */\n function totalMinted(uint256 tokenId) external view returns (uint256);\n}\n" }, "src/interfaces/ICreatorToken.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\ninterface ICreatorToken {\n event TransferValidatorUpdated(address oldValidator, address newValidator);\n\n function getTransferValidator() external view returns (address validator);\n\n function getTransferValidationFunction()\n external\n view\n returns (bytes4 functionSignature, bool isViewFunction);\n\n function setTransferValidator(address validator) external;\n}\n\ninterface ILegacyCreatorToken {\n event TransferValidatorUpdated(address oldValidator, address newValidator);\n\n function getTransferValidator() external view returns (address validator);\n\n function setTransferValidator(address validator) external;\n}\n" }, "src/interfaces/ITransferValidator.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\ninterface ITransferValidator721 {\n /// @notice Ensure that a transfer has been authorized for a specific tokenId\n function validateTransfer(\n address caller,\n address from,\n address to,\n uint256 tokenId\n ) external view;\n}\n\ninterface ITransferValidator1155 {\n /// @notice Ensure that a transfer has been authorized for a specific amount of a specific tokenId, and reduce the transferable amount remaining\n function validateTransfer(\n address caller,\n address from,\n address to,\n uint256 tokenId,\n uint256 amount\n ) external;\n}\n" }, "src/lib/TokenTransferValidator.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\nimport { ICreatorToken } from \"../interfaces/ICreatorToken.sol\";\n\n/**\n * @title TokenTransferValidator\n * @notice Functionality to use a transfer validator.\n */\nabstract contract TokenTransferValidator is ICreatorToken {\n /// @dev Store the transfer validator. The null address means no transfer validator is set.\n address internal _transferValidator;\n\n /// @notice Revert with an error if the transfer validator is being set to the same address.\n error SameTransferValidator();\n\n /// @notice Returns the currently active transfer validator.\n /// The null address means no transfer validator is set.\n function getTransferValidator() external view returns (address) {\n return _transferValidator;\n }\n\n /// @notice Set the transfer validator.\n /// The external method that uses this must include access control.\n function _setTransferValidator(address newValidator) internal {\n address oldValidator = _transferValidator;\n if (oldValidator == newValidator) {\n revert SameTransferValidator();\n }\n _transferValidator = newValidator;\n emit TransferValidatorUpdated(oldValidator, newValidator);\n }\n}\n" }, "lib/solady/src/tokens/ERC2981.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/// @notice Simple ERC2981 NFT Royalty Standard implementation.\n/// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC2981.sol)\n/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/common/ERC2981.sol)\nabstract contract ERC2981 {\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* CUSTOM ERRORS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The royalty fee numerator exceeds the fee denominator.\n error RoyaltyOverflow();\n\n /// @dev The royalty receiver cannot be the zero address.\n error RoyaltyReceiverIsZeroAddress();\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* STORAGE */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The default royalty info is given by:\n /// ```\n /// let packed := sload(_ERC2981_MASTER_SLOT_SEED)\n /// let receiver := shr(96, packed)\n /// let royaltyFraction := xor(packed, shl(96, receiver))\n /// ```\n ///\n /// The per token royalty info is given by.\n /// ```\n /// mstore(0x00, tokenId)\n /// mstore(0x20, _ERC2981_MASTER_SLOT_SEED)\n /// let packed := sload(keccak256(0x00, 0x40))\n /// let receiver := shr(96, packed)\n /// let royaltyFraction := xor(packed, shl(96, receiver))\n /// ```\n uint256 private constant _ERC2981_MASTER_SLOT_SEED = 0xaa4ec00224afccfdb7;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* ERC2981 */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Checks that `_feeDenominator` is non-zero.\n constructor() {\n require(_feeDenominator() != 0, \"Fee denominator cannot be zero.\");\n }\n\n /// @dev Returns the denominator for the royalty amount.\n /// Defaults to 10000, which represents fees in basis points.\n /// Override this function to return a custom amount if needed.\n function _feeDenominator() internal pure virtual returns (uint96) {\n return 10000;\n }\n\n /// @dev Returns true if this contract implements the interface defined by `interfaceId`.\n /// See: https://eips.ethereum.org/EIPS/eip-165\n /// This function call must use less than 30000 gas.\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) {\n /// @solidity memory-safe-assembly\n assembly {\n let s := shr(224, interfaceId)\n // ERC165: 0x01ffc9a7, ERC2981: 0x2a55205a.\n result := or(eq(s, 0x01ffc9a7), eq(s, 0x2a55205a))\n }\n }\n\n /// @dev Returns the `receiver` and `royaltyAmount` for `tokenId` sold at `salePrice`.\n function royaltyInfo(uint256 tokenId, uint256 salePrice)\n public\n view\n virtual\n returns (address receiver, uint256 royaltyAmount)\n {\n uint256 feeDenominator = _feeDenominator();\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, tokenId)\n mstore(0x20, _ERC2981_MASTER_SLOT_SEED)\n let packed := sload(keccak256(0x00, 0x40))\n receiver := shr(96, packed)\n if iszero(receiver) {\n packed := sload(mload(0x20))\n receiver := shr(96, packed)\n }\n let x := salePrice\n let y := xor(packed, shl(96, receiver)) // `feeNumerator`.\n // Overflow check, equivalent to `require(y == 0 || x <= type(uint256).max / y)`.\n // Out-of-gas revert. Should not be triggered in practice, but included for safety.\n returndatacopy(returndatasize(), returndatasize(), mul(y, gt(x, div(not(0), y))))\n royaltyAmount := div(mul(x, y), feeDenominator)\n }\n }\n\n /// @dev Sets the default royalty `receiver` and `feeNumerator`.\n ///\n /// Requirements:\n /// - `receiver` must not be the zero address.\n /// - `feeNumerator` must not be greater than the fee denominator.\n function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {\n uint256 feeDenominator = _feeDenominator();\n /// @solidity memory-safe-assembly\n assembly {\n feeNumerator := shr(160, shl(160, feeNumerator))\n if gt(feeNumerator, feeDenominator) {\n mstore(0x00, 0x350a88b3) // `RoyaltyOverflow()`.\n revert(0x1c, 0x04)\n }\n let packed := shl(96, receiver)\n if iszero(packed) {\n mstore(0x00, 0xb4457eaa) // `RoyaltyReceiverIsZeroAddress()`.\n revert(0x1c, 0x04)\n }\n sstore(_ERC2981_MASTER_SLOT_SEED, or(packed, feeNumerator))\n }\n }\n\n /// @dev Sets the default royalty `receiver` and `feeNumerator` to zero.\n function _deleteDefaultRoyalty() internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n sstore(_ERC2981_MASTER_SLOT_SEED, 0)\n }\n }\n\n /// @dev Sets the royalty `receiver` and `feeNumerator` for `tokenId`.\n ///\n /// Requirements:\n /// - `receiver` must not be the zero address.\n /// - `feeNumerator` must not be greater than the fee denominator.\n function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator)\n internal\n virtual\n {\n uint256 feeDenominator = _feeDenominator();\n /// @solidity memory-safe-assembly\n assembly {\n feeNumerator := shr(160, shl(160, feeNumerator))\n if gt(feeNumerator, feeDenominator) {\n mstore(0x00, 0x350a88b3) // `RoyaltyOverflow()`.\n revert(0x1c, 0x04)\n }\n let packed := shl(96, receiver)\n if iszero(packed) {\n mstore(0x00, 0xb4457eaa) // `RoyaltyReceiverIsZeroAddress()`.\n revert(0x1c, 0x04)\n }\n mstore(0x00, tokenId)\n mstore(0x20, _ERC2981_MASTER_SLOT_SEED)\n sstore(keccak256(0x00, 0x40), or(packed, feeNumerator))\n }\n }\n\n /// @dev Sets the royalty `receiver` and `feeNumerator` for `tokenId` to zero.\n function _resetTokenRoyalty(uint256 tokenId) internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, tokenId)\n mstore(0x20, _ERC2981_MASTER_SLOT_SEED)\n sstore(keccak256(0x00, 0x40), 0)\n }\n }\n}\n" }, "lib/solady/src/auth/Ownable.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/// @notice Simple single owner authorization mixin.\n/// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol)\n/// @dev While the ownable portion follows\n/// [EIP-173](https://eips.ethereum.org/EIPS/eip-173) for compatibility,\n/// the nomenclature for the 2-step ownership handover may be unique to this codebase.\nabstract contract Ownable {\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* CUSTOM ERRORS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The caller is not authorized to call the function.\n error Unauthorized();\n\n /// @dev The `newOwner` cannot be the zero address.\n error NewOwnerIsZeroAddress();\n\n /// @dev The `pendingOwner` does not have a valid handover request.\n error NoHandoverRequest();\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* EVENTS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The ownership is transferred from `oldOwner` to `newOwner`.\n /// This event is intentionally kept the same as OpenZeppelin's Ownable to be\n /// compatible with indexers and [EIP-173](https://eips.ethereum.org/EIPS/eip-173),\n /// despite it not being as lightweight as a single argument event.\n event OwnershipTransferred(address indexed oldOwner, address indexed newOwner);\n\n /// @dev An ownership handover to `pendingOwner` has been requested.\n event OwnershipHandoverRequested(address indexed pendingOwner);\n\n /// @dev The ownership handover to `pendingOwner` has been canceled.\n event OwnershipHandoverCanceled(address indexed pendingOwner);\n\n /// @dev `keccak256(bytes(\"OwnershipTransferred(address,address)\"))`.\n uint256 private constant _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE =\n 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0;\n\n /// @dev `keccak256(bytes(\"OwnershipHandoverRequested(address)\"))`.\n uint256 private constant _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE =\n 0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d;\n\n /// @dev `keccak256(bytes(\"OwnershipHandoverCanceled(address)\"))`.\n uint256 private constant _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE =\n 0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* STORAGE */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The owner slot is given by: `not(_OWNER_SLOT_NOT)`.\n /// It is intentionally chosen to be a high value\n /// to avoid collision with lower slots.\n /// The choice of manual storage layout is to enable compatibility\n /// with both regular and upgradeable contracts.\n uint256 private constant _OWNER_SLOT_NOT = 0x8b78c6d8;\n\n /// The ownership handover slot of `newOwner` is given by:\n /// ```\n /// mstore(0x00, or(shl(96, user), _HANDOVER_SLOT_SEED))\n /// let handoverSlot := keccak256(0x00, 0x20)\n /// ```\n /// It stores the expiry timestamp of the two-step ownership handover.\n uint256 private constant _HANDOVER_SLOT_SEED = 0x389a75e1;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Initializes the owner directly without authorization guard.\n /// This function must be called upon initialization,\n /// regardless of whether the contract is upgradeable or not.\n /// This is to enable generalization to both regular and upgradeable contracts,\n /// and to save gas in case the initial owner is not the caller.\n /// For performance reasons, this function will not check if there\n /// is an existing owner.\n function _initializeOwner(address newOwner) internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // Clean the upper 96 bits.\n newOwner := shr(96, shl(96, newOwner))\n // Store the new value.\n sstore(not(_OWNER_SLOT_NOT), newOwner)\n // Emit the {OwnershipTransferred} event.\n log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner)\n }\n }\n\n /// @dev Sets the owner directly without authorization guard.\n function _setOwner(address newOwner) internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n let ownerSlot := not(_OWNER_SLOT_NOT)\n // Clean the upper 96 bits.\n newOwner := shr(96, shl(96, newOwner))\n // Emit the {OwnershipTransferred} event.\n log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner)\n // Store the new value.\n sstore(ownerSlot, newOwner)\n }\n }\n\n /// @dev Throws if the sender is not the owner.\n function _checkOwner() internal view virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // If the caller is not the stored owner, revert.\n if iszero(eq(caller(), sload(not(_OWNER_SLOT_NOT)))) {\n mstore(0x00, 0x82b42900) // `Unauthorized()`.\n revert(0x1c, 0x04)\n }\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* PUBLIC UPDATE FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Allows the owner to transfer the ownership to `newOwner`.\n function transferOwnership(address newOwner) public payable virtual onlyOwner {\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(shl(96, newOwner)) {\n mstore(0x00, 0x7448fbae) // `NewOwnerIsZeroAddress()`.\n revert(0x1c, 0x04)\n }\n }\n _setOwner(newOwner);\n }\n\n /// @dev Allows the owner to renounce their ownership.\n function renounceOwnership() public payable virtual onlyOwner {\n _setOwner(address(0));\n }\n\n /// @dev Request a two-step ownership handover to the caller.\n /// The request will automatically expire in 48 hours (172800 seconds) by default.\n function requestOwnershipHandover() public payable virtual {\n unchecked {\n uint256 expires = block.timestamp + ownershipHandoverValidFor();\n /// @solidity memory-safe-assembly\n assembly {\n // Compute and set the handover slot to `expires`.\n mstore(0x0c, _HANDOVER_SLOT_SEED)\n mstore(0x00, caller())\n sstore(keccak256(0x0c, 0x20), expires)\n // Emit the {OwnershipHandoverRequested} event.\n log2(0, 0, _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE, caller())\n }\n }\n }\n\n /// @dev Cancels the two-step ownership handover to the caller, if any.\n function cancelOwnershipHandover() public payable virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // Compute and set the handover slot to 0.\n mstore(0x0c, _HANDOVER_SLOT_SEED)\n mstore(0x00, caller())\n sstore(keccak256(0x0c, 0x20), 0)\n // Emit the {OwnershipHandoverCanceled} event.\n log2(0, 0, _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE, caller())\n }\n }\n\n /// @dev Allows the owner to complete the two-step ownership handover to `pendingOwner`.\n /// Reverts if there is no existing ownership handover requested by `pendingOwner`.\n function completeOwnershipHandover(address pendingOwner) public payable virtual onlyOwner {\n /// @solidity memory-safe-assembly\n assembly {\n // Compute and set the handover slot to 0.\n mstore(0x0c, _HANDOVER_SLOT_SEED)\n mstore(0x00, pendingOwner)\n let handoverSlot := keccak256(0x0c, 0x20)\n // If the handover does not exist, or has expired.\n if gt(timestamp(), sload(handoverSlot)) {\n mstore(0x00, 0x6f5e8818) // `NoHandoverRequest()`.\n revert(0x1c, 0x04)\n }\n // Set the handover slot to 0.\n sstore(handoverSlot, 0)\n }\n _setOwner(pendingOwner);\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* PUBLIC READ FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Returns the owner of the contract.\n function owner() public view virtual returns (address result) {\n /// @solidity memory-safe-assembly\n assembly {\n result := sload(not(_OWNER_SLOT_NOT))\n }\n }\n\n /// @dev Returns the expiry timestamp for the two-step ownership handover to `pendingOwner`.\n function ownershipHandoverExpiresAt(address pendingOwner)\n public\n view\n virtual\n returns (uint256 result)\n {\n /// @solidity memory-safe-assembly\n assembly {\n // Compute the handover slot.\n mstore(0x0c, _HANDOVER_SLOT_SEED)\n mstore(0x00, pendingOwner)\n // Load the handover slot.\n result := sload(keccak256(0x0c, 0x20))\n }\n }\n\n /// @dev Returns how long a two-step ownership handover is valid for in seconds.\n function ownershipHandoverValidFor() public view virtual returns (uint64) {\n return 48 * 3600;\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* MODIFIERS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Marks a function as only callable by the owner.\n modifier onlyOwner() virtual {\n _checkOwner();\n _;\n }\n}\n" }, "lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.19;\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 * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\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) || (address(this).code.length == 0 && _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" }, "src/lib/SeaDropErrorsAndEvents.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { CreatorPayout, PublicDrop } from \"./ERC721SeaDropStructs.sol\";\n\ninterface SeaDropErrorsAndEvents {\n /**\n * @notice The SeaDrop token types, emitted as part of\n * `event SeaDropTokenDeployed`.\n */\n enum SEADROP_TOKEN_TYPE {\n ERC721_STANDARD,\n ERC721_CLONE,\n ERC721_UPGRADEABLE,\n ERC1155_STANDARD,\n ERC1155_CLONE,\n ERC1155_UPGRADEABLE\n }\n\n /**\n * @notice An event to signify that a SeaDrop token contract was deployed.\n */\n event SeaDropTokenDeployed(SEADROP_TOKEN_TYPE tokenType);\n\n /**\n * @notice Revert with an error if the function selector is not supported.\n */\n error UnsupportedFunctionSelector(bytes4 selector);\n\n /**\n * @dev Revert with an error if the drop stage is not active.\n */\n error NotActive(\n uint256 currentTimestamp,\n uint256 startTimestamp,\n uint256 endTimestamp\n );\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the max allowed\n * to be minted per wallet.\n */\n error MintQuantityExceedsMaxMintedPerWallet(uint256 total, uint256 allowed);\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the max token\n * supply.\n */\n error MintQuantityExceedsMaxSupply(uint256 total, uint256 maxSupply);\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the max token\n * supply for the stage.\n * Note: The `maxTokenSupplyForStage` for public mint is\n * always `type(uint).max`.\n */\n error MintQuantityExceedsMaxTokenSupplyForStage(\n uint256 total,\n uint256 maxTokenSupplyForStage\n );\n\n /**\n * @dev Revert if the fee recipient is the zero address.\n */\n error FeeRecipientCannotBeZeroAddress();\n\n /**\n * @dev Revert if the fee recipient is not already included.\n */\n error FeeRecipientNotPresent();\n\n /**\n * @dev Revert if the fee basis points is greater than 10_000.\n */\n error InvalidFeeBps(uint256 feeBps);\n\n /**\n * @dev Revert if the fee recipient is already included.\n */\n error DuplicateFeeRecipient();\n\n /**\n * @dev Revert if the fee recipient is restricted and not allowed.\n */\n error FeeRecipientNotAllowed(address got);\n\n /**\n * @dev Revert if the creator payout address is the zero address.\n */\n error CreatorPayoutAddressCannotBeZeroAddress();\n\n /**\n * @dev Revert if the creator payouts are not set.\n */\n error CreatorPayoutsNotSet();\n\n /**\n * @dev Revert if the creator payout basis points are zero.\n */\n error CreatorPayoutBasisPointsCannotBeZero();\n\n /**\n * @dev Revert if the total basis points for the creator payouts\n * don't equal exactly 10_000.\n */\n error InvalidCreatorPayoutTotalBasisPoints(\n uint256 totalReceivedBasisPoints\n );\n\n /**\n * @dev Revert if the creator payout basis points don't add up to 10_000.\n */\n error InvalidCreatorPayoutBasisPoints(uint256 totalReceivedBasisPoints);\n\n /**\n * @dev Revert with an error if the allow list proof is invalid.\n */\n error InvalidProof();\n\n /**\n * @dev Revert if a supplied signer address is the zero address.\n */\n error SignerCannotBeZeroAddress();\n\n /**\n * @dev Revert with an error if a signer is not included in\n * the enumeration when removing.\n */\n error SignerNotPresent();\n\n /**\n * @dev Revert with an error if a payer is not included in\n * the enumeration when removing.\n */\n error PayerNotPresent();\n\n /**\n * @dev Revert with an error if a payer is already included in mapping\n * when adding.\n */\n error DuplicatePayer();\n\n /**\n * @dev Revert with an error if a signer is already included in mapping\n * when adding.\n */\n error DuplicateSigner();\n\n /**\n * @dev Revert with an error if the payer is not allowed. The minter must\n * pay for their own mint.\n */\n error PayerNotAllowed(address got);\n\n /**\n * @dev Revert if a supplied payer address is the zero address.\n */\n error PayerCannotBeZeroAddress();\n\n /**\n * @dev Revert if the start time is greater than the end time.\n */\n error InvalidStartAndEndTime(uint256 startTime, uint256 endTime);\n\n /**\n * @dev Revert with an error if the signer payment token is not the same.\n */\n error InvalidSignedPaymentToken(address got, address want);\n\n /**\n * @dev Revert with an error if supplied signed mint price is less than\n * the minimum specified.\n */\n error InvalidSignedMintPrice(\n address paymentToken,\n uint256 got,\n uint256 minimum\n );\n\n /**\n * @dev Revert with an error if supplied signed maxTotalMintableByWallet\n * is greater than the maximum specified.\n */\n error InvalidSignedMaxTotalMintableByWallet(uint256 got, uint256 maximum);\n\n /**\n * @dev Revert with an error if supplied signed\n * maxTotalMintableByWalletPerToken is greater than the maximum\n * specified.\n */\n error InvalidSignedMaxTotalMintableByWalletPerToken(\n uint256 got,\n uint256 maximum\n );\n\n /**\n * @dev Revert with an error if the fromTokenId is not within range.\n */\n error InvalidSignedFromTokenId(uint256 got, uint256 minimum);\n\n /**\n * @dev Revert with an error if the toTokenId is not within range.\n */\n error InvalidSignedToTokenId(uint256 got, uint256 maximum);\n\n /**\n * @dev Revert with an error if supplied signed start time is less than\n * the minimum specified.\n */\n error InvalidSignedStartTime(uint256 got, uint256 minimum);\n\n /**\n * @dev Revert with an error if supplied signed end time is greater than\n * the maximum specified.\n */\n error InvalidSignedEndTime(uint256 got, uint256 maximum);\n\n /**\n * @dev Revert with an error if supplied signed maxTokenSupplyForStage\n * is greater than the maximum specified.\n */\n error InvalidSignedMaxTokenSupplyForStage(uint256 got, uint256 maximum);\n\n /**\n * @dev Revert with an error if supplied signed feeBps is greater than\n * the maximum specified, or less than the minimum.\n */\n error InvalidSignedFeeBps(uint256 got, uint256 minimumOrMaximum);\n\n /**\n * @dev Revert with an error if signed mint did not specify to restrict\n * fee recipients.\n */\n error SignedMintsMustRestrictFeeRecipients();\n\n /**\n * @dev Revert with an error if a signature for a signed mint has already\n * been used.\n */\n error SignatureAlreadyUsed();\n\n /**\n * @dev Revert with an error if the contract has no balance to withdraw.\n */\n error NoBalanceToWithdraw();\n\n /**\n * @dev Revert with an error if the caller is not an allowed Seaport.\n */\n error InvalidCallerOnlyAllowedSeaport(address caller);\n\n /**\n * @dev Revert with an error if the order does not have the ERC1155 magic\n * consideration item to signify a consecutive mint.\n */\n error MustSpecifyERC1155ConsiderationItemForSeaDropMint();\n\n /**\n * @dev Revert with an error if the extra data version is not supported.\n */\n error UnsupportedExtraDataVersion(uint8 version);\n\n /**\n * @dev Revert with an error if the extra data encoding is not supported.\n */\n error InvalidExtraDataEncoding(uint8 version);\n\n /**\n * @dev Revert with an error if the provided substandard is not supported.\n */\n error InvalidSubstandard(uint8 substandard);\n\n /**\n * @dev Revert with an error if the implementation contract is called without\n * delegatecall.\n */\n error OnlyDelegateCalled();\n\n /**\n * @dev Revert with an error if the provided allowed Seaport is the\n * zero address.\n */\n error AllowedSeaportCannotBeZeroAddress();\n\n /**\n * @dev Emit an event when allowed Seaport contracts are updated.\n */\n event AllowedSeaportUpdated(address[] allowedSeaport);\n\n /**\n * @dev An event with details of a SeaDrop mint, for analytical purposes.\n *\n * @param payer The address who payed for the tx.\n * @param dropStageIndex The drop stage index. Items minted through\n * public mint have dropStageIndex of 0\n */\n event SeaDropMint(address payer, uint256 dropStageIndex);\n\n /**\n * @dev An event with updated allow list data.\n *\n * @param previousMerkleRoot The previous allow list merkle root.\n * @param newMerkleRoot The new allow list merkle root.\n * @param publicKeyURI If the allow list is encrypted, the public key\n * URIs that can decrypt the list.\n * Empty if unencrypted.\n * @param allowListURI The URI for the allow list.\n */\n event AllowListUpdated(\n bytes32 indexed previousMerkleRoot,\n bytes32 indexed newMerkleRoot,\n string[] publicKeyURI,\n string allowListURI\n );\n\n /**\n * @dev An event with updated drop URI.\n */\n event DropURIUpdated(string newDropURI);\n\n /**\n * @dev An event with the updated creator payout address.\n */\n event CreatorPayoutsUpdated(CreatorPayout[] creatorPayouts);\n\n /**\n * @dev An event with the updated allowed fee recipient.\n */\n event AllowedFeeRecipientUpdated(\n address indexed feeRecipient,\n bool indexed allowed\n );\n\n /**\n * @dev An event with the updated signer.\n */\n event SignerUpdated(address indexed signer, bool indexed allowed);\n\n /**\n * @dev An event with the updated payer.\n */\n event PayerUpdated(address indexed payer, bool indexed allowed);\n}\n" }, "lib/seaport/lib/seaport-types/src/lib/ConsiderationEnums.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nenum OrderType {\n // 0: no partial fills, anyone can execute\n FULL_OPEN,\n\n // 1: partial fills supported, anyone can execute\n PARTIAL_OPEN,\n\n // 2: no partial fills, only offerer or zone can execute\n FULL_RESTRICTED,\n\n // 3: partial fills supported, only offerer or zone can execute\n PARTIAL_RESTRICTED,\n\n // 4: contract order type\n CONTRACT\n}\n\nenum BasicOrderType {\n // 0: no partial fills, anyone can execute\n ETH_TO_ERC721_FULL_OPEN,\n\n // 1: partial fills supported, anyone can execute\n ETH_TO_ERC721_PARTIAL_OPEN,\n\n // 2: no partial fills, only offerer or zone can execute\n ETH_TO_ERC721_FULL_RESTRICTED,\n\n // 3: partial fills supported, only offerer or zone can execute\n ETH_TO_ERC721_PARTIAL_RESTRICTED,\n\n // 4: no partial fills, anyone can execute\n ETH_TO_ERC1155_FULL_OPEN,\n\n // 5: partial fills supported, anyone can execute\n ETH_TO_ERC1155_PARTIAL_OPEN,\n\n // 6: no partial fills, only offerer or zone can execute\n ETH_TO_ERC1155_FULL_RESTRICTED,\n\n // 7: partial fills supported, only offerer or zone can execute\n ETH_TO_ERC1155_PARTIAL_RESTRICTED,\n\n // 8: no partial fills, anyone can execute\n ERC20_TO_ERC721_FULL_OPEN,\n\n // 9: partial fills supported, anyone can execute\n ERC20_TO_ERC721_PARTIAL_OPEN,\n\n // 10: no partial fills, only offerer or zone can execute\n ERC20_TO_ERC721_FULL_RESTRICTED,\n\n // 11: partial fills supported, only offerer or zone can execute\n ERC20_TO_ERC721_PARTIAL_RESTRICTED,\n\n // 12: no partial fills, anyone can execute\n ERC20_TO_ERC1155_FULL_OPEN,\n\n // 13: partial fills supported, anyone can execute\n ERC20_TO_ERC1155_PARTIAL_OPEN,\n\n // 14: no partial fills, only offerer or zone can execute\n ERC20_TO_ERC1155_FULL_RESTRICTED,\n\n // 15: partial fills supported, only offerer or zone can execute\n ERC20_TO_ERC1155_PARTIAL_RESTRICTED,\n\n // 16: no partial fills, anyone can execute\n ERC721_TO_ERC20_FULL_OPEN,\n\n // 17: partial fills supported, anyone can execute\n ERC721_TO_ERC20_PARTIAL_OPEN,\n\n // 18: no partial fills, only offerer or zone can execute\n ERC721_TO_ERC20_FULL_RESTRICTED,\n\n // 19: partial fills supported, only offerer or zone can execute\n ERC721_TO_ERC20_PARTIAL_RESTRICTED,\n\n // 20: no partial fills, anyone can execute\n ERC1155_TO_ERC20_FULL_OPEN,\n\n // 21: partial fills supported, anyone can execute\n ERC1155_TO_ERC20_PARTIAL_OPEN,\n\n // 22: no partial fills, only offerer or zone can execute\n ERC1155_TO_ERC20_FULL_RESTRICTED,\n\n // 23: partial fills supported, only offerer or zone can execute\n ERC1155_TO_ERC20_PARTIAL_RESTRICTED\n}\n\nenum BasicOrderRouteType {\n // 0: provide Ether (or other native token) to receive offered ERC721 item.\n ETH_TO_ERC721,\n\n // 1: provide Ether (or other native token) to receive offered ERC1155 item.\n ETH_TO_ERC1155,\n\n // 2: provide ERC20 item to receive offered ERC721 item.\n ERC20_TO_ERC721,\n\n // 3: provide ERC20 item to receive offered ERC1155 item.\n ERC20_TO_ERC1155,\n\n // 4: provide ERC721 item to receive offered ERC20 item.\n ERC721_TO_ERC20,\n\n // 5: provide ERC1155 item to receive offered ERC20 item.\n ERC1155_TO_ERC20\n}\n\nenum ItemType {\n // 0: ETH on mainnet, MATIC on polygon, etc.\n NATIVE,\n\n // 1: ERC20 items (ERC777 and ERC20 analogues could also technically work)\n ERC20,\n\n // 2: ERC721 items\n ERC721,\n\n // 3: ERC1155 items\n ERC1155,\n\n // 4: ERC721 items where a number of tokenIds are supported\n ERC721_WITH_CRITERIA,\n\n // 5: ERC1155 items where a number of ids are supported\n ERC1155_WITH_CRITERIA\n}\n\nenum Side {\n // 0: Items that can be spent\n OFFER,\n\n // 1: Items that must be received\n CONSIDERATION\n}\n" }, "lib/seaport/lib/seaport-types/src/helpers/PointerLibraries.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\ntype CalldataPointer is uint256;\n\ntype ReturndataPointer is uint256;\n\ntype MemoryPointer is uint256;\n\nusing CalldataPointerLib for CalldataPointer global;\nusing MemoryPointerLib for MemoryPointer global;\nusing ReturndataPointerLib for ReturndataPointer global;\n\nusing CalldataReaders for CalldataPointer global;\nusing ReturndataReaders for ReturndataPointer global;\nusing MemoryReaders for MemoryPointer global;\nusing MemoryWriters for MemoryPointer global;\n\nCalldataPointer constant CalldataStart = CalldataPointer.wrap(0x04);\nMemoryPointer constant FreeMemoryPPtr = MemoryPointer.wrap(0x40);\nuint256 constant IdentityPrecompileAddress = 0x4;\nuint256 constant OffsetOrLengthMask = 0xffffffff;\nuint256 constant _OneWord = 0x20;\nuint256 constant _FreeMemoryPointerSlot = 0x40;\n\n/// @dev Allocates `size` bytes in memory by increasing the free memory pointer\n/// and returns the memory pointer to the first byte of the allocated region.\n// (Free functions cannot have visibility.)\n// solhint-disable-next-line func-visibility\nfunction malloc(uint256 size) pure returns (MemoryPointer mPtr) {\n assembly {\n mPtr := mload(_FreeMemoryPointerSlot)\n mstore(_FreeMemoryPointerSlot, add(mPtr, size))\n }\n}\n\n// (Free functions cannot have visibility.)\n// solhint-disable-next-line func-visibility\nfunction getFreeMemoryPointer() pure returns (MemoryPointer mPtr) {\n mPtr = FreeMemoryPPtr.readMemoryPointer();\n}\n\n// (Free functions cannot have visibility.)\n// solhint-disable-next-line func-visibility\nfunction setFreeMemoryPointer(MemoryPointer mPtr) pure {\n FreeMemoryPPtr.write(mPtr);\n}\n\nlibrary CalldataPointerLib {\n function lt(\n CalldataPointer a,\n CalldataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := lt(a, b)\n }\n }\n\n function gt(\n CalldataPointer a,\n CalldataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := gt(a, b)\n }\n }\n\n function eq(\n CalldataPointer a,\n CalldataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := eq(a, b)\n }\n }\n\n function isNull(CalldataPointer a) internal pure returns (bool b) {\n assembly {\n b := iszero(a)\n }\n }\n\n /// @dev Resolves an offset stored at `cdPtr + headOffset` to a calldata.\n /// pointer `cdPtr` must point to some parent object with a dynamic\n /// type's head stored at `cdPtr + headOffset`.\n function pptr(\n CalldataPointer cdPtr,\n uint256 headOffset\n ) internal pure returns (CalldataPointer cdPtrChild) {\n cdPtrChild = cdPtr.offset(\n cdPtr.offset(headOffset).readUint256() & OffsetOrLengthMask\n );\n }\n\n /// @dev Resolves an offset stored at `cdPtr` to a calldata pointer.\n /// `cdPtr` must point to some parent object with a dynamic type as its\n /// first member, e.g. `struct { bytes data; }`\n function pptr(\n CalldataPointer cdPtr\n ) internal pure returns (CalldataPointer cdPtrChild) {\n cdPtrChild = cdPtr.offset(cdPtr.readUint256() & OffsetOrLengthMask);\n }\n\n /// @dev Returns the calldata pointer one word after `cdPtr`.\n function next(\n CalldataPointer cdPtr\n ) internal pure returns (CalldataPointer cdPtrNext) {\n assembly {\n cdPtrNext := add(cdPtr, _OneWord)\n }\n }\n\n /// @dev Returns the calldata pointer `_offset` bytes after `cdPtr`.\n function offset(\n CalldataPointer cdPtr,\n uint256 _offset\n ) internal pure returns (CalldataPointer cdPtrNext) {\n assembly {\n cdPtrNext := add(cdPtr, _offset)\n }\n }\n\n /// @dev Copies `size` bytes from calldata starting at `src` to memory at\n /// `dst`.\n function copy(\n CalldataPointer src,\n MemoryPointer dst,\n uint256 size\n ) internal pure {\n assembly {\n calldatacopy(dst, src, size)\n }\n }\n}\n\nlibrary ReturndataPointerLib {\n function lt(\n ReturndataPointer a,\n ReturndataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := lt(a, b)\n }\n }\n\n function gt(\n ReturndataPointer a,\n ReturndataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := gt(a, b)\n }\n }\n\n function eq(\n ReturndataPointer a,\n ReturndataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := eq(a, b)\n }\n }\n\n function isNull(ReturndataPointer a) internal pure returns (bool b) {\n assembly {\n b := iszero(a)\n }\n }\n\n /// @dev Resolves an offset stored at `rdPtr + headOffset` to a returndata\n /// pointer. `rdPtr` must point to some parent object with a dynamic\n /// type's head stored at `rdPtr + headOffset`.\n function pptr(\n ReturndataPointer rdPtr,\n uint256 headOffset\n ) internal pure returns (ReturndataPointer rdPtrChild) {\n rdPtrChild = rdPtr.offset(\n rdPtr.offset(headOffset).readUint256() & OffsetOrLengthMask\n );\n }\n\n /// @dev Resolves an offset stored at `rdPtr` to a returndata pointer.\n /// `rdPtr` must point to some parent object with a dynamic type as its\n /// first member, e.g. `struct { bytes data; }`\n function pptr(\n ReturndataPointer rdPtr\n ) internal pure returns (ReturndataPointer rdPtrChild) {\n rdPtrChild = rdPtr.offset(rdPtr.readUint256() & OffsetOrLengthMask);\n }\n\n /// @dev Returns the returndata pointer one word after `cdPtr`.\n function next(\n ReturndataPointer rdPtr\n ) internal pure returns (ReturndataPointer rdPtrNext) {\n assembly {\n rdPtrNext := add(rdPtr, _OneWord)\n }\n }\n\n /// @dev Returns the returndata pointer `_offset` bytes after `cdPtr`.\n function offset(\n ReturndataPointer rdPtr,\n uint256 _offset\n ) internal pure returns (ReturndataPointer rdPtrNext) {\n assembly {\n rdPtrNext := add(rdPtr, _offset)\n }\n }\n\n /// @dev Copies `size` bytes from returndata starting at `src` to memory at\n /// `dst`.\n function copy(\n ReturndataPointer src,\n MemoryPointer dst,\n uint256 size\n ) internal pure {\n assembly {\n returndatacopy(dst, src, size)\n }\n }\n}\n\nlibrary MemoryPointerLib {\n function copy(\n MemoryPointer src,\n MemoryPointer dst,\n uint256 size\n ) internal view {\n assembly {\n let success := staticcall(\n gas(),\n IdentityPrecompileAddress,\n src,\n size,\n dst,\n size\n )\n if or(iszero(returndatasize()), iszero(success)) {\n revert(0, 0)\n }\n }\n }\n\n function lt(\n MemoryPointer a,\n MemoryPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := lt(a, b)\n }\n }\n\n function gt(\n MemoryPointer a,\n MemoryPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := gt(a, b)\n }\n }\n\n function eq(\n MemoryPointer a,\n MemoryPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := eq(a, b)\n }\n }\n\n function isNull(MemoryPointer a) internal pure returns (bool b) {\n assembly {\n b := iszero(a)\n }\n }\n\n function hash(\n MemoryPointer ptr,\n uint256 length\n ) internal pure returns (bytes32 _hash) {\n assembly {\n _hash := keccak256(ptr, length)\n }\n }\n\n /// @dev Returns the memory pointer one word after `mPtr`.\n function next(\n MemoryPointer mPtr\n ) internal pure returns (MemoryPointer mPtrNext) {\n assembly {\n mPtrNext := add(mPtr, _OneWord)\n }\n }\n\n /// @dev Returns the memory pointer `_offset` bytes after `mPtr`.\n function offset(\n MemoryPointer mPtr,\n uint256 _offset\n ) internal pure returns (MemoryPointer mPtrNext) {\n assembly {\n mPtrNext := add(mPtr, _offset)\n }\n }\n\n /// @dev Resolves a pointer at `mPtr + headOffset` to a memory\n /// pointer. `mPtr` must point to some parent object with a dynamic\n /// type's pointer stored at `mPtr + headOffset`.\n function pptr(\n MemoryPointer mPtr,\n uint256 headOffset\n ) internal pure returns (MemoryPointer mPtrChild) {\n mPtrChild = mPtr.offset(headOffset).readMemoryPointer();\n }\n\n /// @dev Resolves a pointer stored at `mPtr` to a memory pointer.\n /// `mPtr` must point to some parent object with a dynamic type as its\n /// first member, e.g. `struct { bytes data; }`\n function pptr(\n MemoryPointer mPtr\n ) internal pure returns (MemoryPointer mPtrChild) {\n mPtrChild = mPtr.readMemoryPointer();\n }\n}\n\nlibrary CalldataReaders {\n /// @dev Reads the value at `cdPtr` and applies a mask to return only the\n /// last 4 bytes.\n function readMaskedUint256(\n CalldataPointer cdPtr\n ) internal pure returns (uint256 value) {\n value = cdPtr.readUint256() & OffsetOrLengthMask;\n }\n\n /// @dev Reads the bool at `cdPtr` in calldata.\n function readBool(\n CalldataPointer cdPtr\n ) internal pure returns (bool value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the address at `cdPtr` in calldata.\n function readAddress(\n CalldataPointer cdPtr\n ) internal pure returns (address value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes1 at `cdPtr` in calldata.\n function readBytes1(\n CalldataPointer cdPtr\n ) internal pure returns (bytes1 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes2 at `cdPtr` in calldata.\n function readBytes2(\n CalldataPointer cdPtr\n ) internal pure returns (bytes2 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes3 at `cdPtr` in calldata.\n function readBytes3(\n CalldataPointer cdPtr\n ) internal pure returns (bytes3 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes4 at `cdPtr` in calldata.\n function readBytes4(\n CalldataPointer cdPtr\n ) internal pure returns (bytes4 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes5 at `cdPtr` in calldata.\n function readBytes5(\n CalldataPointer cdPtr\n ) internal pure returns (bytes5 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes6 at `cdPtr` in calldata.\n function readBytes6(\n CalldataPointer cdPtr\n ) internal pure returns (bytes6 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes7 at `cdPtr` in calldata.\n function readBytes7(\n CalldataPointer cdPtr\n ) internal pure returns (bytes7 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes8 at `cdPtr` in calldata.\n function readBytes8(\n CalldataPointer cdPtr\n ) internal pure returns (bytes8 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes9 at `cdPtr` in calldata.\n function readBytes9(\n CalldataPointer cdPtr\n ) internal pure returns (bytes9 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes10 at `cdPtr` in calldata.\n function readBytes10(\n CalldataPointer cdPtr\n ) internal pure returns (bytes10 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes11 at `cdPtr` in calldata.\n function readBytes11(\n CalldataPointer cdPtr\n ) internal pure returns (bytes11 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes12 at `cdPtr` in calldata.\n function readBytes12(\n CalldataPointer cdPtr\n ) internal pure returns (bytes12 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes13 at `cdPtr` in calldata.\n function readBytes13(\n CalldataPointer cdPtr\n ) internal pure returns (bytes13 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes14 at `cdPtr` in calldata.\n function readBytes14(\n CalldataPointer cdPtr\n ) internal pure returns (bytes14 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes15 at `cdPtr` in calldata.\n function readBytes15(\n CalldataPointer cdPtr\n ) internal pure returns (bytes15 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes16 at `cdPtr` in calldata.\n function readBytes16(\n CalldataPointer cdPtr\n ) internal pure returns (bytes16 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes17 at `cdPtr` in calldata.\n function readBytes17(\n CalldataPointer cdPtr\n ) internal pure returns (bytes17 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes18 at `cdPtr` in calldata.\n function readBytes18(\n CalldataPointer cdPtr\n ) internal pure returns (bytes18 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes19 at `cdPtr` in calldata.\n function readBytes19(\n CalldataPointer cdPtr\n ) internal pure returns (bytes19 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes20 at `cdPtr` in calldata.\n function readBytes20(\n CalldataPointer cdPtr\n ) internal pure returns (bytes20 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes21 at `cdPtr` in calldata.\n function readBytes21(\n CalldataPointer cdPtr\n ) internal pure returns (bytes21 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes22 at `cdPtr` in calldata.\n function readBytes22(\n CalldataPointer cdPtr\n ) internal pure returns (bytes22 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes23 at `cdPtr` in calldata.\n function readBytes23(\n CalldataPointer cdPtr\n ) internal pure returns (bytes23 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes24 at `cdPtr` in calldata.\n function readBytes24(\n CalldataPointer cdPtr\n ) internal pure returns (bytes24 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes25 at `cdPtr` in calldata.\n function readBytes25(\n CalldataPointer cdPtr\n ) internal pure returns (bytes25 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes26 at `cdPtr` in calldata.\n function readBytes26(\n CalldataPointer cdPtr\n ) internal pure returns (bytes26 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes27 at `cdPtr` in calldata.\n function readBytes27(\n CalldataPointer cdPtr\n ) internal pure returns (bytes27 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes28 at `cdPtr` in calldata.\n function readBytes28(\n CalldataPointer cdPtr\n ) internal pure returns (bytes28 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes29 at `cdPtr` in calldata.\n function readBytes29(\n CalldataPointer cdPtr\n ) internal pure returns (bytes29 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes30 at `cdPtr` in calldata.\n function readBytes30(\n CalldataPointer cdPtr\n ) internal pure returns (bytes30 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes31 at `cdPtr` in calldata.\n function readBytes31(\n CalldataPointer cdPtr\n ) internal pure returns (bytes31 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes32 at `cdPtr` in calldata.\n function readBytes32(\n CalldataPointer cdPtr\n ) internal pure returns (bytes32 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint8 at `cdPtr` in calldata.\n function readUint8(\n CalldataPointer cdPtr\n ) internal pure returns (uint8 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint16 at `cdPtr` in calldata.\n function readUint16(\n CalldataPointer cdPtr\n ) internal pure returns (uint16 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint24 at `cdPtr` in calldata.\n function readUint24(\n CalldataPointer cdPtr\n ) internal pure returns (uint24 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint32 at `cdPtr` in calldata.\n function readUint32(\n CalldataPointer cdPtr\n ) internal pure returns (uint32 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint40 at `cdPtr` in calldata.\n function readUint40(\n CalldataPointer cdPtr\n ) internal pure returns (uint40 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint48 at `cdPtr` in calldata.\n function readUint48(\n CalldataPointer cdPtr\n ) internal pure returns (uint48 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint56 at `cdPtr` in calldata.\n function readUint56(\n CalldataPointer cdPtr\n ) internal pure returns (uint56 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint64 at `cdPtr` in calldata.\n function readUint64(\n CalldataPointer cdPtr\n ) internal pure returns (uint64 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint72 at `cdPtr` in calldata.\n function readUint72(\n CalldataPointer cdPtr\n ) internal pure returns (uint72 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint80 at `cdPtr` in calldata.\n function readUint80(\n CalldataPointer cdPtr\n ) internal pure returns (uint80 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint88 at `cdPtr` in calldata.\n function readUint88(\n CalldataPointer cdPtr\n ) internal pure returns (uint88 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint96 at `cdPtr` in calldata.\n function readUint96(\n CalldataPointer cdPtr\n ) internal pure returns (uint96 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint104 at `cdPtr` in calldata.\n function readUint104(\n CalldataPointer cdPtr\n ) internal pure returns (uint104 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint112 at `cdPtr` in calldata.\n function readUint112(\n CalldataPointer cdPtr\n ) internal pure returns (uint112 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint120 at `cdPtr` in calldata.\n function readUint120(\n CalldataPointer cdPtr\n ) internal pure returns (uint120 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint128 at `cdPtr` in calldata.\n function readUint128(\n CalldataPointer cdPtr\n ) internal pure returns (uint128 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint136 at `cdPtr` in calldata.\n function readUint136(\n CalldataPointer cdPtr\n ) internal pure returns (uint136 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint144 at `cdPtr` in calldata.\n function readUint144(\n CalldataPointer cdPtr\n ) internal pure returns (uint144 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint152 at `cdPtr` in calldata.\n function readUint152(\n CalldataPointer cdPtr\n ) internal pure returns (uint152 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint160 at `cdPtr` in calldata.\n function readUint160(\n CalldataPointer cdPtr\n ) internal pure returns (uint160 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint168 at `cdPtr` in calldata.\n function readUint168(\n CalldataPointer cdPtr\n ) internal pure returns (uint168 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint176 at `cdPtr` in calldata.\n function readUint176(\n CalldataPointer cdPtr\n ) internal pure returns (uint176 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint184 at `cdPtr` in calldata.\n function readUint184(\n CalldataPointer cdPtr\n ) internal pure returns (uint184 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint192 at `cdPtr` in calldata.\n function readUint192(\n CalldataPointer cdPtr\n ) internal pure returns (uint192 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint200 at `cdPtr` in calldata.\n function readUint200(\n CalldataPointer cdPtr\n ) internal pure returns (uint200 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint208 at `cdPtr` in calldata.\n function readUint208(\n CalldataPointer cdPtr\n ) internal pure returns (uint208 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint216 at `cdPtr` in calldata.\n function readUint216(\n CalldataPointer cdPtr\n ) internal pure returns (uint216 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint224 at `cdPtr` in calldata.\n function readUint224(\n CalldataPointer cdPtr\n ) internal pure returns (uint224 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint232 at `cdPtr` in calldata.\n function readUint232(\n CalldataPointer cdPtr\n ) internal pure returns (uint232 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint240 at `cdPtr` in calldata.\n function readUint240(\n CalldataPointer cdPtr\n ) internal pure returns (uint240 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint248 at `cdPtr` in calldata.\n function readUint248(\n CalldataPointer cdPtr\n ) internal pure returns (uint248 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint256 at `cdPtr` in calldata.\n function readUint256(\n CalldataPointer cdPtr\n ) internal pure returns (uint256 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int8 at `cdPtr` in calldata.\n function readInt8(\n CalldataPointer cdPtr\n ) internal pure returns (int8 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int16 at `cdPtr` in calldata.\n function readInt16(\n CalldataPointer cdPtr\n ) internal pure returns (int16 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int24 at `cdPtr` in calldata.\n function readInt24(\n CalldataPointer cdPtr\n ) internal pure returns (int24 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int32 at `cdPtr` in calldata.\n function readInt32(\n CalldataPointer cdPtr\n ) internal pure returns (int32 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int40 at `cdPtr` in calldata.\n function readInt40(\n CalldataPointer cdPtr\n ) internal pure returns (int40 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int48 at `cdPtr` in calldata.\n function readInt48(\n CalldataPointer cdPtr\n ) internal pure returns (int48 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int56 at `cdPtr` in calldata.\n function readInt56(\n CalldataPointer cdPtr\n ) internal pure returns (int56 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int64 at `cdPtr` in calldata.\n function readInt64(\n CalldataPointer cdPtr\n ) internal pure returns (int64 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int72 at `cdPtr` in calldata.\n function readInt72(\n CalldataPointer cdPtr\n ) internal pure returns (int72 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int80 at `cdPtr` in calldata.\n function readInt80(\n CalldataPointer cdPtr\n ) internal pure returns (int80 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int88 at `cdPtr` in calldata.\n function readInt88(\n CalldataPointer cdPtr\n ) internal pure returns (int88 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int96 at `cdPtr` in calldata.\n function readInt96(\n CalldataPointer cdPtr\n ) internal pure returns (int96 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int104 at `cdPtr` in calldata.\n function readInt104(\n CalldataPointer cdPtr\n ) internal pure returns (int104 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int112 at `cdPtr` in calldata.\n function readInt112(\n CalldataPointer cdPtr\n ) internal pure returns (int112 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int120 at `cdPtr` in calldata.\n function readInt120(\n CalldataPointer cdPtr\n ) internal pure returns (int120 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int128 at `cdPtr` in calldata.\n function readInt128(\n CalldataPointer cdPtr\n ) internal pure returns (int128 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int136 at `cdPtr` in calldata.\n function readInt136(\n CalldataPointer cdPtr\n ) internal pure returns (int136 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int144 at `cdPtr` in calldata.\n function readInt144(\n CalldataPointer cdPtr\n ) internal pure returns (int144 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int152 at `cdPtr` in calldata.\n function readInt152(\n CalldataPointer cdPtr\n ) internal pure returns (int152 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int160 at `cdPtr` in calldata.\n function readInt160(\n CalldataPointer cdPtr\n ) internal pure returns (int160 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int168 at `cdPtr` in calldata.\n function readInt168(\n CalldataPointer cdPtr\n ) internal pure returns (int168 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int176 at `cdPtr` in calldata.\n function readInt176(\n CalldataPointer cdPtr\n ) internal pure returns (int176 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int184 at `cdPtr` in calldata.\n function readInt184(\n CalldataPointer cdPtr\n ) internal pure returns (int184 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int192 at `cdPtr` in calldata.\n function readInt192(\n CalldataPointer cdPtr\n ) internal pure returns (int192 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int200 at `cdPtr` in calldata.\n function readInt200(\n CalldataPointer cdPtr\n ) internal pure returns (int200 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int208 at `cdPtr` in calldata.\n function readInt208(\n CalldataPointer cdPtr\n ) internal pure returns (int208 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int216 at `cdPtr` in calldata.\n function readInt216(\n CalldataPointer cdPtr\n ) internal pure returns (int216 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int224 at `cdPtr` in calldata.\n function readInt224(\n CalldataPointer cdPtr\n ) internal pure returns (int224 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int232 at `cdPtr` in calldata.\n function readInt232(\n CalldataPointer cdPtr\n ) internal pure returns (int232 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int240 at `cdPtr` in calldata.\n function readInt240(\n CalldataPointer cdPtr\n ) internal pure returns (int240 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int248 at `cdPtr` in calldata.\n function readInt248(\n CalldataPointer cdPtr\n ) internal pure returns (int248 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int256 at `cdPtr` in calldata.\n function readInt256(\n CalldataPointer cdPtr\n ) internal pure returns (int256 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n}\n\nlibrary ReturndataReaders {\n /// @dev Reads value at `rdPtr` & applies a mask to return only last 4 bytes\n function readMaskedUint256(\n ReturndataPointer rdPtr\n ) internal pure returns (uint256 value) {\n value = rdPtr.readUint256() & OffsetOrLengthMask;\n }\n\n /// @dev Reads the bool at `rdPtr` in returndata.\n function readBool(\n ReturndataPointer rdPtr\n ) internal pure returns (bool value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the address at `rdPtr` in returndata.\n function readAddress(\n ReturndataPointer rdPtr\n ) internal pure returns (address value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes1 at `rdPtr` in returndata.\n function readBytes1(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes1 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes2 at `rdPtr` in returndata.\n function readBytes2(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes2 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes3 at `rdPtr` in returndata.\n function readBytes3(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes3 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes4 at `rdPtr` in returndata.\n function readBytes4(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes4 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes5 at `rdPtr` in returndata.\n function readBytes5(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes5 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes6 at `rdPtr` in returndata.\n function readBytes6(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes6 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes7 at `rdPtr` in returndata.\n function readBytes7(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes7 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes8 at `rdPtr` in returndata.\n function readBytes8(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes8 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes9 at `rdPtr` in returndata.\n function readBytes9(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes9 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes10 at `rdPtr` in returndata.\n function readBytes10(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes10 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes11 at `rdPtr` in returndata.\n function readBytes11(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes11 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes12 at `rdPtr` in returndata.\n function readBytes12(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes12 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes13 at `rdPtr` in returndata.\n function readBytes13(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes13 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes14 at `rdPtr` in returndata.\n function readBytes14(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes14 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes15 at `rdPtr` in returndata.\n function readBytes15(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes15 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes16 at `rdPtr` in returndata.\n function readBytes16(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes16 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes17 at `rdPtr` in returndata.\n function readBytes17(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes17 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes18 at `rdPtr` in returndata.\n function readBytes18(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes18 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes19 at `rdPtr` in returndata.\n function readBytes19(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes19 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes20 at `rdPtr` in returndata.\n function readBytes20(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes20 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes21 at `rdPtr` in returndata.\n function readBytes21(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes21 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes22 at `rdPtr` in returndata.\n function readBytes22(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes22 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes23 at `rdPtr` in returndata.\n function readBytes23(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes23 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes24 at `rdPtr` in returndata.\n function readBytes24(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes24 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes25 at `rdPtr` in returndata.\n function readBytes25(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes25 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes26 at `rdPtr` in returndata.\n function readBytes26(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes26 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes27 at `rdPtr` in returndata.\n function readBytes27(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes27 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes28 at `rdPtr` in returndata.\n function readBytes28(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes28 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes29 at `rdPtr` in returndata.\n function readBytes29(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes29 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes30 at `rdPtr` in returndata.\n function readBytes30(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes30 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes31 at `rdPtr` in returndata.\n function readBytes31(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes31 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes32 at `rdPtr` in returndata.\n function readBytes32(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes32 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint8 at `rdPtr` in returndata.\n function readUint8(\n ReturndataPointer rdPtr\n ) internal pure returns (uint8 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint16 at `rdPtr` in returndata.\n function readUint16(\n ReturndataPointer rdPtr\n ) internal pure returns (uint16 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint24 at `rdPtr` in returndata.\n function readUint24(\n ReturndataPointer rdPtr\n ) internal pure returns (uint24 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint32 at `rdPtr` in returndata.\n function readUint32(\n ReturndataPointer rdPtr\n ) internal pure returns (uint32 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint40 at `rdPtr` in returndata.\n function readUint40(\n ReturndataPointer rdPtr\n ) internal pure returns (uint40 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint48 at `rdPtr` in returndata.\n function readUint48(\n ReturndataPointer rdPtr\n ) internal pure returns (uint48 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint56 at `rdPtr` in returndata.\n function readUint56(\n ReturndataPointer rdPtr\n ) internal pure returns (uint56 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint64 at `rdPtr` in returndata.\n function readUint64(\n ReturndataPointer rdPtr\n ) internal pure returns (uint64 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint72 at `rdPtr` in returndata.\n function readUint72(\n ReturndataPointer rdPtr\n ) internal pure returns (uint72 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint80 at `rdPtr` in returndata.\n function readUint80(\n ReturndataPointer rdPtr\n ) internal pure returns (uint80 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint88 at `rdPtr` in returndata.\n function readUint88(\n ReturndataPointer rdPtr\n ) internal pure returns (uint88 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint96 at `rdPtr` in returndata.\n function readUint96(\n ReturndataPointer rdPtr\n ) internal pure returns (uint96 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint104 at `rdPtr` in returndata.\n function readUint104(\n ReturndataPointer rdPtr\n ) internal pure returns (uint104 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint112 at `rdPtr` in returndata.\n function readUint112(\n ReturndataPointer rdPtr\n ) internal pure returns (uint112 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint120 at `rdPtr` in returndata.\n function readUint120(\n ReturndataPointer rdPtr\n ) internal pure returns (uint120 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint128 at `rdPtr` in returndata.\n function readUint128(\n ReturndataPointer rdPtr\n ) internal pure returns (uint128 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint136 at `rdPtr` in returndata.\n function readUint136(\n ReturndataPointer rdPtr\n ) internal pure returns (uint136 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint144 at `rdPtr` in returndata.\n function readUint144(\n ReturndataPointer rdPtr\n ) internal pure returns (uint144 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint152 at `rdPtr` in returndata.\n function readUint152(\n ReturndataPointer rdPtr\n ) internal pure returns (uint152 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint160 at `rdPtr` in returndata.\n function readUint160(\n ReturndataPointer rdPtr\n ) internal pure returns (uint160 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint168 at `rdPtr` in returndata.\n function readUint168(\n ReturndataPointer rdPtr\n ) internal pure returns (uint168 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint176 at `rdPtr` in returndata.\n function readUint176(\n ReturndataPointer rdPtr\n ) internal pure returns (uint176 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint184 at `rdPtr` in returndata.\n function readUint184(\n ReturndataPointer rdPtr\n ) internal pure returns (uint184 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint192 at `rdPtr` in returndata.\n function readUint192(\n ReturndataPointer rdPtr\n ) internal pure returns (uint192 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint200 at `rdPtr` in returndata.\n function readUint200(\n ReturndataPointer rdPtr\n ) internal pure returns (uint200 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint208 at `rdPtr` in returndata.\n function readUint208(\n ReturndataPointer rdPtr\n ) internal pure returns (uint208 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint216 at `rdPtr` in returndata.\n function readUint216(\n ReturndataPointer rdPtr\n ) internal pure returns (uint216 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint224 at `rdPtr` in returndata.\n function readUint224(\n ReturndataPointer rdPtr\n ) internal pure returns (uint224 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint232 at `rdPtr` in returndata.\n function readUint232(\n ReturndataPointer rdPtr\n ) internal pure returns (uint232 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint240 at `rdPtr` in returndata.\n function readUint240(\n ReturndataPointer rdPtr\n ) internal pure returns (uint240 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint248 at `rdPtr` in returndata.\n function readUint248(\n ReturndataPointer rdPtr\n ) internal pure returns (uint248 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint256 at `rdPtr` in returndata.\n function readUint256(\n ReturndataPointer rdPtr\n ) internal pure returns (uint256 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int8 at `rdPtr` in returndata.\n function readInt8(\n ReturndataPointer rdPtr\n ) internal pure returns (int8 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int16 at `rdPtr` in returndata.\n function readInt16(\n ReturndataPointer rdPtr\n ) internal pure returns (int16 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int24 at `rdPtr` in returndata.\n function readInt24(\n ReturndataPointer rdPtr\n ) internal pure returns (int24 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int32 at `rdPtr` in returndata.\n function readInt32(\n ReturndataPointer rdPtr\n ) internal pure returns (int32 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int40 at `rdPtr` in returndata.\n function readInt40(\n ReturndataPointer rdPtr\n ) internal pure returns (int40 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int48 at `rdPtr` in returndata.\n function readInt48(\n ReturndataPointer rdPtr\n ) internal pure returns (int48 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int56 at `rdPtr` in returndata.\n function readInt56(\n ReturndataPointer rdPtr\n ) internal pure returns (int56 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int64 at `rdPtr` in returndata.\n function readInt64(\n ReturndataPointer rdPtr\n ) internal pure returns (int64 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int72 at `rdPtr` in returndata.\n function readInt72(\n ReturndataPointer rdPtr\n ) internal pure returns (int72 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int80 at `rdPtr` in returndata.\n function readInt80(\n ReturndataPointer rdPtr\n ) internal pure returns (int80 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int88 at `rdPtr` in returndata.\n function readInt88(\n ReturndataPointer rdPtr\n ) internal pure returns (int88 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int96 at `rdPtr` in returndata.\n function readInt96(\n ReturndataPointer rdPtr\n ) internal pure returns (int96 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int104 at `rdPtr` in returndata.\n function readInt104(\n ReturndataPointer rdPtr\n ) internal pure returns (int104 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int112 at `rdPtr` in returndata.\n function readInt112(\n ReturndataPointer rdPtr\n ) internal pure returns (int112 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int120 at `rdPtr` in returndata.\n function readInt120(\n ReturndataPointer rdPtr\n ) internal pure returns (int120 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int128 at `rdPtr` in returndata.\n function readInt128(\n ReturndataPointer rdPtr\n ) internal pure returns (int128 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int136 at `rdPtr` in returndata.\n function readInt136(\n ReturndataPointer rdPtr\n ) internal pure returns (int136 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int144 at `rdPtr` in returndata.\n function readInt144(\n ReturndataPointer rdPtr\n ) internal pure returns (int144 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int152 at `rdPtr` in returndata.\n function readInt152(\n ReturndataPointer rdPtr\n ) internal pure returns (int152 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int160 at `rdPtr` in returndata.\n function readInt160(\n ReturndataPointer rdPtr\n ) internal pure returns (int160 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int168 at `rdPtr` in returndata.\n function readInt168(\n ReturndataPointer rdPtr\n ) internal pure returns (int168 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int176 at `rdPtr` in returndata.\n function readInt176(\n ReturndataPointer rdPtr\n ) internal pure returns (int176 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int184 at `rdPtr` in returndata.\n function readInt184(\n ReturndataPointer rdPtr\n ) internal pure returns (int184 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int192 at `rdPtr` in returndata.\n function readInt192(\n ReturndataPointer rdPtr\n ) internal pure returns (int192 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int200 at `rdPtr` in returndata.\n function readInt200(\n ReturndataPointer rdPtr\n ) internal pure returns (int200 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int208 at `rdPtr` in returndata.\n function readInt208(\n ReturndataPointer rdPtr\n ) internal pure returns (int208 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int216 at `rdPtr` in returndata.\n function readInt216(\n ReturndataPointer rdPtr\n ) internal pure returns (int216 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int224 at `rdPtr` in returndata.\n function readInt224(\n ReturndataPointer rdPtr\n ) internal pure returns (int224 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int232 at `rdPtr` in returndata.\n function readInt232(\n ReturndataPointer rdPtr\n ) internal pure returns (int232 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int240 at `rdPtr` in returndata.\n function readInt240(\n ReturndataPointer rdPtr\n ) internal pure returns (int240 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int248 at `rdPtr` in returndata.\n function readInt248(\n ReturndataPointer rdPtr\n ) internal pure returns (int248 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int256 at `rdPtr` in returndata.\n function readInt256(\n ReturndataPointer rdPtr\n ) internal pure returns (int256 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n}\n\nlibrary MemoryReaders {\n /// @dev Reads the memory pointer at `mPtr` in memory.\n function readMemoryPointer(\n MemoryPointer mPtr\n ) internal pure returns (MemoryPointer value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads value at `mPtr` & applies a mask to return only last 4 bytes\n function readMaskedUint256(\n MemoryPointer mPtr\n ) internal pure returns (uint256 value) {\n value = mPtr.readUint256() & OffsetOrLengthMask;\n }\n\n /// @dev Reads the bool at `mPtr` in memory.\n function readBool(MemoryPointer mPtr) internal pure returns (bool value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the address at `mPtr` in memory.\n function readAddress(\n MemoryPointer mPtr\n ) internal pure returns (address value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes1 at `mPtr` in memory.\n function readBytes1(\n MemoryPointer mPtr\n ) internal pure returns (bytes1 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes2 at `mPtr` in memory.\n function readBytes2(\n MemoryPointer mPtr\n ) internal pure returns (bytes2 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes3 at `mPtr` in memory.\n function readBytes3(\n MemoryPointer mPtr\n ) internal pure returns (bytes3 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes4 at `mPtr` in memory.\n function readBytes4(\n MemoryPointer mPtr\n ) internal pure returns (bytes4 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes5 at `mPtr` in memory.\n function readBytes5(\n MemoryPointer mPtr\n ) internal pure returns (bytes5 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes6 at `mPtr` in memory.\n function readBytes6(\n MemoryPointer mPtr\n ) internal pure returns (bytes6 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes7 at `mPtr` in memory.\n function readBytes7(\n MemoryPointer mPtr\n ) internal pure returns (bytes7 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes8 at `mPtr` in memory.\n function readBytes8(\n MemoryPointer mPtr\n ) internal pure returns (bytes8 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes9 at `mPtr` in memory.\n function readBytes9(\n MemoryPointer mPtr\n ) internal pure returns (bytes9 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes10 at `mPtr` in memory.\n function readBytes10(\n MemoryPointer mPtr\n ) internal pure returns (bytes10 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes11 at `mPtr` in memory.\n function readBytes11(\n MemoryPointer mPtr\n ) internal pure returns (bytes11 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes12 at `mPtr` in memory.\n function readBytes12(\n MemoryPointer mPtr\n ) internal pure returns (bytes12 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes13 at `mPtr` in memory.\n function readBytes13(\n MemoryPointer mPtr\n ) internal pure returns (bytes13 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes14 at `mPtr` in memory.\n function readBytes14(\n MemoryPointer mPtr\n ) internal pure returns (bytes14 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes15 at `mPtr` in memory.\n function readBytes15(\n MemoryPointer mPtr\n ) internal pure returns (bytes15 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes16 at `mPtr` in memory.\n function readBytes16(\n MemoryPointer mPtr\n ) internal pure returns (bytes16 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes17 at `mPtr` in memory.\n function readBytes17(\n MemoryPointer mPtr\n ) internal pure returns (bytes17 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes18 at `mPtr` in memory.\n function readBytes18(\n MemoryPointer mPtr\n ) internal pure returns (bytes18 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes19 at `mPtr` in memory.\n function readBytes19(\n MemoryPointer mPtr\n ) internal pure returns (bytes19 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes20 at `mPtr` in memory.\n function readBytes20(\n MemoryPointer mPtr\n ) internal pure returns (bytes20 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes21 at `mPtr` in memory.\n function readBytes21(\n MemoryPointer mPtr\n ) internal pure returns (bytes21 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes22 at `mPtr` in memory.\n function readBytes22(\n MemoryPointer mPtr\n ) internal pure returns (bytes22 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes23 at `mPtr` in memory.\n function readBytes23(\n MemoryPointer mPtr\n ) internal pure returns (bytes23 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes24 at `mPtr` in memory.\n function readBytes24(\n MemoryPointer mPtr\n ) internal pure returns (bytes24 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes25 at `mPtr` in memory.\n function readBytes25(\n MemoryPointer mPtr\n ) internal pure returns (bytes25 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes26 at `mPtr` in memory.\n function readBytes26(\n MemoryPointer mPtr\n ) internal pure returns (bytes26 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes27 at `mPtr` in memory.\n function readBytes27(\n MemoryPointer mPtr\n ) internal pure returns (bytes27 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes28 at `mPtr` in memory.\n function readBytes28(\n MemoryPointer mPtr\n ) internal pure returns (bytes28 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes29 at `mPtr` in memory.\n function readBytes29(\n MemoryPointer mPtr\n ) internal pure returns (bytes29 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes30 at `mPtr` in memory.\n function readBytes30(\n MemoryPointer mPtr\n ) internal pure returns (bytes30 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes31 at `mPtr` in memory.\n function readBytes31(\n MemoryPointer mPtr\n ) internal pure returns (bytes31 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes32 at `mPtr` in memory.\n function readBytes32(\n MemoryPointer mPtr\n ) internal pure returns (bytes32 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint8 at `mPtr` in memory.\n function readUint8(MemoryPointer mPtr) internal pure returns (uint8 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint16 at `mPtr` in memory.\n function readUint16(\n MemoryPointer mPtr\n ) internal pure returns (uint16 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint24 at `mPtr` in memory.\n function readUint24(\n MemoryPointer mPtr\n ) internal pure returns (uint24 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint32 at `mPtr` in memory.\n function readUint32(\n MemoryPointer mPtr\n ) internal pure returns (uint32 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint40 at `mPtr` in memory.\n function readUint40(\n MemoryPointer mPtr\n ) internal pure returns (uint40 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint48 at `mPtr` in memory.\n function readUint48(\n MemoryPointer mPtr\n ) internal pure returns (uint48 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint56 at `mPtr` in memory.\n function readUint56(\n MemoryPointer mPtr\n ) internal pure returns (uint56 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint64 at `mPtr` in memory.\n function readUint64(\n MemoryPointer mPtr\n ) internal pure returns (uint64 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint72 at `mPtr` in memory.\n function readUint72(\n MemoryPointer mPtr\n ) internal pure returns (uint72 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint80 at `mPtr` in memory.\n function readUint80(\n MemoryPointer mPtr\n ) internal pure returns (uint80 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint88 at `mPtr` in memory.\n function readUint88(\n MemoryPointer mPtr\n ) internal pure returns (uint88 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint96 at `mPtr` in memory.\n function readUint96(\n MemoryPointer mPtr\n ) internal pure returns (uint96 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint104 at `mPtr` in memory.\n function readUint104(\n MemoryPointer mPtr\n ) internal pure returns (uint104 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint112 at `mPtr` in memory.\n function readUint112(\n MemoryPointer mPtr\n ) internal pure returns (uint112 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint120 at `mPtr` in memory.\n function readUint120(\n MemoryPointer mPtr\n ) internal pure returns (uint120 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint128 at `mPtr` in memory.\n function readUint128(\n MemoryPointer mPtr\n ) internal pure returns (uint128 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint136 at `mPtr` in memory.\n function readUint136(\n MemoryPointer mPtr\n ) internal pure returns (uint136 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint144 at `mPtr` in memory.\n function readUint144(\n MemoryPointer mPtr\n ) internal pure returns (uint144 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint152 at `mPtr` in memory.\n function readUint152(\n MemoryPointer mPtr\n ) internal pure returns (uint152 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint160 at `mPtr` in memory.\n function readUint160(\n MemoryPointer mPtr\n ) internal pure returns (uint160 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint168 at `mPtr` in memory.\n function readUint168(\n MemoryPointer mPtr\n ) internal pure returns (uint168 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint176 at `mPtr` in memory.\n function readUint176(\n MemoryPointer mPtr\n ) internal pure returns (uint176 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint184 at `mPtr` in memory.\n function readUint184(\n MemoryPointer mPtr\n ) internal pure returns (uint184 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint192 at `mPtr` in memory.\n function readUint192(\n MemoryPointer mPtr\n ) internal pure returns (uint192 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint200 at `mPtr` in memory.\n function readUint200(\n MemoryPointer mPtr\n ) internal pure returns (uint200 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint208 at `mPtr` in memory.\n function readUint208(\n MemoryPointer mPtr\n ) internal pure returns (uint208 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint216 at `mPtr` in memory.\n function readUint216(\n MemoryPointer mPtr\n ) internal pure returns (uint216 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint224 at `mPtr` in memory.\n function readUint224(\n MemoryPointer mPtr\n ) internal pure returns (uint224 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint232 at `mPtr` in memory.\n function readUint232(\n MemoryPointer mPtr\n ) internal pure returns (uint232 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint240 at `mPtr` in memory.\n function readUint240(\n MemoryPointer mPtr\n ) internal pure returns (uint240 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint248 at `mPtr` in memory.\n function readUint248(\n MemoryPointer mPtr\n ) internal pure returns (uint248 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint256 at `mPtr` in memory.\n function readUint256(\n MemoryPointer mPtr\n ) internal pure returns (uint256 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int8 at `mPtr` in memory.\n function readInt8(MemoryPointer mPtr) internal pure returns (int8 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int16 at `mPtr` in memory.\n function readInt16(MemoryPointer mPtr) internal pure returns (int16 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int24 at `mPtr` in memory.\n function readInt24(MemoryPointer mPtr) internal pure returns (int24 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int32 at `mPtr` in memory.\n function readInt32(MemoryPointer mPtr) internal pure returns (int32 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int40 at `mPtr` in memory.\n function readInt40(MemoryPointer mPtr) internal pure returns (int40 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int48 at `mPtr` in memory.\n function readInt48(MemoryPointer mPtr) internal pure returns (int48 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int56 at `mPtr` in memory.\n function readInt56(MemoryPointer mPtr) internal pure returns (int56 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int64 at `mPtr` in memory.\n function readInt64(MemoryPointer mPtr) internal pure returns (int64 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int72 at `mPtr` in memory.\n function readInt72(MemoryPointer mPtr) internal pure returns (int72 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int80 at `mPtr` in memory.\n function readInt80(MemoryPointer mPtr) internal pure returns (int80 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int88 at `mPtr` in memory.\n function readInt88(MemoryPointer mPtr) internal pure returns (int88 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int96 at `mPtr` in memory.\n function readInt96(MemoryPointer mPtr) internal pure returns (int96 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int104 at `mPtr` in memory.\n function readInt104(\n MemoryPointer mPtr\n ) internal pure returns (int104 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int112 at `mPtr` in memory.\n function readInt112(\n MemoryPointer mPtr\n ) internal pure returns (int112 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int120 at `mPtr` in memory.\n function readInt120(\n MemoryPointer mPtr\n ) internal pure returns (int120 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int128 at `mPtr` in memory.\n function readInt128(\n MemoryPointer mPtr\n ) internal pure returns (int128 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int136 at `mPtr` in memory.\n function readInt136(\n MemoryPointer mPtr\n ) internal pure returns (int136 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int144 at `mPtr` in memory.\n function readInt144(\n MemoryPointer mPtr\n ) internal pure returns (int144 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int152 at `mPtr` in memory.\n function readInt152(\n MemoryPointer mPtr\n ) internal pure returns (int152 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int160 at `mPtr` in memory.\n function readInt160(\n MemoryPointer mPtr\n ) internal pure returns (int160 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int168 at `mPtr` in memory.\n function readInt168(\n MemoryPointer mPtr\n ) internal pure returns (int168 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int176 at `mPtr` in memory.\n function readInt176(\n MemoryPointer mPtr\n ) internal pure returns (int176 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int184 at `mPtr` in memory.\n function readInt184(\n MemoryPointer mPtr\n ) internal pure returns (int184 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int192 at `mPtr` in memory.\n function readInt192(\n MemoryPointer mPtr\n ) internal pure returns (int192 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int200 at `mPtr` in memory.\n function readInt200(\n MemoryPointer mPtr\n ) internal pure returns (int200 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int208 at `mPtr` in memory.\n function readInt208(\n MemoryPointer mPtr\n ) internal pure returns (int208 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int216 at `mPtr` in memory.\n function readInt216(\n MemoryPointer mPtr\n ) internal pure returns (int216 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int224 at `mPtr` in memory.\n function readInt224(\n MemoryPointer mPtr\n ) internal pure returns (int224 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int232 at `mPtr` in memory.\n function readInt232(\n MemoryPointer mPtr\n ) internal pure returns (int232 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int240 at `mPtr` in memory.\n function readInt240(\n MemoryPointer mPtr\n ) internal pure returns (int240 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int248 at `mPtr` in memory.\n function readInt248(\n MemoryPointer mPtr\n ) internal pure returns (int248 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int256 at `mPtr` in memory.\n function readInt256(\n MemoryPointer mPtr\n ) internal pure returns (int256 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n}\n\nlibrary MemoryWriters {\n /// @dev Writes `valuePtr` to memory at `mPtr`.\n function write(MemoryPointer mPtr, MemoryPointer valuePtr) internal pure {\n assembly {\n mstore(mPtr, valuePtr)\n }\n }\n\n /// @dev Writes a boolean `value` to `mPtr` in memory.\n function write(MemoryPointer mPtr, bool value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n\n /// @dev Writes an address `value` to `mPtr` in memory.\n function write(MemoryPointer mPtr, address value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n\n /// @dev Writes a bytes32 `value` to `mPtr` in memory.\n /// Separate name to disambiguate literal write parameters.\n function writeBytes32(MemoryPointer mPtr, bytes32 value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n\n /// @dev Writes a uint256 `value` to `mPtr` in memory.\n function write(MemoryPointer mPtr, uint256 value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n\n /// @dev Writes an int256 `value` to `mPtr` in memory.\n /// Separate name to disambiguate literal write parameters.\n function writeInt(MemoryPointer mPtr, int256 value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n}\n" }, "lib/seaport/lib/seaport-types/src/interfaces/IERC165.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.7;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" }, "lib/openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.19;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\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://consensys.net/diligence/blog/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.8.0/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(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\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 if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(target.code.length > 0, \"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" }, "src/lib/ERC721SeaDropStructs.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { AllowListData, CreatorPayout } from \"./SeaDropStructs.sol\";\n\n/**\n * @notice A struct defining public drop data.\n * Designed to fit efficiently in two storage slots.\n *\n * @param startPrice The start price per token. (Up to 1.2m\n * of native token, e.g. ETH, MATIC)\n * @param endPrice The end price per token. If this differs\n * from startPrice, the current price will\n * be calculated based on the current time.\n * @param startTime The start time, ensure this is not zero.\n * @param endTime The end time, ensure this is not zero.\n * @param paymentToken The payment token address. Null for\n * native token.\n * @param maxTotalMintableByWallet Maximum total number of mints a user is\n * allowed. (The limit for this field is\n * 2^16 - 1)\n * @param feeBps Fee out of 10_000 basis points to be\n * collected.\n * @param restrictFeeRecipients If false, allow any fee recipient;\n * if true, check fee recipient is allowed.\n */\nstruct PublicDrop {\n uint80 startPrice; // 80/512 bits\n uint80 endPrice; // 160/512 bits\n uint40 startTime; // 200/512 bits\n uint40 endTime; // 240/512 bits\n address paymentToken; // 400/512 bits\n uint16 maxTotalMintableByWallet; // 416/512 bits\n uint16 feeBps; // 432/512 bits\n bool restrictFeeRecipients; // 440/512 bits\n}\n\n/**\n * @notice A struct defining mint params for an allow list.\n * An allow list leaf will be composed of `msg.sender` and\n * the following params.\n *\n * Note: Since feeBps is encoded in the leaf, backend should ensure\n * that feeBps is acceptable before generating a proof.\n *\n * @param startPrice The start price per token. (Up to 1.2m\n * of native token, e.g. ETH, MATIC)\n * @param endPrice The end price per token. If this differs\n * from startPrice, the current price will\n * be calculated based on the current time.\n * @param startTime The start time, ensure this is not zero.\n * @param endTime The end time, ensure this is not zero.\n * @param paymentToken The payment token for the mint. Null for\n * native token.\n * @param maxTotalMintableByWallet Maximum total number of mints a user is\n * allowed.\n * @param maxTokenSupplyForStage The limit of token supply this stage can\n * mint within.\n * @param dropStageIndex The drop stage index to emit with the event\n * for analytical purposes. This should be\n * non-zero since the public mint emits with\n * index zero.\n * @param feeBps Fee out of 10_000 basis points to be\n * collected.\n * @param restrictFeeRecipients If false, allow any fee recipient;\n * if true, check fee recipient is allowed.\n */\nstruct MintParams {\n uint256 startPrice;\n uint256 endPrice;\n uint256 startTime;\n uint256 endTime;\n address paymentToken;\n uint256 maxTotalMintableByWallet;\n uint256 maxTokenSupplyForStage;\n uint256 dropStageIndex; // non-zero\n uint256 feeBps;\n bool restrictFeeRecipients;\n}\n\n/**\n * @dev Struct containing internal SeaDrop implementation logic\n * mint details to avoid stack too deep.\n *\n * @param feeRecipient The fee recipient.\n * @param payer The payer of the mint.\n * @param minter The mint recipient.\n * @param quantity The number of tokens to mint.\n * @param withEffects Whether to apply state changes of the mint.\n */\nstruct MintDetails {\n address feeRecipient;\n address payer;\n address minter;\n uint256 quantity;\n bool withEffects;\n}\n\n/**\n * @notice A struct to configure multiple contract options in one transaction.\n */\nstruct MultiConfigureStruct {\n uint256 maxSupply;\n string baseURI;\n string contractURI;\n PublicDrop publicDrop;\n string dropURI;\n AllowListData allowListData;\n CreatorPayout[] creatorPayouts;\n bytes32 provenanceHash;\n address[] allowedFeeRecipients;\n address[] disallowedFeeRecipients;\n address[] allowedPayers;\n address[] disallowedPayers;\n // Server-signed\n address[] allowedSigners;\n address[] disallowedSigners;\n // ERC-2981\n address royaltyReceiver;\n uint96 royaltyBps;\n // Mint\n address mintRecipient;\n uint256 mintQuantity;\n}\n" } }, "settings": { "remappings": [ "forge-std/=lib/forge-std/src/", "ds-test/=lib/forge-std/lib/ds-test/src/", "ERC721A/=lib/ERC721A/contracts/", "ERC721A-Upgradeable/=lib/ERC721A-Upgradeable/contracts/", "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "@openzeppelin-upgradeable/contracts/=lib/openzeppelin-contracts-upgradeable/contracts/", "@rari-capital/solmate/=lib/seaport/lib/solmate/", "murky/=lib/murky/src/", "create2-scripts/=lib/create2-helpers/script/", "seadrop/=src/", "seaport-sol/=lib/seaport/lib/seaport-sol/", "seaport-types/=lib/seaport/lib/seaport-types/", "seaport-core/=lib/seaport/lib/seaport-core/", "seaport-test-utils/=lib/seaport/test/foundry/utils/", "solady/=lib/solady/" ], "optimizer": { "enabled": true, "runs": 100000 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "none", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "viaIR": false, "libraries": {} } }}
1
20,290,538
28159d332aaddeed148487aae1d6c1f01de63280bd74b52ca0184771c7105ba5
ca3d329cedb2284c01f1a323fa5a63f91a4ad6709c0ec07ebeb485152e3966e1
83b49dbb2dd555231d636962cce0b34eac51a7ea
008ebccae39d001200c3003c3225ce0a00690066
2a23fe077cd5bd2e424c6aabfc348bac76492ec9
3d602d80600a3d3981f3363d3d373d3d3d363d7309a26fc8fcef18192e267d7a6da9dfb4be81dd6a5af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7309a26fc8fcef18192e267d7a6da9dfb4be81dd6a5af43d82803e903d91602b57fd5bf3
{{ "language": "Solidity", "sources": { "src/clones/ERC721SeaDropCloneable.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.17;\n\nimport {\n ERC721ContractMetadataCloneable,\n ISeaDropTokenContractMetadata\n} from \"./ERC721ContractMetadataCloneable.sol\";\n\nimport {\n INonFungibleSeaDropToken\n} from \"../interfaces/INonFungibleSeaDropToken.sol\";\n\nimport { ISeaDrop } from \"../interfaces/ISeaDrop.sol\";\n\nimport {\n AllowListData,\n PublicDrop,\n TokenGatedDropStage,\n SignedMintValidationParams\n} from \"../lib/SeaDropStructs.sol\";\n\nimport {\n ERC721SeaDropStructsErrorsAndEvents\n} from \"../lib/ERC721SeaDropStructsErrorsAndEvents.sol\";\n\nimport { ERC721ACloneable } from \"./ERC721ACloneable.sol\";\n\nimport {\n ReentrancyGuardUpgradeable\n} from \"openzeppelin-contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\";\n\nimport {\n IERC165\n} from \"openzeppelin-contracts/utils/introspection/IERC165.sol\";\n\n/**\n * @title ERC721SeaDrop\n * @author James Wenzel (emo.eth)\n * @author Ryan Ghods (ralxz.eth)\n * @author Stephan Min (stephanm.eth)\n * @author Michael Cohen (notmichael.eth)\n * @custom:contributor Limit Break (@limitbreak)\n * @notice ERC721SeaDrop is a token contract that contains methods\n * to properly interact with SeaDrop.\n * Implements Limit Break's Creator Token Standards transfer\n * validation for royalty enforcement.\n */\ncontract ERC721SeaDropCloneable is\n ERC721ContractMetadataCloneable,\n INonFungibleSeaDropToken,\n ERC721SeaDropStructsErrorsAndEvents,\n ReentrancyGuardUpgradeable\n{\n /// @notice Track the allowed SeaDrop addresses.\n mapping(address => bool) internal _allowedSeaDrop;\n\n /// @notice Track the enumerated allowed SeaDrop addresses.\n address[] internal _enumeratedAllowedSeaDrop;\n\n /**\n * @dev Reverts if not an allowed SeaDrop contract.\n * This function is inlined instead of being a modifier\n * to save contract space from being inlined N times.\n *\n * @param seaDrop The SeaDrop address to check if allowed.\n */\n function _onlyAllowedSeaDrop(address seaDrop) internal view {\n if (_allowedSeaDrop[seaDrop] != true) {\n revert OnlyAllowedSeaDrop();\n }\n }\n\n /**\n * @notice Deploy the token contract with its name, symbol,\n * and allowed SeaDrop addresses.\n */\n function initialize(\n string calldata __name,\n string calldata __symbol,\n address[] calldata allowedSeaDrop,\n address initialOwner\n ) public initializer {\n __ERC721ACloneable__init(__name, __symbol);\n __ReentrancyGuard_init();\n _updateAllowedSeaDrop(allowedSeaDrop);\n _transferOwnership(initialOwner);\n emit SeaDropTokenDeployed();\n }\n\n /**\n * @notice Update the allowed SeaDrop contracts.\n * Only the owner can use this function.\n *\n * @param allowedSeaDrop The allowed SeaDrop addresses.\n */\n function updateAllowedSeaDrop(address[] calldata allowedSeaDrop)\n external\n virtual\n override\n onlyOwner\n {\n _updateAllowedSeaDrop(allowedSeaDrop);\n }\n\n /**\n * @notice Internal function to update the allowed SeaDrop contracts.\n *\n * @param allowedSeaDrop The allowed SeaDrop addresses.\n */\n function _updateAllowedSeaDrop(address[] calldata allowedSeaDrop) internal {\n // Put the length on the stack for more efficient access.\n uint256 enumeratedAllowedSeaDropLength = _enumeratedAllowedSeaDrop\n .length;\n uint256 allowedSeaDropLength = allowedSeaDrop.length;\n\n // Reset the old mapping.\n for (uint256 i = 0; i < enumeratedAllowedSeaDropLength; ) {\n _allowedSeaDrop[_enumeratedAllowedSeaDrop[i]] = false;\n unchecked {\n ++i;\n }\n }\n\n // Set the new mapping for allowed SeaDrop contracts.\n for (uint256 i = 0; i < allowedSeaDropLength; ) {\n _allowedSeaDrop[allowedSeaDrop[i]] = true;\n unchecked {\n ++i;\n }\n }\n\n // Set the enumeration.\n _enumeratedAllowedSeaDrop = allowedSeaDrop;\n\n // Emit an event for the update.\n emit AllowedSeaDropUpdated(allowedSeaDrop);\n }\n\n /**\n * @notice Burns `tokenId`. The caller must own `tokenId` or be an\n * approved operator.\n *\n * @param tokenId The token id to burn.\n */\n // solhint-disable-next-line comprehensive-interface\n function burn(uint256 tokenId) external {\n _burn(tokenId, true);\n }\n\n /**\n * @dev Overrides the `_startTokenId` function from ERC721A\n * to start at token id `1`.\n *\n * This is to avoid future possible problems since `0` is usually\n * used to signal values that have not been set or have been removed.\n */\n function _startTokenId() internal view virtual override returns (uint256) {\n return 1;\n }\n\n /**\n * @dev Overrides the `tokenURI()` function from ERC721A\n * to return just the base URI if it is implied to not be a directory.\n *\n * This is to help with ERC721 contracts in which the same token URI\n * is desired for each token, such as when the tokenURI is 'unrevealed'.\n */\n function tokenURI(uint256 tokenId)\n public\n view\n virtual\n override\n returns (string memory)\n {\n if (!_exists(tokenId)) revert URIQueryForNonexistentToken();\n\n string memory baseURI = _baseURI();\n\n // Exit early if the baseURI is empty.\n if (bytes(baseURI).length == 0) {\n return \"\";\n }\n\n // Check if the last character in baseURI is a slash.\n if (bytes(baseURI)[bytes(baseURI).length - 1] != bytes(\"/\")[0]) {\n return baseURI;\n }\n\n return string(abi.encodePacked(baseURI, _toString(tokenId)));\n }\n\n /**\n * @notice Mint tokens, restricted to the SeaDrop contract.\n *\n * @dev NOTE: If a token registers itself with multiple SeaDrop\n * contracts, the implementation of this function should guard\n * against reentrancy. If the implementing token uses\n * _safeMint(), or a feeRecipient with a malicious receive() hook\n * is specified, the token or fee recipients may be able to execute\n * another mint in the same transaction via a separate SeaDrop\n * contract.\n * This is dangerous if an implementing token does not correctly\n * update the minterNumMinted and currentTotalSupply values before\n * transferring minted tokens, as SeaDrop references these values\n * to enforce token limits on a per-wallet and per-stage basis.\n *\n * ERC721A tracks these values automatically, but this note and\n * nonReentrant modifier are left here to encourage best-practices\n * when referencing this contract.\n *\n * @param minter The address to mint to.\n * @param quantity The number of tokens to mint.\n */\n function mintSeaDrop(address minter, uint256 quantity)\n external\n virtual\n override\n nonReentrant\n {\n // Ensure the SeaDrop is allowed.\n _onlyAllowedSeaDrop(msg.sender);\n\n // Extra safety check to ensure the max supply is not exceeded.\n if (_totalMinted() + quantity > maxSupply()) {\n revert MintQuantityExceedsMaxSupply(\n _totalMinted() + quantity,\n maxSupply()\n );\n }\n\n // Mint the quantity of tokens to the minter.\n _safeMint(minter, quantity);\n }\n\n /**\n * @notice Update the public drop data for this nft contract on SeaDrop.\n * Only the owner can use this function.\n *\n * @param seaDropImpl The allowed SeaDrop contract.\n * @param publicDrop The public drop data.\n */\n function updatePublicDrop(\n address seaDropImpl,\n PublicDrop calldata publicDrop\n ) external virtual override {\n // Ensure the sender is only the owner or contract itself.\n _onlyOwnerOrSelf();\n\n // Ensure the SeaDrop is allowed.\n _onlyAllowedSeaDrop(seaDropImpl);\n\n // Update the public drop data on SeaDrop.\n ISeaDrop(seaDropImpl).updatePublicDrop(publicDrop);\n }\n\n /**\n * @notice Update the allow list data for this nft contract on SeaDrop.\n * Only the owner can use this function.\n *\n * @param seaDropImpl The allowed SeaDrop contract.\n * @param allowListData The allow list data.\n */\n function updateAllowList(\n address seaDropImpl,\n AllowListData calldata allowListData\n ) external virtual override {\n // Ensure the sender is only the owner or contract itself.\n _onlyOwnerOrSelf();\n\n // Ensure the SeaDrop is allowed.\n _onlyAllowedSeaDrop(seaDropImpl);\n\n // Update the allow list on SeaDrop.\n ISeaDrop(seaDropImpl).updateAllowList(allowListData);\n }\n\n /**\n * @notice Update the token gated drop stage data for this nft contract\n * on SeaDrop.\n * Only the owner can use this function.\n *\n * Note: If two INonFungibleSeaDropToken tokens are doing\n * simultaneous token gated drop promotions for each other,\n * they can be minted by the same actor until\n * `maxTokenSupplyForStage` is reached. Please ensure the\n * `allowedNftToken` is not running an active drop during the\n * `dropStage` time period.\n *\n * @param seaDropImpl The allowed SeaDrop contract.\n * @param allowedNftToken The allowed nft token.\n * @param dropStage The token gated drop stage data.\n */\n function updateTokenGatedDrop(\n address seaDropImpl,\n address allowedNftToken,\n TokenGatedDropStage calldata dropStage\n ) external virtual override {\n // Ensure the sender is only the owner or contract itself.\n _onlyOwnerOrSelf();\n\n // Ensure the SeaDrop is allowed.\n _onlyAllowedSeaDrop(seaDropImpl);\n\n // Update the token gated drop stage.\n ISeaDrop(seaDropImpl).updateTokenGatedDrop(allowedNftToken, dropStage);\n }\n\n /**\n * @notice Update the drop URI for this nft contract on SeaDrop.\n * Only the owner can use this function.\n *\n * @param seaDropImpl The allowed SeaDrop contract.\n * @param dropURI The new drop URI.\n */\n function updateDropURI(address seaDropImpl, string calldata dropURI)\n external\n virtual\n override\n {\n // Ensure the sender is only the owner or contract itself.\n _onlyOwnerOrSelf();\n\n // Ensure the SeaDrop is allowed.\n _onlyAllowedSeaDrop(seaDropImpl);\n\n // Update the drop URI.\n ISeaDrop(seaDropImpl).updateDropURI(dropURI);\n }\n\n /**\n * @notice Update the creator payout address for this nft contract on\n * SeaDrop.\n * Only the owner can set the creator payout address.\n *\n * @param seaDropImpl The allowed SeaDrop contract.\n * @param payoutAddress The new payout address.\n */\n function updateCreatorPayoutAddress(\n address seaDropImpl,\n address payoutAddress\n ) external {\n // Ensure the sender is only the owner or contract itself.\n _onlyOwnerOrSelf();\n\n // Ensure the SeaDrop is allowed.\n _onlyAllowedSeaDrop(seaDropImpl);\n\n // Update the creator payout address.\n ISeaDrop(seaDropImpl).updateCreatorPayoutAddress(payoutAddress);\n }\n\n /**\n * @notice Update the allowed fee recipient for this nft contract\n * on SeaDrop.\n * Only the owner can set the allowed fee recipient.\n *\n * @param seaDropImpl The allowed SeaDrop contract.\n * @param feeRecipient The new fee recipient.\n * @param allowed If the fee recipient is allowed.\n */\n function updateAllowedFeeRecipient(\n address seaDropImpl,\n address feeRecipient,\n bool allowed\n ) external virtual {\n // Ensure the sender is only the owner or contract itself.\n _onlyOwnerOrSelf();\n\n // Ensure the SeaDrop is allowed.\n _onlyAllowedSeaDrop(seaDropImpl);\n\n // Update the allowed fee recipient.\n ISeaDrop(seaDropImpl).updateAllowedFeeRecipient(feeRecipient, allowed);\n }\n\n /**\n * @notice Update the server-side signers for this nft contract\n * on SeaDrop.\n * Only the owner can use this function.\n *\n * @param seaDropImpl The allowed SeaDrop contract.\n * @param signer The signer to update.\n * @param signedMintValidationParams Minimum and maximum parameters to\n * enforce for signed mints.\n */\n function updateSignedMintValidationParams(\n address seaDropImpl,\n address signer,\n SignedMintValidationParams memory signedMintValidationParams\n ) external virtual override {\n // Ensure the sender is only the owner or contract itself.\n _onlyOwnerOrSelf();\n\n // Ensure the SeaDrop is allowed.\n _onlyAllowedSeaDrop(seaDropImpl);\n\n // Update the signer.\n ISeaDrop(seaDropImpl).updateSignedMintValidationParams(\n signer,\n signedMintValidationParams\n );\n }\n\n /**\n * @notice Update the allowed payers for this nft contract on SeaDrop.\n * Only the owner can use this function.\n *\n * @param seaDropImpl The allowed SeaDrop contract.\n * @param payer The payer to update.\n * @param allowed Whether the payer is allowed.\n */\n function updatePayer(\n address seaDropImpl,\n address payer,\n bool allowed\n ) external virtual override {\n // Ensure the sender is only the owner or contract itself.\n _onlyOwnerOrSelf();\n\n // Ensure the SeaDrop is allowed.\n _onlyAllowedSeaDrop(seaDropImpl);\n\n // Update the payer.\n ISeaDrop(seaDropImpl).updatePayer(payer, allowed);\n }\n\n /**\n * @notice Returns a set of mint stats for the address.\n * This assists SeaDrop in enforcing maxSupply,\n * maxTotalMintableByWallet, and maxTokenSupplyForStage checks.\n *\n * @dev NOTE: Implementing contracts should always update these numbers\n * before transferring any tokens with _safeMint() to mitigate\n * consequences of malicious onERC721Received() hooks.\n *\n * @param minter The minter address.\n */\n function getMintStats(address minter)\n external\n view\n override\n returns (\n uint256 minterNumMinted,\n uint256 currentTotalSupply,\n uint256 maxSupply\n )\n {\n minterNumMinted = _numberMinted(minter);\n currentTotalSupply = _totalMinted();\n maxSupply = _maxSupply;\n }\n\n /**\n * @notice Returns whether the interface is supported.\n *\n * @param interfaceId The interface id to check against.\n */\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override(IERC165, ERC721ContractMetadataCloneable)\n returns (bool)\n {\n return\n interfaceId == type(INonFungibleSeaDropToken).interfaceId ||\n interfaceId == type(ISeaDropTokenContractMetadata).interfaceId ||\n // ERC721ContractMetadata returns supportsInterface true for\n // EIP-2981\n // ERC721A returns supportsInterface true for\n // ERC165, ERC721, ERC721Metadata\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @notice Configure multiple properties at a time.\n *\n * Note: The individual configure methods should be used\n * to unset or reset any properties to zero, as this method\n * will ignore zero-value properties in the config struct.\n *\n * @param config The configuration struct.\n */\n function multiConfigure(MultiConfigureStruct calldata config)\n external\n onlyOwner\n {\n if (config.maxSupply > 0) {\n this.setMaxSupply(config.maxSupply);\n }\n if (bytes(config.baseURI).length != 0) {\n this.setBaseURI(config.baseURI);\n }\n if (bytes(config.contractURI).length != 0) {\n this.setContractURI(config.contractURI);\n }\n if (\n _cast(config.publicDrop.startTime != 0) |\n _cast(config.publicDrop.endTime != 0) ==\n 1\n ) {\n this.updatePublicDrop(config.seaDropImpl, config.publicDrop);\n }\n if (bytes(config.dropURI).length != 0) {\n this.updateDropURI(config.seaDropImpl, config.dropURI);\n }\n if (config.allowListData.merkleRoot != bytes32(0)) {\n this.updateAllowList(config.seaDropImpl, config.allowListData);\n }\n if (config.creatorPayoutAddress != address(0)) {\n this.updateCreatorPayoutAddress(\n config.seaDropImpl,\n config.creatorPayoutAddress\n );\n }\n if (config.provenanceHash != bytes32(0)) {\n this.setProvenanceHash(config.provenanceHash);\n }\n if (config.allowedFeeRecipients.length > 0) {\n for (uint256 i = 0; i < config.allowedFeeRecipients.length; ) {\n this.updateAllowedFeeRecipient(\n config.seaDropImpl,\n config.allowedFeeRecipients[i],\n true\n );\n unchecked {\n ++i;\n }\n }\n }\n if (config.disallowedFeeRecipients.length > 0) {\n for (uint256 i = 0; i < config.disallowedFeeRecipients.length; ) {\n this.updateAllowedFeeRecipient(\n config.seaDropImpl,\n config.disallowedFeeRecipients[i],\n false\n );\n unchecked {\n ++i;\n }\n }\n }\n if (config.allowedPayers.length > 0) {\n for (uint256 i = 0; i < config.allowedPayers.length; ) {\n this.updatePayer(\n config.seaDropImpl,\n config.allowedPayers[i],\n true\n );\n unchecked {\n ++i;\n }\n }\n }\n if (config.disallowedPayers.length > 0) {\n for (uint256 i = 0; i < config.disallowedPayers.length; ) {\n this.updatePayer(\n config.seaDropImpl,\n config.disallowedPayers[i],\n false\n );\n unchecked {\n ++i;\n }\n }\n }\n if (config.tokenGatedDropStages.length > 0) {\n if (\n config.tokenGatedDropStages.length !=\n config.tokenGatedAllowedNftTokens.length\n ) {\n revert TokenGatedMismatch();\n }\n for (uint256 i = 0; i < config.tokenGatedDropStages.length; ) {\n this.updateTokenGatedDrop(\n config.seaDropImpl,\n config.tokenGatedAllowedNftTokens[i],\n config.tokenGatedDropStages[i]\n );\n unchecked {\n ++i;\n }\n }\n }\n if (config.disallowedTokenGatedAllowedNftTokens.length > 0) {\n for (\n uint256 i = 0;\n i < config.disallowedTokenGatedAllowedNftTokens.length;\n\n ) {\n TokenGatedDropStage memory emptyStage;\n this.updateTokenGatedDrop(\n config.seaDropImpl,\n config.disallowedTokenGatedAllowedNftTokens[i],\n emptyStage\n );\n unchecked {\n ++i;\n }\n }\n }\n if (config.signedMintValidationParams.length > 0) {\n if (\n config.signedMintValidationParams.length !=\n config.signers.length\n ) {\n revert SignersMismatch();\n }\n for (\n uint256 i = 0;\n i < config.signedMintValidationParams.length;\n\n ) {\n this.updateSignedMintValidationParams(\n config.seaDropImpl,\n config.signers[i],\n config.signedMintValidationParams[i]\n );\n unchecked {\n ++i;\n }\n }\n }\n if (config.disallowedSigners.length > 0) {\n for (uint256 i = 0; i < config.disallowedSigners.length; ) {\n SignedMintValidationParams memory emptyParams;\n this.updateSignedMintValidationParams(\n config.seaDropImpl,\n config.disallowedSigners[i],\n emptyParams\n );\n unchecked {\n ++i;\n }\n }\n }\n }\n}\n" }, "src/clones/ERC721ContractMetadataCloneable.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.17;\n\nimport {\n ISeaDropTokenContractMetadata\n} from \"../interfaces/ISeaDropTokenContractMetadata.sol\";\n\nimport {\n ERC721AConduitPreapprovedCloneable\n} from \"./ERC721AConduitPreapprovedCloneable.sol\";\n\nimport { ERC721ACloneable } from \"./ERC721ACloneable.sol\";\n\nimport { ERC721TransferValidator } from \"../lib/ERC721TransferValidator.sol\";\n\nimport {\n ICreatorToken,\n ILegacyCreatorToken\n} from \"../interfaces/ICreatorToken.sol\";\n\nimport { ITransferValidator721 } from \"../interfaces/ITransferValidator.sol\";\n\nimport { TwoStepOwnable } from \"utility-contracts/TwoStepOwnable.sol\";\n\nimport { IERC2981 } from \"openzeppelin-contracts/interfaces/IERC2981.sol\";\n\nimport {\n IERC165\n} from \"openzeppelin-contracts/utils/introspection/IERC165.sol\";\n\n/**\n * @title ERC721ContractMetadataCloneable\n * @author James Wenzel (emo.eth)\n * @author Ryan Ghods (ralxz.eth)\n * @author Stephan Min (stephanm.eth)\n * @notice ERC721ContractMetadata is a token contract that extends ERC721A\n * with additional metadata and ownership capabilities.\n */\ncontract ERC721ContractMetadataCloneable is\n ERC721AConduitPreapprovedCloneable,\n ERC721TransferValidator,\n TwoStepOwnable,\n ISeaDropTokenContractMetadata\n{\n /// @notice Track the max supply.\n uint256 _maxSupply;\n\n /// @notice Track the base URI for token metadata.\n string _tokenBaseURI;\n\n /// @notice Track the contract URI for contract metadata.\n string _contractURI;\n\n /// @notice Track the provenance hash for guaranteeing metadata order\n /// for random reveals.\n bytes32 _provenanceHash;\n\n /// @notice Track the royalty info: address to receive royalties, and\n /// royalty basis points.\n RoyaltyInfo _royaltyInfo;\n\n /**\n * @dev Reverts if the sender is not the owner or the contract itself.\n * This function is inlined instead of being a modifier\n * to save contract space from being inlined N times.\n */\n function _onlyOwnerOrSelf() internal view {\n if (\n _cast(msg.sender == owner()) | _cast(msg.sender == address(this)) ==\n 0\n ) {\n revert OnlyOwner();\n }\n }\n\n /**\n * @notice Sets the base URI for the token metadata and emits an event.\n *\n * @param newBaseURI The new base URI to set.\n */\n function setBaseURI(string calldata newBaseURI) external override {\n // Ensure the sender is only the owner or contract itself.\n _onlyOwnerOrSelf();\n\n // Set the new base URI.\n _tokenBaseURI = newBaseURI;\n\n // Emit an event with the update.\n if (totalSupply() != 0) {\n emit BatchMetadataUpdate(1, _nextTokenId() - 1);\n }\n }\n\n /**\n * @notice Sets the contract URI for contract metadata.\n *\n * @param newContractURI The new contract URI.\n */\n function setContractURI(string calldata newContractURI) external override {\n // Ensure the sender is only the owner or contract itself.\n _onlyOwnerOrSelf();\n\n // Set the new contract URI.\n _contractURI = newContractURI;\n\n // Emit an event with the update.\n emit ContractURIUpdated(newContractURI);\n }\n\n /**\n * @notice Emit an event notifying metadata updates for\n * a range of token ids, according to EIP-4906.\n *\n * @param fromTokenId The start token id.\n * @param toTokenId The end token id.\n */\n function emitBatchMetadataUpdate(uint256 fromTokenId, uint256 toTokenId)\n external\n {\n // Ensure the sender is only the owner or contract itself.\n _onlyOwnerOrSelf();\n\n // Emit an event with the update.\n emit BatchMetadataUpdate(fromTokenId, toTokenId);\n }\n\n /**\n * @notice Sets the max token supply and emits an event.\n *\n * @param newMaxSupply The new max supply to set.\n */\n function setMaxSupply(uint256 newMaxSupply) external {\n // Ensure the sender is only the owner or contract itself.\n _onlyOwnerOrSelf();\n\n // Ensure the max supply does not exceed the maximum value of uint64.\n if (newMaxSupply > 2**64 - 1) {\n revert CannotExceedMaxSupplyOfUint64(newMaxSupply);\n }\n\n // Set the new max supply.\n _maxSupply = newMaxSupply;\n\n // Emit an event with the update.\n emit MaxSupplyUpdated(newMaxSupply);\n }\n\n /**\n * @notice Sets the provenance hash and emits an event.\n *\n * The provenance hash is used for random reveals, which\n * is a hash of the ordered metadata to show it has not been\n * modified after mint started.\n *\n * This function will revert after the first item has been minted.\n *\n * @param newProvenanceHash The new provenance hash to set.\n */\n function setProvenanceHash(bytes32 newProvenanceHash) external {\n // Ensure the sender is only the owner or contract itself.\n _onlyOwnerOrSelf();\n\n // Revert if any items have been minted.\n if (_totalMinted() > 0) {\n revert ProvenanceHashCannotBeSetAfterMintStarted();\n }\n\n // Keep track of the old provenance hash for emitting with the event.\n bytes32 oldProvenanceHash = _provenanceHash;\n\n // Set the new provenance hash.\n _provenanceHash = newProvenanceHash;\n\n // Emit an event with the update.\n emit ProvenanceHashUpdated(oldProvenanceHash, newProvenanceHash);\n }\n\n /**\n * @notice Sets the address and basis points for royalties.\n *\n * @param newInfo The struct to configure royalties.\n */\n function setRoyaltyInfo(RoyaltyInfo calldata newInfo) external {\n // Ensure the sender is only the owner or contract itself.\n _onlyOwnerOrSelf();\n\n // Revert if the new royalty address is the zero address.\n if (newInfo.royaltyAddress == address(0)) {\n revert RoyaltyAddressCannotBeZeroAddress();\n }\n\n // Revert if the new basis points is greater than 10_000.\n if (newInfo.royaltyBps > 10_000) {\n revert InvalidRoyaltyBasisPoints(newInfo.royaltyBps);\n }\n\n // Set the new royalty info.\n _royaltyInfo = newInfo;\n\n // Emit an event with the updated params.\n emit RoyaltyInfoUpdated(newInfo.royaltyAddress, newInfo.royaltyBps);\n }\n\n /**\n * @notice Returns the base URI for token metadata.\n */\n function baseURI() external view override returns (string memory) {\n return _baseURI();\n }\n\n /**\n * @notice Returns the base URI for the contract, which ERC721A uses\n * to return tokenURI.\n */\n function _baseURI() internal view virtual override returns (string memory) {\n return _tokenBaseURI;\n }\n\n /**\n * @notice Returns the contract URI for contract metadata.\n */\n function contractURI() external view override returns (string memory) {\n return _contractURI;\n }\n\n /**\n * @notice Returns the max token supply.\n */\n function maxSupply() public view returns (uint256) {\n return _maxSupply;\n }\n\n /**\n * @notice Returns the provenance hash.\n * The provenance hash is used for random reveals, which\n * is a hash of the ordered metadata to show it is unmodified\n * after mint has started.\n */\n function provenanceHash() external view override returns (bytes32) {\n return _provenanceHash;\n }\n\n /**\n * @notice Returns the address that receives royalties.\n */\n function royaltyAddress() external view returns (address) {\n return _royaltyInfo.royaltyAddress;\n }\n\n /**\n * @notice Returns the royalty basis points out of 10_000.\n */\n function royaltyBasisPoints() external view returns (uint256) {\n return _royaltyInfo.royaltyBps;\n }\n\n /**\n * @notice Called with the sale price to determine how much royalty\n * is owed and to whom.\n *\n * @ param _tokenId The NFT asset queried for royalty information.\n * @param _salePrice The sale price of the NFT asset specified by\n * _tokenId.\n *\n * @return receiver Address of who should be sent the royalty payment.\n * @return royaltyAmount The royalty payment amount for _salePrice.\n */\n function royaltyInfo(\n uint256,\n /* _tokenId */\n uint256 _salePrice\n ) external view returns (address receiver, uint256 royaltyAmount) {\n // Put the royalty info on the stack for more efficient access.\n RoyaltyInfo storage info = _royaltyInfo;\n\n // Set the royalty amount to the sale price times the royalty basis\n // points divided by 10_000.\n royaltyAmount = (_salePrice * info.royaltyBps) / 10_000;\n\n // Set the receiver of the royalty.\n receiver = info.royaltyAddress;\n }\n\n /**\n * @notice Returns the transfer validation function used.\n */\n function getTransferValidationFunction()\n external\n pure\n returns (bytes4 functionSignature, bool isViewFunction)\n {\n functionSignature = ITransferValidator721.validateTransfer.selector;\n isViewFunction = false;\n }\n\n /**\n * @notice Set the transfer validator. Only callable by the token owner.\n */\n function setTransferValidator(address newValidator) external onlyOwner {\n // Set the new transfer validator.\n _setTransferValidator(newValidator);\n }\n\n /**\n * @dev Hook that is called before any token transfer.\n * This includes minting and burning.\n */\n function _beforeTokenTransfers(\n address from,\n address to,\n uint256 startTokenId,\n uint256 /* quantity */\n ) internal virtual override {\n if (from != address(0) && to != address(0)) {\n // Call the transfer validator if one is set.\n address transferValidator = _transferValidator;\n if (transferValidator != address(0)) {\n ITransferValidator721(transferValidator).validateTransfer(\n msg.sender,\n from,\n to,\n startTokenId\n );\n }\n }\n }\n\n /**\n * @notice Returns whether the interface is supported.\n *\n * @param interfaceId The interface id to check against.\n */\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override(IERC165, ERC721ACloneable)\n returns (bool)\n {\n return\n interfaceId == type(IERC2981).interfaceId ||\n interfaceId == type(ICreatorToken).interfaceId ||\n interfaceId == type(ILegacyCreatorToken).interfaceId ||\n interfaceId == 0x49064906 || // ERC-4906\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Internal pure function to cast a `bool` value to a `uint256` value.\n *\n * @param b The `bool` value to cast.\n *\n * @return u The `uint256` value.\n */\n function _cast(bool b) internal pure returns (uint256 u) {\n assembly {\n u := b\n }\n }\n}\n" }, "src/interfaces/INonFungibleSeaDropToken.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.17;\n\nimport {\n ISeaDropTokenContractMetadata\n} from \"./ISeaDropTokenContractMetadata.sol\";\n\nimport {\n AllowListData,\n PublicDrop,\n TokenGatedDropStage,\n SignedMintValidationParams\n} from \"../lib/SeaDropStructs.sol\";\n\ninterface INonFungibleSeaDropToken is ISeaDropTokenContractMetadata {\n /**\n * @dev Revert with an error if a contract is not an allowed\n * SeaDrop address.\n */\n error OnlyAllowedSeaDrop();\n\n /**\n * @dev Emit an event when allowed SeaDrop contracts are updated.\n */\n event AllowedSeaDropUpdated(address[] allowedSeaDrop);\n\n /**\n * @notice Update the allowed SeaDrop contracts.\n * Only the owner can use this function.\n *\n * @param allowedSeaDrop The allowed SeaDrop addresses.\n */\n function updateAllowedSeaDrop(address[] calldata allowedSeaDrop) external;\n\n /**\n * @notice Mint tokens, restricted to the SeaDrop contract.\n *\n * @dev NOTE: If a token registers itself with multiple SeaDrop\n * contracts, the implementation of this function should guard\n * against reentrancy. If the implementing token uses\n * _safeMint(), or a feeRecipient with a malicious receive() hook\n * is specified, the token or fee recipients may be able to execute\n * another mint in the same transaction via a separate SeaDrop\n * contract.\n * This is dangerous if an implementing token does not correctly\n * update the minterNumMinted and currentTotalSupply values before\n * transferring minted tokens, as SeaDrop references these values\n * to enforce token limits on a per-wallet and per-stage basis.\n *\n * @param minter The address to mint to.\n * @param quantity The number of tokens to mint.\n */\n function mintSeaDrop(address minter, uint256 quantity) external;\n\n /**\n * @notice Returns a set of mint stats for the address.\n * This assists SeaDrop in enforcing maxSupply,\n * maxTotalMintableByWallet, and maxTokenSupplyForStage checks.\n *\n * @dev NOTE: Implementing contracts should always update these numbers\n * before transferring any tokens with _safeMint() to mitigate\n * consequences of malicious onERC721Received() hooks.\n *\n * @param minter The minter address.\n */\n function getMintStats(address minter)\n external\n view\n returns (\n uint256 minterNumMinted,\n uint256 currentTotalSupply,\n uint256 maxSupply\n );\n\n /**\n * @notice Update the public drop data for this nft contract on SeaDrop.\n * Only the owner can use this function.\n *\n * @param seaDropImpl The allowed SeaDrop contract.\n * @param publicDrop The public drop data.\n */\n function updatePublicDrop(\n address seaDropImpl,\n PublicDrop calldata publicDrop\n ) external;\n\n /**\n * @notice Update the allow list data for this nft contract on SeaDrop.\n * Only the owner can use this function.\n *\n * @param seaDropImpl The allowed SeaDrop contract.\n * @param allowListData The allow list data.\n */\n function updateAllowList(\n address seaDropImpl,\n AllowListData calldata allowListData\n ) external;\n\n /**\n * @notice Update the token gated drop stage data for this nft contract\n * on SeaDrop.\n * Only the owner can use this function.\n *\n * Note: If two INonFungibleSeaDropToken tokens are doing\n * simultaneous token gated drop promotions for each other,\n * they can be minted by the same actor until\n * `maxTokenSupplyForStage` is reached. Please ensure the\n * `allowedNftToken` is not running an active drop during the\n * `dropStage` time period.\n *\n *\n * @param seaDropImpl The allowed SeaDrop contract.\n * @param allowedNftToken The allowed nft token.\n * @param dropStage The token gated drop stage data.\n */\n function updateTokenGatedDrop(\n address seaDropImpl,\n address allowedNftToken,\n TokenGatedDropStage calldata dropStage\n ) external;\n\n /**\n * @notice Update the drop URI for this nft contract on SeaDrop.\n * Only the owner can use this function.\n *\n * @param seaDropImpl The allowed SeaDrop contract.\n * @param dropURI The new drop URI.\n */\n function updateDropURI(address seaDropImpl, string calldata dropURI)\n external;\n\n /**\n * @notice Update the creator payout address for this nft contract on\n * SeaDrop.\n * Only the owner can set the creator payout address.\n *\n * @param seaDropImpl The allowed SeaDrop contract.\n * @param payoutAddress The new payout address.\n */\n function updateCreatorPayoutAddress(\n address seaDropImpl,\n address payoutAddress\n ) external;\n\n /**\n * @notice Update the allowed fee recipient for this nft contract\n * on SeaDrop.\n *\n * @param seaDropImpl The allowed SeaDrop contract.\n * @param feeRecipient The new fee recipient.\n */\n function updateAllowedFeeRecipient(\n address seaDropImpl,\n address feeRecipient,\n bool allowed\n ) external;\n\n /**\n * @notice Update the server-side signers for this nft contract\n * on SeaDrop.\n * Only the owner can use this function.\n *\n * @param seaDropImpl The allowed SeaDrop contract.\n * @param signer The signer to update.\n * @param signedMintValidationParams Minimum and maximum parameters\n * to enforce for signed mints.\n */\n function updateSignedMintValidationParams(\n address seaDropImpl,\n address signer,\n SignedMintValidationParams memory signedMintValidationParams\n ) external;\n\n /**\n * @notice Update the allowed payers for this nft contract on SeaDrop.\n * Only the owner can use this function.\n *\n * @param seaDropImpl The allowed SeaDrop contract.\n * @param payer The payer to update.\n * @param allowed Whether the payer is allowed.\n */\n function updatePayer(\n address seaDropImpl,\n address payer,\n bool allowed\n ) external;\n}\n" }, "src/interfaces/ISeaDrop.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.17;\n\nimport {\n AllowListData,\n MintParams,\n PublicDrop,\n TokenGatedDropStage,\n TokenGatedMintParams,\n SignedMintValidationParams\n} from \"../lib/SeaDropStructs.sol\";\n\nimport { SeaDropErrorsAndEvents } from \"../lib/SeaDropErrorsAndEvents.sol\";\n\ninterface ISeaDrop is SeaDropErrorsAndEvents {\n /**\n * @notice Mint a public drop.\n *\n * @param nftContract The nft contract to mint.\n * @param feeRecipient The fee recipient.\n * @param minterIfNotPayer The mint recipient if different than the payer.\n * @param quantity The number of tokens to mint.\n */\n function mintPublic(\n address nftContract,\n address feeRecipient,\n address minterIfNotPayer,\n uint256 quantity\n ) external payable;\n\n /**\n * @notice Mint from an allow list.\n *\n * @param nftContract The nft contract to mint.\n * @param feeRecipient The fee recipient.\n * @param minterIfNotPayer The mint recipient if different than the payer.\n * @param quantity The number of tokens to mint.\n * @param mintParams The mint parameters.\n * @param proof The proof for the leaf of the allow list.\n */\n function mintAllowList(\n address nftContract,\n address feeRecipient,\n address minterIfNotPayer,\n uint256 quantity,\n MintParams calldata mintParams,\n bytes32[] calldata proof\n ) external payable;\n\n /**\n * @notice Mint with a server-side signature.\n * Note that a signature can only be used once.\n *\n * @param nftContract The nft contract to mint.\n * @param feeRecipient The fee recipient.\n * @param minterIfNotPayer The mint recipient if different than the payer.\n * @param quantity The number of tokens to mint.\n * @param mintParams The mint parameters.\n * @param salt The sale for the signed mint.\n * @param signature The server-side signature, must be an allowed\n * signer.\n */\n function mintSigned(\n address nftContract,\n address feeRecipient,\n address minterIfNotPayer,\n uint256 quantity,\n MintParams calldata mintParams,\n uint256 salt,\n bytes calldata signature\n ) external payable;\n\n /**\n * @notice Mint as an allowed token holder.\n * This will mark the token id as redeemed and will revert if the\n * same token id is attempted to be redeemed twice.\n *\n * @param nftContract The nft contract to mint.\n * @param feeRecipient The fee recipient.\n * @param minterIfNotPayer The mint recipient if different than the payer.\n * @param mintParams The token gated mint params.\n */\n function mintAllowedTokenHolder(\n address nftContract,\n address feeRecipient,\n address minterIfNotPayer,\n TokenGatedMintParams calldata mintParams\n ) external payable;\n\n /**\n * @notice Emits an event to notify update of the drop URI.\n *\n * This method assume msg.sender is an nft contract and its\n * ERC165 interface id matches INonFungibleSeaDropToken.\n *\n * Note: Be sure only authorized users can call this from\n * token contracts that implement INonFungibleSeaDropToken.\n *\n * @param dropURI The new drop URI.\n */\n function updateDropURI(string calldata dropURI) external;\n\n /**\n * @notice Updates the public drop data for the nft contract\n * and emits an event.\n *\n * This method assume msg.sender is an nft contract and its\n * ERC165 interface id matches INonFungibleSeaDropToken.\n *\n * Note: Be sure only authorized users can call this from\n * token contracts that implement INonFungibleSeaDropToken.\n *\n * @param publicDrop The public drop data.\n */\n function updatePublicDrop(PublicDrop calldata publicDrop) external;\n\n /**\n * @notice Updates the allow list merkle root for the nft contract\n * and emits an event.\n *\n * This method assume msg.sender is an nft contract and its\n * ERC165 interface id matches INonFungibleSeaDropToken.\n *\n * Note: Be sure only authorized users can call this from\n * token contracts that implement INonFungibleSeaDropToken.\n *\n * @param allowListData The allow list data.\n */\n function updateAllowList(AllowListData calldata allowListData) external;\n\n /**\n * @notice Updates the token gated drop stage for the nft contract\n * and emits an event.\n *\n * This method assume msg.sender is an nft contract and its\n * ERC165 interface id matches INonFungibleSeaDropToken.\n *\n * Note: Be sure only authorized users can call this from\n * token contracts that implement INonFungibleSeaDropToken.\n *\n * Note: If two INonFungibleSeaDropToken tokens are doing\n * simultaneous token gated drop promotions for each other,\n * they can be minted by the same actor until\n * `maxTokenSupplyForStage` is reached. Please ensure the\n * `allowedNftToken` is not running an active drop during\n * the `dropStage` time period.\n *\n * @param allowedNftToken The token gated nft token.\n * @param dropStage The token gated drop stage data.\n */\n function updateTokenGatedDrop(\n address allowedNftToken,\n TokenGatedDropStage calldata dropStage\n ) external;\n\n /**\n * @notice Updates the creator payout address and emits an event.\n *\n * This method assume msg.sender is an nft contract and its\n * ERC165 interface id matches INonFungibleSeaDropToken.\n *\n * Note: Be sure only authorized users can call this from\n * token contracts that implement INonFungibleSeaDropToken.\n *\n * @param payoutAddress The creator payout address.\n */\n function updateCreatorPayoutAddress(address payoutAddress) external;\n\n /**\n * @notice Updates the allowed fee recipient and emits an event.\n *\n * This method assume msg.sender is an nft contract and its\n * ERC165 interface id matches INonFungibleSeaDropToken.\n *\n * Note: Be sure only authorized users can call this from\n * token contracts that implement INonFungibleSeaDropToken.\n *\n * @param feeRecipient The fee recipient.\n * @param allowed If the fee recipient is allowed.\n */\n function updateAllowedFeeRecipient(address feeRecipient, bool allowed)\n external;\n\n /**\n * @notice Updates the allowed server-side signers and emits an event.\n *\n * This method assume msg.sender is an nft contract and its\n * ERC165 interface id matches INonFungibleSeaDropToken.\n *\n * Note: Be sure only authorized users can call this from\n * token contracts that implement INonFungibleSeaDropToken.\n *\n * @param signer The signer to update.\n * @param signedMintValidationParams Minimum and maximum parameters\n * to enforce for signed mints.\n */\n function updateSignedMintValidationParams(\n address signer,\n SignedMintValidationParams calldata signedMintValidationParams\n ) external;\n\n /**\n * @notice Updates the allowed payer and emits an event.\n *\n * This method assume msg.sender is an nft contract and its\n * ERC165 interface id matches INonFungibleSeaDropToken.\n *\n * Note: Be sure only authorized users can call this from\n * token contracts that implement INonFungibleSeaDropToken.\n *\n * @param payer The payer to add or remove.\n * @param allowed Whether to add or remove the payer.\n */\n function updatePayer(address payer, bool allowed) external;\n\n /**\n * @notice Returns the public drop data for the nft contract.\n *\n * @param nftContract The nft contract.\n */\n function getPublicDrop(address nftContract)\n external\n view\n returns (PublicDrop memory);\n\n /**\n * @notice Returns the creator payout address for the nft contract.\n *\n * @param nftContract The nft contract.\n */\n function getCreatorPayoutAddress(address nftContract)\n external\n view\n returns (address);\n\n /**\n * @notice Returns the allow list merkle root for the nft contract.\n *\n * @param nftContract The nft contract.\n */\n function getAllowListMerkleRoot(address nftContract)\n external\n view\n returns (bytes32);\n\n /**\n * @notice Returns if the specified fee recipient is allowed\n * for the nft contract.\n *\n * @param nftContract The nft contract.\n * @param feeRecipient The fee recipient.\n */\n function getFeeRecipientIsAllowed(address nftContract, address feeRecipient)\n external\n view\n returns (bool);\n\n /**\n * @notice Returns an enumeration of allowed fee recipients for an\n * nft contract when fee recipients are enforced\n *\n * @param nftContract The nft contract.\n */\n function getAllowedFeeRecipients(address nftContract)\n external\n view\n returns (address[] memory);\n\n /**\n * @notice Returns the server-side signers for the nft contract.\n *\n * @param nftContract The nft contract.\n */\n function getSigners(address nftContract)\n external\n view\n returns (address[] memory);\n\n /**\n * @notice Returns the struct of SignedMintValidationParams for a signer.\n *\n * @param nftContract The nft contract.\n * @param signer The signer.\n */\n function getSignedMintValidationParams(address nftContract, address signer)\n external\n view\n returns (SignedMintValidationParams memory);\n\n /**\n * @notice Returns the payers for the nft contract.\n *\n * @param nftContract The nft contract.\n */\n function getPayers(address nftContract)\n external\n view\n returns (address[] memory);\n\n /**\n * @notice Returns if the specified payer is allowed\n * for the nft contract.\n *\n * @param nftContract The nft contract.\n * @param payer The payer.\n */\n function getPayerIsAllowed(address nftContract, address payer)\n external\n view\n returns (bool);\n\n /**\n * @notice Returns the allowed token gated drop tokens for the nft contract.\n *\n * @param nftContract The nft contract.\n */\n function getTokenGatedAllowedTokens(address nftContract)\n external\n view\n returns (address[] memory);\n\n /**\n * @notice Returns the token gated drop data for the nft contract\n * and token gated nft.\n *\n * @param nftContract The nft contract.\n * @param allowedNftToken The token gated nft token.\n */\n function getTokenGatedDrop(address nftContract, address allowedNftToken)\n external\n view\n returns (TokenGatedDropStage memory);\n\n /**\n * @notice Returns whether the token id for a token gated drop has been\n * redeemed.\n *\n * @param nftContract The nft contract.\n * @param allowedNftToken The token gated nft token.\n * @param allowedNftTokenId The token gated nft token id to check.\n */\n function getAllowedNftTokenIdIsRedeemed(\n address nftContract,\n address allowedNftToken,\n uint256 allowedNftTokenId\n ) external view returns (bool);\n}\n" }, "src/lib/SeaDropStructs.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.17;\n\n/**\n * @notice A struct defining public drop data.\n * Designed to fit efficiently in one storage slot.\n * \n * @param mintPrice The mint price per token. (Up to 1.2m\n * of native token, e.g. ETH, MATIC)\n * @param startTime The start time, ensure this is not zero.\n * @param endTIme The end time, ensure this is not zero.\n * @param maxTotalMintableByWallet Maximum total number of mints a user is\n * allowed. (The limit for this field is\n * 2^16 - 1)\n * @param feeBps Fee out of 10_000 basis points to be\n * collected.\n * @param restrictFeeRecipients If false, allow any fee recipient;\n * if true, check fee recipient is allowed.\n */\nstruct PublicDrop {\n uint80 mintPrice; // 80/256 bits\n uint48 startTime; // 128/256 bits\n uint48 endTime; // 176/256 bits\n uint16 maxTotalMintableByWallet; // 224/256 bits\n uint16 feeBps; // 240/256 bits\n bool restrictFeeRecipients; // 248/256 bits\n}\n\n/**\n * @notice A struct defining token gated drop stage data.\n * Designed to fit efficiently in one storage slot.\n * \n * @param mintPrice The mint price per token. (Up to 1.2m \n * of native token, e.g.: ETH, MATIC)\n * @param maxTotalMintableByWallet Maximum total number of mints a user is\n * allowed. (The limit for this field is\n * 2^16 - 1)\n * @param startTime The start time, ensure this is not zero.\n * @param endTime The end time, ensure this is not zero.\n * @param dropStageIndex The drop stage index to emit with the event\n * for analytical purposes. This should be \n * non-zero since the public mint emits\n * with index zero.\n * @param maxTokenSupplyForStage The limit of token supply this stage can\n * mint within. (The limit for this field is\n * 2^16 - 1)\n * @param feeBps Fee out of 10_000 basis points to be\n * collected.\n * @param restrictFeeRecipients If false, allow any fee recipient;\n * if true, check fee recipient is allowed.\n */\nstruct TokenGatedDropStage {\n uint80 mintPrice; // 80/256 bits\n uint16 maxTotalMintableByWallet; // 96/256 bits\n uint48 startTime; // 144/256 bits\n uint48 endTime; // 192/256 bits\n uint8 dropStageIndex; // non-zero. 200/256 bits\n uint32 maxTokenSupplyForStage; // 232/256 bits\n uint16 feeBps; // 248/256 bits\n bool restrictFeeRecipients; // 256/256 bits\n}\n\n/**\n * @notice A struct defining mint params for an allow list.\n * An allow list leaf will be composed of `msg.sender` and\n * the following params.\n * \n * Note: Since feeBps is encoded in the leaf, backend should ensure\n * that feeBps is acceptable before generating a proof.\n * \n * @param mintPrice The mint price per token.\n * @param maxTotalMintableByWallet Maximum total number of mints a user is\n * allowed.\n * @param startTime The start time, ensure this is not zero.\n * @param endTime The end time, ensure this is not zero.\n * @param dropStageIndex The drop stage index to emit with the event\n * for analytical purposes. This should be\n * non-zero since the public mint emits with\n * index zero.\n * @param maxTokenSupplyForStage The limit of token supply this stage can\n * mint within.\n * @param feeBps Fee out of 10_000 basis points to be\n * collected.\n * @param restrictFeeRecipients If false, allow any fee recipient;\n * if true, check fee recipient is allowed.\n */\nstruct MintParams {\n uint256 mintPrice; \n uint256 maxTotalMintableByWallet;\n uint256 startTime;\n uint256 endTime;\n uint256 dropStageIndex; // non-zero\n uint256 maxTokenSupplyForStage;\n uint256 feeBps;\n bool restrictFeeRecipients;\n}\n\n/**\n * @notice A struct defining token gated mint params.\n * \n * @param allowedNftToken The allowed nft token contract address.\n * @param allowedNftTokenIds The token ids to redeem.\n */\nstruct TokenGatedMintParams {\n address allowedNftToken;\n uint256[] allowedNftTokenIds;\n}\n\n/**\n * @notice A struct defining allow list data (for minting an allow list).\n * \n * @param merkleRoot The merkle root for the allow list.\n * @param publicKeyURIs If the allowListURI is encrypted, a list of URIs\n * pointing to the public keys. Empty if unencrypted.\n * @param allowListURI The URI for the allow list.\n */\nstruct AllowListData {\n bytes32 merkleRoot;\n string[] publicKeyURIs;\n string allowListURI;\n}\n\n/**\n * @notice A struct defining minimum and maximum parameters to validate for \n * signed mints, to minimize negative effects of a compromised signer.\n *\n * @param minMintPrice The minimum mint price allowed.\n * @param maxMaxTotalMintableByWallet The maximum total number of mints allowed\n * by a wallet.\n * @param minStartTime The minimum start time allowed.\n * @param maxEndTime The maximum end time allowed.\n * @param maxMaxTokenSupplyForStage The maximum token supply allowed.\n * @param minFeeBps The minimum fee allowed.\n * @param maxFeeBps The maximum fee allowed.\n */\nstruct SignedMintValidationParams {\n uint80 minMintPrice; // 80/256 bits\n uint24 maxMaxTotalMintableByWallet; // 104/256 bits\n uint40 minStartTime; // 144/256 bits\n uint40 maxEndTime; // 184/256 bits\n uint40 maxMaxTokenSupplyForStage; // 224/256 bits\n uint16 minFeeBps; // 240/256 bits\n uint16 maxFeeBps; // 256/256 bits\n}" }, "src/lib/ERC721SeaDropStructsErrorsAndEvents.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.17;\n\nimport {\n AllowListData,\n PublicDrop,\n SignedMintValidationParams,\n TokenGatedDropStage\n} from \"./SeaDropStructs.sol\";\n\ninterface ERC721SeaDropStructsErrorsAndEvents {\n /**\n * @notice Revert with an error if mint exceeds the max supply.\n */\n error MintQuantityExceedsMaxSupply(uint256 total, uint256 maxSupply);\n\n /**\n * @notice Revert with an error if the number of token gated \n * allowedNftTokens doesn't match the length of supplied\n * drop stages.\n */\n error TokenGatedMismatch();\n\n /**\n * @notice Revert with an error if the number of signers doesn't match\n * the length of supplied signedMintValidationParams\n */\n error SignersMismatch();\n\n /**\n * @notice An event to signify that a SeaDrop token contract was deployed.\n */\n event SeaDropTokenDeployed();\n\n /**\n * @notice A struct to configure multiple contract options at a time.\n */\n struct MultiConfigureStruct {\n uint256 maxSupply;\n string baseURI;\n string contractURI;\n address seaDropImpl;\n PublicDrop publicDrop;\n string dropURI;\n AllowListData allowListData;\n address creatorPayoutAddress;\n bytes32 provenanceHash;\n\n address[] allowedFeeRecipients;\n address[] disallowedFeeRecipients;\n\n address[] allowedPayers;\n address[] disallowedPayers;\n\n // Token-gated\n address[] tokenGatedAllowedNftTokens;\n TokenGatedDropStage[] tokenGatedDropStages;\n address[] disallowedTokenGatedAllowedNftTokens;\n\n // Server-signed\n address[] signers;\n SignedMintValidationParams[] signedMintValidationParams;\n address[] disallowedSigners;\n }\n}" }, "src/clones/ERC721ACloneable.sol": { "content": "// SPDX-License-Identifier: MIT\n// ERC721A Contracts v4.2.2\n// Creator: Chiru Labs\n\npragma solidity ^0.8.4;\n\nimport { IERC721A } from \"ERC721A/IERC721A.sol\";\n\nimport {\n Initializable\n} from \"openzeppelin-contracts-upgradeable/proxy/utils/Initializable.sol\";\n\n/**\n * @dev Interface of ERC721 token receiver.\n */\ninterface ERC721A__IERC721Receiver {\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n\n/**\n * @title ERC721A\n *\n * @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721)\n * Non-Fungible Token Standard, including the Metadata extension.\n * Optimized for lower gas during batch mints.\n *\n * Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...)\n * starting from `_startTokenId()`.\n *\n * Assumptions:\n *\n * - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply.\n * - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256).\n */\ncontract ERC721ACloneable is IERC721A, Initializable {\n // Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364).\n struct TokenApprovalRef {\n address value;\n }\n\n // =============================================================\n // CONSTANTS\n // =============================================================\n\n // Mask of an entry in packed address data.\n uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1;\n\n // The bit position of `numberMinted` in packed address data.\n uint256 private constant _BITPOS_NUMBER_MINTED = 64;\n\n // The bit position of `numberBurned` in packed address data.\n uint256 private constant _BITPOS_NUMBER_BURNED = 128;\n\n // The bit position of `aux` in packed address data.\n uint256 private constant _BITPOS_AUX = 192;\n\n // Mask of all 256 bits in packed address data except the 64 bits for `aux`.\n uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1;\n\n // The bit position of `startTimestamp` in packed ownership.\n uint256 private constant _BITPOS_START_TIMESTAMP = 160;\n\n // The bit mask of the `burned` bit in packed ownership.\n uint256 private constant _BITMASK_BURNED = 1 << 224;\n\n // The bit position of the `nextInitialized` bit in packed ownership.\n uint256 private constant _BITPOS_NEXT_INITIALIZED = 225;\n\n // The bit mask of the `nextInitialized` bit in packed ownership.\n uint256 private constant _BITMASK_NEXT_INITIALIZED = 1 << 225;\n\n // The bit position of `extraData` in packed ownership.\n uint256 private constant _BITPOS_EXTRA_DATA = 232;\n\n // Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`.\n uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1;\n\n // The mask of the lower 160 bits for addresses.\n uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1;\n\n // The maximum `quantity` that can be minted with {_mintERC2309}.\n // This limit is to prevent overflows on the address data entries.\n // For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309}\n // is required to cause an overflow, which is unrealistic.\n uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000;\n\n // The `Transfer` event signature is given by:\n // `keccak256(bytes(\"Transfer(address,address,uint256)\"))`.\n bytes32 private constant _TRANSFER_EVENT_SIGNATURE =\n 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef;\n\n // =============================================================\n // STORAGE\n // =============================================================\n\n // The next token ID to be minted.\n uint256 private _currentIndex;\n\n // The number of tokens burned.\n uint256 private _burnCounter;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to ownership details\n // An empty struct value does not necessarily mean the token is unowned.\n // See {_packedOwnershipOf} implementation for details.\n //\n // Bits Layout:\n // - [0..159] `addr`\n // - [160..223] `startTimestamp`\n // - [224] `burned`\n // - [225] `nextInitialized`\n // - [232..255] `extraData`\n mapping(uint256 => uint256) private _packedOwnerships;\n\n // Mapping owner address to address data.\n //\n // Bits Layout:\n // - [0..63] `balance`\n // - [64..127] `numberMinted`\n // - [128..191] `numberBurned`\n // - [192..255] `aux`\n mapping(address => uint256) private _packedAddressData;\n\n // Mapping from token ID to approved address.\n mapping(uint256 => TokenApprovalRef) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n // =============================================================\n // CONSTRUCTOR\n // =============================================================\n\n function __ERC721ACloneable__init(\n string memory name_,\n string memory symbol_\n ) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n _currentIndex = _startTokenId();\n }\n\n // =============================================================\n // TOKEN COUNTING OPERATIONS\n // =============================================================\n\n /**\n * @dev Returns the starting token ID.\n * To change the starting token ID, please override this function.\n */\n function _startTokenId() internal view virtual returns (uint256) {\n return 0;\n }\n\n /**\n * @dev Returns the next token ID to be minted.\n */\n function _nextTokenId() internal view virtual returns (uint256) {\n return _currentIndex;\n }\n\n /**\n * @dev Returns the total number of tokens in existence.\n * Burned tokens will reduce the count.\n * To get the total number of tokens minted, please see {_totalMinted}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n // Counter underflow is impossible as _burnCounter cannot be incremented\n // more than `_currentIndex - _startTokenId()` times.\n unchecked {\n return _currentIndex - _burnCounter - _startTokenId();\n }\n }\n\n /**\n * @dev Returns the total amount of tokens minted in the contract.\n */\n function _totalMinted() internal view virtual returns (uint256) {\n // Counter underflow is impossible as `_currentIndex` does not decrement,\n // and it is initialized to `_startTokenId()`.\n unchecked {\n return _currentIndex - _startTokenId();\n }\n }\n\n /**\n * @dev Returns the total number of tokens burned.\n */\n function _totalBurned() internal view virtual returns (uint256) {\n return _burnCounter;\n }\n\n // =============================================================\n // ADDRESS DATA OPERATIONS\n // =============================================================\n\n /**\n * @dev Returns the number of tokens in `owner`'s account.\n */\n function balanceOf(address owner)\n public\n view\n virtual\n override\n returns (uint256)\n {\n if (owner == address(0)) revert BalanceQueryForZeroAddress();\n return _packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY;\n }\n\n /**\n * Returns the number of tokens minted by `owner`.\n */\n function _numberMinted(address owner) internal view returns (uint256) {\n return\n (_packedAddressData[owner] >> _BITPOS_NUMBER_MINTED) &\n _BITMASK_ADDRESS_DATA_ENTRY;\n }\n\n /**\n * Returns the number of tokens burned by or on behalf of `owner`.\n */\n function _numberBurned(address owner) internal view returns (uint256) {\n return\n (_packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) &\n _BITMASK_ADDRESS_DATA_ENTRY;\n }\n\n /**\n * Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).\n */\n function _getAux(address owner) internal view returns (uint64) {\n return uint64(_packedAddressData[owner] >> _BITPOS_AUX);\n }\n\n /**\n * Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).\n * If there are multiple variables, please pack them into a uint64.\n */\n function _setAux(address owner, uint64 aux) internal virtual {\n uint256 packed = _packedAddressData[owner];\n uint256 auxCasted;\n // Cast `aux` with assembly to avoid redundant masking.\n assembly {\n auxCasted := aux\n }\n packed =\n (packed & _BITMASK_AUX_COMPLEMENT) |\n (auxCasted << _BITPOS_AUX);\n _packedAddressData[owner] = packed;\n }\n\n // =============================================================\n // IERC165\n // =============================================================\n\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30000 gas.\n */\n function supportsInterface(bytes4 interfaceId)\n public\n view\n virtual\n override\n returns (bool)\n {\n // The interface IDs are constants representing the first 4 bytes\n // of the XOR of all function selectors in the interface.\n // See: [ERC165](https://eips.ethereum.org/EIPS/eip-165)\n // (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`)\n return\n interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165.\n interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721.\n interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata.\n }\n\n // =============================================================\n // IERC721Metadata\n // =============================================================\n\n /**\n * @dev Returns the token collection name.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId)\n public\n view\n virtual\n override\n returns (string memory)\n {\n if (!_exists(tokenId)) revert URIQueryForNonexistentToken();\n\n string memory baseURI = _baseURI();\n return\n bytes(baseURI).length != 0\n ? string(abi.encodePacked(baseURI, _toString(tokenId)))\n : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, it can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n // =============================================================\n // OWNERSHIPS OPERATIONS\n // =============================================================\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId)\n public\n view\n virtual\n override\n returns (address)\n {\n return address(uint160(_packedOwnershipOf(tokenId)));\n }\n\n /**\n * @dev Gas spent here starts off proportional to the maximum mint batch size.\n * It gradually moves to O(1) as tokens get transferred around over time.\n */\n function _ownershipOf(uint256 tokenId)\n internal\n view\n virtual\n returns (TokenOwnership memory)\n {\n return _unpackedOwnership(_packedOwnershipOf(tokenId));\n }\n\n /**\n * @dev Returns the unpacked `TokenOwnership` struct at `index`.\n */\n function _ownershipAt(uint256 index)\n internal\n view\n virtual\n returns (TokenOwnership memory)\n {\n return _unpackedOwnership(_packedOwnerships[index]);\n }\n\n /**\n * @dev Initializes the ownership slot minted at `index` for efficiency purposes.\n */\n function _initializeOwnershipAt(uint256 index) internal virtual {\n if (_packedOwnerships[index] == 0) {\n _packedOwnerships[index] = _packedOwnershipOf(index);\n }\n }\n\n /**\n * Returns the packed ownership data of `tokenId`.\n */\n function _packedOwnershipOf(uint256 tokenId)\n private\n view\n returns (uint256)\n {\n uint256 curr = tokenId;\n\n unchecked {\n if (_startTokenId() <= curr) {\n if (curr < _currentIndex) {\n uint256 packed = _packedOwnerships[curr];\n // If not burned.\n if (packed & _BITMASK_BURNED == 0) {\n // Invariant:\n // There will always be an initialized ownership slot\n // (i.e. `ownership.addr != address(0) && ownership.burned == false`)\n // before an unintialized ownership slot\n // (i.e. `ownership.addr == address(0) && ownership.burned == false`)\n // Hence, `curr` will not underflow.\n //\n // We can directly compare the packed value.\n // If the address is zero, packed will be zero.\n while (packed == 0) {\n packed = _packedOwnerships[--curr];\n }\n return packed;\n }\n }\n }\n }\n revert OwnerQueryForNonexistentToken();\n }\n\n /**\n * @dev Returns the unpacked `TokenOwnership` struct from `packed`.\n */\n function _unpackedOwnership(uint256 packed)\n private\n pure\n returns (TokenOwnership memory ownership)\n {\n ownership.addr = address(uint160(packed));\n ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP);\n ownership.burned = packed & _BITMASK_BURNED != 0;\n ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA);\n }\n\n /**\n * @dev Packs ownership data into a single uint256.\n */\n function _packOwnershipData(address owner, uint256 flags)\n private\n view\n returns (uint256 result)\n {\n assembly {\n // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.\n owner := and(owner, _BITMASK_ADDRESS)\n // `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`.\n result := or(\n owner,\n or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags)\n )\n }\n }\n\n /**\n * @dev Returns the `nextInitialized` flag set if `quantity` equals 1.\n */\n function _nextInitializedFlag(uint256 quantity)\n private\n pure\n returns (uint256 result)\n {\n // For branchless setting of the `nextInitialized` flag.\n assembly {\n // `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`.\n result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1))\n }\n }\n\n // =============================================================\n // APPROVAL OPERATIONS\n // =============================================================\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the\n * zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ownerOf(tokenId);\n\n if (_msgSenderERC721A() != owner) {\n if (!isApprovedForAll(owner, _msgSenderERC721A())) {\n revert ApprovalCallerNotOwnerNorApproved();\n }\n }\n\n _tokenApprovals[tokenId].value = to;\n emit Approval(owner, to, tokenId);\n }\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId)\n public\n view\n virtual\n override\n returns (address)\n {\n if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();\n\n return _tokenApprovals[tokenId].value;\n }\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom}\n * for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool approved)\n public\n virtual\n override\n {\n _operatorApprovals[_msgSenderERC721A()][operator] = approved;\n emit ApprovalForAll(_msgSenderERC721A(), operator, approved);\n }\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address owner, address operator)\n public\n view\n virtual\n override\n returns (bool)\n {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted. See {_mint}.\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return\n _startTokenId() <= tokenId &&\n tokenId < _currentIndex && // If within bounds,\n _packedOwnerships[tokenId] & _BITMASK_BURNED == 0; // and not burned.\n }\n\n /**\n * @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`.\n */\n function _isSenderApprovedOrOwner(\n address approvedAddress,\n address owner,\n address msgSender\n ) private pure returns (bool result) {\n assembly {\n // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.\n owner := and(owner, _BITMASK_ADDRESS)\n // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean.\n msgSender := and(msgSender, _BITMASK_ADDRESS)\n // `msgSender == owner || msgSender == approvedAddress`.\n result := or(eq(msgSender, owner), eq(msgSender, approvedAddress))\n }\n }\n\n /**\n * @dev Returns the storage slot and value for the approved address of `tokenId`.\n */\n function _getApprovedSlotAndAddress(uint256 tokenId)\n private\n view\n returns (uint256 approvedAddressSlot, address approvedAddress)\n {\n TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId];\n // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`.\n assembly {\n approvedAddressSlot := tokenApproval.slot\n approvedAddress := sload(approvedAddressSlot)\n }\n }\n\n // =============================================================\n // TRANSFER OPERATIONS\n // =============================================================\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token\n * by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);\n\n if (address(uint160(prevOwnershipPacked)) != from)\n revert TransferFromIncorrectOwner();\n\n (\n uint256 approvedAddressSlot,\n address approvedAddress\n ) = _getApprovedSlotAndAddress(tokenId);\n\n // The nested ifs save around 20+ gas over a compound boolean condition.\n if (\n !_isSenderApprovedOrOwner(\n approvedAddress,\n from,\n _msgSenderERC721A()\n )\n ) {\n if (!isApprovedForAll(from, _msgSenderERC721A()))\n revert TransferCallerNotOwnerNorApproved();\n }\n\n if (to == address(0)) revert TransferToZeroAddress();\n\n _beforeTokenTransfers(from, to, tokenId, 1);\n\n // Clear approvals from the previous owner.\n assembly {\n if approvedAddress {\n // This is equivalent to `delete _tokenApprovals[tokenId]`.\n sstore(approvedAddressSlot, 0)\n }\n }\n\n // Underflow of the sender's balance is impossible because we check for\n // ownership above and the recipient's balance can't realistically overflow.\n // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.\n unchecked {\n // We can directly increment and decrement the balances.\n --_packedAddressData[from]; // Updates: `balance -= 1`.\n ++_packedAddressData[to]; // Updates: `balance += 1`.\n\n // Updates:\n // - `address` to the next owner.\n // - `startTimestamp` to the timestamp of transfering.\n // - `burned` to `false`.\n // - `nextInitialized` to `true`.\n _packedOwnerships[tokenId] = _packOwnershipData(\n to,\n _BITMASK_NEXT_INITIALIZED |\n _nextExtraData(from, to, prevOwnershipPacked)\n );\n\n // If the next slot may not have been initialized (i.e. `nextInitialized == false`) .\n if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {\n uint256 nextTokenId = tokenId + 1;\n // If the next slot's address is zero and not burned (i.e. packed value is zero).\n if (_packedOwnerships[nextTokenId] == 0) {\n // If the next slot is within bounds.\n if (nextTokenId != _currentIndex) {\n // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.\n _packedOwnerships[nextTokenId] = prevOwnershipPacked;\n }\n }\n }\n }\n\n emit Transfer(from, to, tokenId);\n _afterTokenTransfers(from, to, tokenId, 1);\n }\n\n /**\n * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token\n * by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement\n * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) public virtual override {\n transferFrom(from, to, tokenId);\n if (to.code.length != 0) {\n if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {\n revert TransferToNonERC721ReceiverImplementer();\n }\n }\n }\n\n /**\n * @dev Hook that is called before a set of serially-ordered token IDs\n * are about to be transferred. This includes minting.\n * And also called before burning one token.\n *\n * `startTokenId` - the first token ID to be transferred.\n * `quantity` - the amount to be transferred.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be\n * transferred to `to`.\n * - When `from` is zero, `tokenId` will be minted for `to`.\n * - When `to` is zero, `tokenId` will be burned by `from`.\n * - `from` and `to` are never both zero.\n */\n function _beforeTokenTransfers(\n address from,\n address to,\n uint256 startTokenId,\n uint256 quantity\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after a set of serially-ordered token IDs\n * have been transferred. This includes minting.\n * And also called after one token has been burned.\n *\n * `startTokenId` - the first token ID to be transferred.\n * `quantity` - the amount to be transferred.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been\n * transferred to `to`.\n * - When `from` is zero, `tokenId` has been minted for `to`.\n * - When `to` is zero, `tokenId` has been burned by `from`.\n * - `from` and `to` are never both zero.\n */\n function _afterTokenTransfers(\n address from,\n address to,\n uint256 startTokenId,\n uint256 quantity\n ) internal virtual {}\n\n /**\n * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract.\n *\n * `from` - Previous owner of the given token ID.\n * `to` - Target address that will receive the token.\n * `tokenId` - Token ID to be transferred.\n * `_data` - Optional data to send along with the call.\n *\n * Returns whether the call correctly returned the expected magic value.\n */\n function _checkContractOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory _data\n ) private returns (bool) {\n try\n ERC721A__IERC721Receiver(to).onERC721Received(\n _msgSenderERC721A(),\n from,\n tokenId,\n _data\n )\n returns (bytes4 retval) {\n return\n retval ==\n ERC721A__IERC721Receiver(to).onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert TransferToNonERC721ReceiverImplementer();\n } else {\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n }\n\n // =============================================================\n // MINT OPERATIONS\n // =============================================================\n\n /**\n * @dev Mints `quantity` tokens and transfers them to `to`.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `quantity` must be greater than 0.\n *\n * Emits a {Transfer} event for each mint.\n */\n function _mint(address to, uint256 quantity) internal virtual {\n uint256 startTokenId = _currentIndex;\n if (quantity == 0) revert MintZeroQuantity();\n\n _beforeTokenTransfers(address(0), to, startTokenId, quantity);\n\n // Overflows are incredibly unrealistic.\n // `balance` and `numberMinted` have a maximum limit of 2**64.\n // `tokenId` has a maximum limit of 2**256.\n unchecked {\n // Updates:\n // - `balance += quantity`.\n // - `numberMinted += quantity`.\n //\n // We can directly add to the `balance` and `numberMinted`.\n _packedAddressData[to] +=\n quantity *\n ((1 << _BITPOS_NUMBER_MINTED) | 1);\n\n // Updates:\n // - `address` to the owner.\n // - `startTimestamp` to the timestamp of minting.\n // - `burned` to `false`.\n // - `nextInitialized` to `quantity == 1`.\n _packedOwnerships[startTokenId] = _packOwnershipData(\n to,\n _nextInitializedFlag(quantity) |\n _nextExtraData(address(0), to, 0)\n );\n\n uint256 toMasked;\n uint256 end = startTokenId + quantity;\n\n // Use assembly to loop and emit the `Transfer` event for gas savings.\n // The duplicated `log4` removes an extra check and reduces stack juggling.\n // The assembly, together with the surrounding Solidity code, have been\n // delicately arranged to nudge the compiler into producing optimized opcodes.\n assembly {\n // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.\n toMasked := and(to, _BITMASK_ADDRESS)\n // Emit the `Transfer` event.\n log4(\n 0, // Start of data (0, since no data).\n 0, // End of data (0, since no data).\n _TRANSFER_EVENT_SIGNATURE, // Signature.\n 0, // `address(0)`.\n toMasked, // `to`.\n startTokenId // `tokenId`.\n )\n\n // The `iszero(eq(,))` check ensures that large values of `quantity`\n // that overflows uint256 will make the loop run out of gas.\n // The compiler will optimize the `iszero` away for performance.\n for {\n let tokenId := add(startTokenId, 1)\n } iszero(eq(tokenId, end)) {\n tokenId := add(tokenId, 1)\n } {\n // Emit the `Transfer` event. Similar to above.\n log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId)\n }\n }\n if (toMasked == 0) revert MintToZeroAddress();\n\n _currentIndex = end;\n }\n _afterTokenTransfers(address(0), to, startTokenId, quantity);\n }\n\n /**\n * @dev Mints `quantity` tokens and transfers them to `to`.\n *\n * This function is intended for efficient minting only during contract creation.\n *\n * It emits only one {ConsecutiveTransfer} as defined in\n * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309),\n * instead of a sequence of {Transfer} event(s).\n *\n * Calling this function outside of contract creation WILL make your contract\n * non-compliant with the ERC721 standard.\n * For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309\n * {ConsecutiveTransfer} event is only permissible during contract creation.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `quantity` must be greater than 0.\n *\n * Emits a {ConsecutiveTransfer} event.\n */\n function _mintERC2309(address to, uint256 quantity) internal virtual {\n uint256 startTokenId = _currentIndex;\n if (to == address(0)) revert MintToZeroAddress();\n if (quantity == 0) revert MintZeroQuantity();\n if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT)\n revert MintERC2309QuantityExceedsLimit();\n\n _beforeTokenTransfers(address(0), to, startTokenId, quantity);\n\n // Overflows are unrealistic due to the above check for `quantity` to be below the limit.\n unchecked {\n // Updates:\n // - `balance += quantity`.\n // - `numberMinted += quantity`.\n //\n // We can directly add to the `balance` and `numberMinted`.\n _packedAddressData[to] +=\n quantity *\n ((1 << _BITPOS_NUMBER_MINTED) | 1);\n\n // Updates:\n // - `address` to the owner.\n // - `startTimestamp` to the timestamp of minting.\n // - `burned` to `false`.\n // - `nextInitialized` to `quantity == 1`.\n _packedOwnerships[startTokenId] = _packOwnershipData(\n to,\n _nextInitializedFlag(quantity) |\n _nextExtraData(address(0), to, 0)\n );\n\n emit ConsecutiveTransfer(\n startTokenId,\n startTokenId + quantity - 1,\n address(0),\n to\n );\n\n _currentIndex = startTokenId + quantity;\n }\n _afterTokenTransfers(address(0), to, startTokenId, quantity);\n }\n\n /**\n * @dev Safely mints `quantity` tokens and transfers them to `to`.\n *\n * Requirements:\n *\n * - If `to` refers to a smart contract, it must implement\n * {IERC721Receiver-onERC721Received}, which is called for each safe transfer.\n * - `quantity` must be greater than 0.\n *\n * See {_mint}.\n *\n * Emits a {Transfer} event for each mint.\n */\n function _safeMint(\n address to,\n uint256 quantity,\n bytes memory _data\n ) internal virtual {\n _mint(to, quantity);\n\n unchecked {\n if (to.code.length != 0) {\n uint256 end = _currentIndex;\n uint256 index = end - quantity;\n do {\n if (\n !_checkContractOnERC721Received(\n address(0),\n to,\n index++,\n _data\n )\n ) {\n revert TransferToNonERC721ReceiverImplementer();\n }\n } while (index < end);\n // Reentrancy protection.\n if (_currentIndex != end) revert();\n }\n }\n }\n\n /**\n * @dev Equivalent to `_safeMint(to, quantity, '')`.\n */\n function _safeMint(address to, uint256 quantity) internal virtual {\n _safeMint(to, quantity, \"\");\n }\n\n // =============================================================\n // BURN OPERATIONS\n // =============================================================\n\n /**\n * @dev Equivalent to `_burn(tokenId, false)`.\n */\n function _burn(uint256 tokenId) internal virtual {\n _burn(tokenId, false);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId, bool approvalCheck) internal virtual {\n uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);\n\n address from = address(uint160(prevOwnershipPacked));\n\n (\n uint256 approvedAddressSlot,\n address approvedAddress\n ) = _getApprovedSlotAndAddress(tokenId);\n\n if (approvalCheck) {\n // The nested ifs save around 20+ gas over a compound boolean condition.\n if (\n !_isSenderApprovedOrOwner(\n approvedAddress,\n from,\n _msgSenderERC721A()\n )\n ) {\n if (!isApprovedForAll(from, _msgSenderERC721A()))\n revert TransferCallerNotOwnerNorApproved();\n }\n }\n\n _beforeTokenTransfers(from, address(0), tokenId, 1);\n\n // Clear approvals from the previous owner.\n assembly {\n if approvedAddress {\n // This is equivalent to `delete _tokenApprovals[tokenId]`.\n sstore(approvedAddressSlot, 0)\n }\n }\n\n // Underflow of the sender's balance is impossible because we check for\n // ownership above and the recipient's balance can't realistically overflow.\n // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.\n unchecked {\n // Updates:\n // - `balance -= 1`.\n // - `numberBurned += 1`.\n //\n // We can directly decrement the balance, and increment the number burned.\n // This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`.\n _packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1;\n\n // Updates:\n // - `address` to the last owner.\n // - `startTimestamp` to the timestamp of burning.\n // - `burned` to `true`.\n // - `nextInitialized` to `true`.\n _packedOwnerships[tokenId] = _packOwnershipData(\n from,\n (_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) |\n _nextExtraData(from, address(0), prevOwnershipPacked)\n );\n\n // If the next slot may not have been initialized (i.e. `nextInitialized == false`) .\n if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {\n uint256 nextTokenId = tokenId + 1;\n // If the next slot's address is zero and not burned (i.e. packed value is zero).\n if (_packedOwnerships[nextTokenId] == 0) {\n // If the next slot is within bounds.\n if (nextTokenId != _currentIndex) {\n // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.\n _packedOwnerships[nextTokenId] = prevOwnershipPacked;\n }\n }\n }\n }\n\n emit Transfer(from, address(0), tokenId);\n _afterTokenTransfers(from, address(0), tokenId, 1);\n\n // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times.\n unchecked {\n _burnCounter++;\n }\n }\n\n // =============================================================\n // EXTRA DATA OPERATIONS\n // =============================================================\n\n /**\n * @dev Directly sets the extra data for the ownership data `index`.\n */\n function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual {\n uint256 packed = _packedOwnerships[index];\n if (packed == 0) revert OwnershipNotInitializedForExtraData();\n uint256 extraDataCasted;\n // Cast `extraData` with assembly to avoid redundant masking.\n assembly {\n extraDataCasted := extraData\n }\n packed =\n (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) |\n (extraDataCasted << _BITPOS_EXTRA_DATA);\n _packedOwnerships[index] = packed;\n }\n\n /**\n * @dev Called during each token transfer to set the 24bit `extraData` field.\n * Intended to be overridden by the cosumer contract.\n *\n * `previousExtraData` - the value of `extraData` before transfer.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be\n * transferred to `to`.\n * - When `from` is zero, `tokenId` will be minted for `to`.\n * - When `to` is zero, `tokenId` will be burned by `from`.\n * - `from` and `to` are never both zero.\n */\n function _extraData(\n address from,\n address to,\n uint24 previousExtraData\n ) internal view virtual returns (uint24) {}\n\n /**\n * @dev Returns the next extra data for the packed ownership data.\n * The returned result is shifted into position.\n */\n function _nextExtraData(\n address from,\n address to,\n uint256 prevOwnershipPacked\n ) private view returns (uint256) {\n uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA);\n return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA;\n }\n\n // =============================================================\n // OTHER OPERATIONS\n // =============================================================\n\n /**\n * @dev Returns the message sender (defaults to `msg.sender`).\n *\n * If you are writing GSN compatible contracts, you need to override this function.\n */\n function _msgSenderERC721A() internal view virtual returns (address) {\n return msg.sender;\n }\n\n /**\n * @dev Converts a uint256 to its ASCII string decimal representation.\n */\n function _toString(uint256 value)\n internal\n pure\n virtual\n returns (string memory str)\n {\n assembly {\n // The maximum value of a uint256 contains 78 digits (1 byte per digit), but\n // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned.\n // We will need 1 word for the trailing zeros padding, 1 word for the length,\n // and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0.\n let m := add(mload(0x40), 0xa0)\n // Update the free memory pointer to allocate.\n mstore(0x40, m)\n // Assign the `str` to the end.\n str := sub(m, 0x20)\n // Zeroize the slot after the string.\n mstore(str, 0)\n\n // Cache the end of the memory to calculate the length later.\n let end := str\n\n // We write the string from rightmost digit to leftmost digit.\n // The following is essentially a do-while loop that also handles the zero case.\n // prettier-ignore\n for { let temp := value } 1 {} {\n str := sub(str, 1)\n // Write the character to the pointer.\n // The ASCII index of the '0' character is 48.\n mstore8(str, add(48, mod(temp, 10)))\n // Keep dividing `temp` until zero.\n temp := div(temp, 10)\n // prettier-ignore\n if iszero(temp) { break }\n }\n\n let length := sub(end, str)\n // Move the pointer 32 bytes leftwards to make room for the length.\n str := sub(str, 0x20)\n // Store the length.\n mstore(str, length)\n }\n }\n}\n" }, "lib/openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (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 Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n * `nonReentrant` function in the call stack.\n */\n function _reentrancyGuardEntered() internal view returns (bool) {\n return _status == _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" }, "lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" }, "src/interfaces/ISeaDropTokenContractMetadata.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.17;\n\nimport { IERC2981 } from \"openzeppelin-contracts/interfaces/IERC2981.sol\";\n\ninterface ISeaDropTokenContractMetadata is IERC2981 {\n /**\n * @notice Throw if the max supply exceeds uint64, a limit\n * due to the storage of bit-packed variables in ERC721A.\n */\n error CannotExceedMaxSupplyOfUint64(uint256 newMaxSupply);\n\n /**\n * @dev Revert with an error when attempting to set the provenance\n * hash after the mint has started.\n */\n error ProvenanceHashCannotBeSetAfterMintStarted();\n\n /**\n * @dev Revert if the royalty basis points is greater than 10_000.\n */\n error InvalidRoyaltyBasisPoints(uint256 basisPoints);\n\n /**\n * @dev Revert if the royalty address is being set to the zero address.\n */\n error RoyaltyAddressCannotBeZeroAddress();\n\n /**\n * @dev Emit an event for token metadata reveals/updates,\n * according to EIP-4906.\n *\n * @param _fromTokenId The start token id.\n * @param _toTokenId The end token id.\n */\n event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId);\n\n /**\n * @dev Emit an event when the URI for the collection-level metadata\n * is updated.\n */\n event ContractURIUpdated(string newContractURI);\n\n /**\n * @dev Emit an event when the max token supply is updated.\n */\n event MaxSupplyUpdated(uint256 newMaxSupply);\n\n /**\n * @dev Emit an event with the previous and new provenance hash after\n * being updated.\n */\n event ProvenanceHashUpdated(bytes32 previousHash, bytes32 newHash);\n\n /**\n * @dev Emit an event when the royalties info is updated.\n */\n event RoyaltyInfoUpdated(address receiver, uint256 bps);\n\n /**\n * @notice A struct defining royalty info for the contract.\n */\n struct RoyaltyInfo {\n address royaltyAddress;\n uint96 royaltyBps;\n }\n\n /**\n * @notice Sets the base URI for the token metadata and emits an event.\n *\n * @param tokenURI The new base URI to set.\n */\n function setBaseURI(string calldata tokenURI) external;\n\n /**\n * @notice Sets the contract URI for contract metadata.\n *\n * @param newContractURI The new contract URI.\n */\n function setContractURI(string calldata newContractURI) external;\n\n /**\n * @notice Sets the max supply and emits an event.\n *\n * @param newMaxSupply The new max supply to set.\n */\n function setMaxSupply(uint256 newMaxSupply) external;\n\n /**\n * @notice Sets the provenance hash and emits an event.\n *\n * The provenance hash is used for random reveals, which\n * is a hash of the ordered metadata to show it has not been\n * modified after mint started.\n *\n * This function will revert after the first item has been minted.\n *\n * @param newProvenanceHash The new provenance hash to set.\n */\n function setProvenanceHash(bytes32 newProvenanceHash) external;\n\n /**\n * @notice Sets the address and basis points for royalties.\n *\n * @param newInfo The struct to configure royalties.\n */\n function setRoyaltyInfo(RoyaltyInfo calldata newInfo) external;\n\n /**\n * @notice Returns the base URI for token metadata.\n */\n function baseURI() external view returns (string memory);\n\n /**\n * @notice Returns the contract URI.\n */\n function contractURI() external view returns (string memory);\n\n /**\n * @notice Returns the max token supply.\n */\n function maxSupply() external view returns (uint256);\n\n /**\n * @notice Returns the provenance hash.\n * The provenance hash is used for random reveals, which\n * is a hash of the ordered metadata to show it is unmodified\n * after mint has started.\n */\n function provenanceHash() external view returns (bytes32);\n\n /**\n * @notice Returns the address that receives royalties.\n */\n function royaltyAddress() external view returns (address);\n\n /**\n * @notice Returns the royalty basis points out of 10_000.\n */\n function royaltyBasisPoints() external view returns (uint256);\n}\n" }, "src/clones/ERC721AConduitPreapprovedCloneable.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.17;\n\nimport { ERC721ACloneable } from \"./ERC721ACloneable.sol\";\n\n/**\n * @title ERC721AConduitPreapprovedCloneable\n * @notice ERC721A with the OpenSea conduit preapproved.\n */\nabstract contract ERC721AConduitPreapprovedCloneable is ERC721ACloneable {\n /// @dev The canonical OpenSea conduit.\n address internal constant _CONDUIT =\n 0x1E0049783F008A0085193E00003D00cd54003c71;\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the\n * assets of `owner`. Always returns true for the conduit.\n */\n function isApprovedForAll(address owner, address operator)\n public\n view\n virtual\n override\n returns (bool)\n {\n if (operator == _CONDUIT) {\n return true;\n }\n return ERC721ACloneable.isApprovedForAll(owner, operator);\n }\n}\n" }, "src/lib/ERC721TransferValidator.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.17;\n\nimport { ICreatorToken } from \"../interfaces/ICreatorToken.sol\";\n\n/**\n * @title ERC721TransferValidator\n * @notice Functionality to use a transfer validator.\n */\nabstract contract ERC721TransferValidator is ICreatorToken {\n /// @dev Store the transfer validator. The null address means no transfer validator is set.\n address internal _transferValidator;\n\n /// @notice Revert with an error if the transfer validator is being set to the same address.\n error SameTransferValidator();\n\n /// @notice Returns the currently active transfer validator.\n /// The null address means no transfer validator is set.\n function getTransferValidator() external view returns (address) {\n return _transferValidator;\n }\n\n /// @notice Set the transfer validator.\n /// The external method that uses this must include access control.\n function _setTransferValidator(address newValidator) internal {\n address oldValidator = _transferValidator;\n if (oldValidator == newValidator) {\n revert SameTransferValidator();\n }\n _transferValidator = newValidator;\n emit TransferValidatorUpdated(oldValidator, newValidator);\n }\n}\n" }, "src/interfaces/ICreatorToken.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.17;\n\ninterface ICreatorToken {\n event TransferValidatorUpdated(address oldValidator, address newValidator);\n\n function getTransferValidator() external view returns (address validator);\n\n function getTransferValidationFunction()\n external\n view\n returns (bytes4 functionSignature, bool isViewFunction);\n\n function setTransferValidator(address validator) external;\n}\n\ninterface ILegacyCreatorToken {\n event TransferValidatorUpdated(address oldValidator, address newValidator);\n\n function getTransferValidator() external view returns (address validator);\n\n function setTransferValidator(address validator) external;\n}\n" }, "src/interfaces/ITransferValidator.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.17;\n\ninterface ITransferValidator721 {\n /// @notice Ensure that a transfer has been authorized for a specific tokenId\n function validateTransfer(\n address caller,\n address from,\n address to,\n uint256 tokenId\n ) external view;\n}\n\ninterface ITransferValidator1155 {\n /// @notice Ensure that a transfer has been authorized for a specific amount of a specific tokenId, and reduce the transferable amount remaining\n function validateTransfer(\n address caller,\n address from,\n address to,\n uint256 tokenId,\n uint256 amount\n ) external;\n}\n" }, "lib/utility-contracts/src/TwoStepOwnable.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\nimport {ConstructorInitializable} from \"./ConstructorInitializable.sol\";\n\n/**\n@notice A two-step extension of Ownable, where the new owner must claim ownership of the contract after owner initiates transfer\nOwner can cancel the transfer at any point before the new owner claims ownership.\nHelpful in guarding against transferring ownership to an address that is unable to act as the Owner.\n*/\nabstract contract TwoStepOwnable is ConstructorInitializable {\n address private _owner;\n\n event OwnershipTransferred(\n address indexed previousOwner,\n address indexed newOwner\n );\n\n address internal potentialOwner;\n\n event PotentialOwnerUpdated(address newPotentialAdministrator);\n\n error NewOwnerIsZeroAddress();\n error NotNextOwner();\n error OnlyOwner();\n\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n constructor() {\n _initialize();\n }\n\n function _initialize() private onlyConstructor {\n _transferOwnership(msg.sender);\n }\n\n ///@notice Initiate ownership transfer to newPotentialOwner. Note: new owner will have to manually acceptOwnership\n ///@param newPotentialOwner address of potential new owner\n function transferOwnership(address newPotentialOwner)\n public\n virtual\n onlyOwner\n {\n if (newPotentialOwner == address(0)) {\n revert NewOwnerIsZeroAddress();\n }\n potentialOwner = newPotentialOwner;\n emit PotentialOwnerUpdated(newPotentialOwner);\n }\n\n ///@notice Claim ownership of smart contract, after the current owner has initiated the process with transferOwnership\n function acceptOwnership() public virtual {\n address _potentialOwner = potentialOwner;\n if (msg.sender != _potentialOwner) {\n revert NotNextOwner();\n }\n delete potentialOwner;\n emit PotentialOwnerUpdated(address(0));\n _transferOwnership(_potentialOwner);\n }\n\n ///@notice cancel ownership transfer\n function cancelOwnershipTransfer() public virtual onlyOwner {\n delete potentialOwner;\n emit PotentialOwnerUpdated(address(0));\n }\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 if (_owner != msg.sender) {\n revert OnlyOwner();\n }\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 * 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" }, "lib/openzeppelin-contracts/contracts/interfaces/IERC2981.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Interface for the NFT Royalty Standard.\n *\n * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal\n * support for royalty payments across all NFT marketplaces and ecosystem participants.\n *\n * _Available since v4.5._\n */\ninterface IERC2981 is IERC165 {\n /**\n * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of\n * exchange. The royalty amount is denominated and should be paid in that same unit of exchange.\n */\n function royaltyInfo(uint256 tokenId, uint256 salePrice)\n external\n view\n returns (address receiver, uint256 royaltyAmount);\n}\n" }, "src/lib/SeaDropErrorsAndEvents.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.17;\n\nimport { PublicDrop, TokenGatedDropStage, SignedMintValidationParams } from \"./SeaDropStructs.sol\";\n\ninterface SeaDropErrorsAndEvents {\n /**\n * @dev Revert with an error if the drop stage is not active.\n */\n error NotActive(\n uint256 currentTimestamp,\n uint256 startTimestamp,\n uint256 endTimestamp\n );\n\n /**\n * @dev Revert with an error if the mint quantity is zero.\n */\n error MintQuantityCannotBeZero();\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the max allowed\n * to be minted per wallet.\n */\n error MintQuantityExceedsMaxMintedPerWallet(uint256 total, uint256 allowed);\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the max token\n * supply.\n */\n error MintQuantityExceedsMaxSupply(uint256 total, uint256 maxSupply);\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the max token\n * supply for the stage.\n * Note: The `maxTokenSupplyForStage` for public mint is\n * always `type(uint).max`.\n */\n error MintQuantityExceedsMaxTokenSupplyForStage(\n uint256 total, \n uint256 maxTokenSupplyForStage\n );\n \n /**\n * @dev Revert if the fee recipient is the zero address.\n */\n error FeeRecipientCannotBeZeroAddress();\n\n /**\n * @dev Revert if the fee recipient is not already included.\n */\n error FeeRecipientNotPresent();\n\n /**\n * @dev Revert if the fee basis points is greater than 10_000.\n */\n error InvalidFeeBps(uint256 feeBps);\n\n /**\n * @dev Revert if the fee recipient is already included.\n */\n error DuplicateFeeRecipient();\n\n /**\n * @dev Revert if the fee recipient is restricted and not allowed.\n */\n error FeeRecipientNotAllowed();\n\n /**\n * @dev Revert if the creator payout address is the zero address.\n */\n error CreatorPayoutAddressCannotBeZeroAddress();\n\n /**\n * @dev Revert with an error if the received payment is incorrect.\n */\n error IncorrectPayment(uint256 got, uint256 want);\n\n /**\n * @dev Revert with an error if the allow list proof is invalid.\n */\n error InvalidProof();\n\n /**\n * @dev Revert if a supplied signer address is the zero address.\n */\n error SignerCannotBeZeroAddress();\n\n /**\n * @dev Revert with an error if signer's signature is invalid.\n */\n error InvalidSignature(address recoveredSigner);\n\n /**\n * @dev Revert with an error if a signer is not included in\n * the enumeration when removing.\n */\n error SignerNotPresent();\n\n /**\n * @dev Revert with an error if a payer is not included in\n * the enumeration when removing.\n */\n error PayerNotPresent();\n\n /**\n * @dev Revert with an error if a payer is already included in mapping\n * when adding.\n * Note: only applies when adding a single payer, as duplicates in\n * enumeration can be removed with updatePayer.\n */\n error DuplicatePayer();\n\n /**\n * @dev Revert with an error if the payer is not allowed. The minter must\n * pay for their own mint.\n */\n error PayerNotAllowed();\n\n /**\n * @dev Revert if a supplied payer address is the zero address.\n */\n error PayerCannotBeZeroAddress();\n\n /**\n * @dev Revert with an error if the sender does not\n * match the INonFungibleSeaDropToken interface.\n */\n error OnlyINonFungibleSeaDropToken(address sender);\n\n /**\n * @dev Revert with an error if the sender of a token gated supplied\n * drop stage redeem is not the owner of the token.\n */\n error TokenGatedNotTokenOwner(\n address nftContract,\n address allowedNftToken,\n uint256 allowedNftTokenId\n );\n\n /**\n * @dev Revert with an error if the token id has already been used to\n * redeem a token gated drop stage.\n */\n error TokenGatedTokenIdAlreadyRedeemed(\n address nftContract,\n address allowedNftToken,\n uint256 allowedNftTokenId\n );\n\n /**\n * @dev Revert with an error if an empty TokenGatedDropStage is provided\n * for an already-empty TokenGatedDropStage.\n */\n error TokenGatedDropStageNotPresent();\n\n /**\n * @dev Revert with an error if an allowedNftToken is set to\n * the zero address.\n */\n error TokenGatedDropAllowedNftTokenCannotBeZeroAddress();\n\n /**\n * @dev Revert with an error if an allowedNftToken is set to\n * the drop token itself.\n */\n error TokenGatedDropAllowedNftTokenCannotBeDropToken();\n\n\n /**\n * @dev Revert with an error if supplied signed mint price is less than\n * the minimum specified.\n */\n error InvalidSignedMintPrice(uint256 got, uint256 minimum);\n\n /**\n * @dev Revert with an error if supplied signed maxTotalMintableByWallet\n * is greater than the maximum specified.\n */\n error InvalidSignedMaxTotalMintableByWallet(uint256 got, uint256 maximum);\n\n /**\n * @dev Revert with an error if supplied signed start time is less than\n * the minimum specified.\n */\n error InvalidSignedStartTime(uint256 got, uint256 minimum);\n \n /**\n * @dev Revert with an error if supplied signed end time is greater than\n * the maximum specified.\n */\n error InvalidSignedEndTime(uint256 got, uint256 maximum);\n\n /**\n * @dev Revert with an error if supplied signed maxTokenSupplyForStage\n * is greater than the maximum specified.\n */\n error InvalidSignedMaxTokenSupplyForStage(uint256 got, uint256 maximum);\n \n /**\n * @dev Revert with an error if supplied signed feeBps is greater than\n * the maximum specified, or less than the minimum.\n */\n error InvalidSignedFeeBps(uint256 got, uint256 minimumOrMaximum);\n\n /**\n * @dev Revert with an error if signed mint did not specify to restrict\n * fee recipients.\n */\n error SignedMintsMustRestrictFeeRecipients();\n\n /**\n * @dev Revert with an error if a signature for a signed mint has already\n * been used.\n */\n error SignatureAlreadyUsed();\n\n /**\n * @dev An event with details of a SeaDrop mint, for analytical purposes.\n * \n * @param nftContract The nft contract.\n * @param minter The mint recipient.\n * @param feeRecipient The fee recipient.\n * @param payer The address who payed for the tx.\n * @param quantityMinted The number of tokens minted.\n * @param unitMintPrice The amount paid for each token.\n * @param feeBps The fee out of 10_000 basis points collected.\n * @param dropStageIndex The drop stage index. Items minted\n * through mintPublic() have\n * dropStageIndex of 0.\n */\n event SeaDropMint(\n address indexed nftContract,\n address indexed minter,\n address indexed feeRecipient,\n address payer,\n uint256 quantityMinted,\n uint256 unitMintPrice,\n uint256 feeBps,\n uint256 dropStageIndex\n );\n\n /**\n * @dev An event with updated public drop data for an nft contract.\n */\n event PublicDropUpdated(\n address indexed nftContract,\n PublicDrop publicDrop\n );\n\n /**\n * @dev An event with updated token gated drop stage data\n * for an nft contract.\n */\n event TokenGatedDropStageUpdated(\n address indexed nftContract,\n address indexed allowedNftToken,\n TokenGatedDropStage dropStage\n );\n\n /**\n * @dev An event with updated allow list data for an nft contract.\n * \n * @param nftContract The nft contract.\n * @param previousMerkleRoot The previous allow list merkle root.\n * @param newMerkleRoot The new allow list merkle root.\n * @param publicKeyURI If the allow list is encrypted, the public key\n * URIs that can decrypt the list.\n * Empty if unencrypted.\n * @param allowListURI The URI for the allow list.\n */\n event AllowListUpdated(\n address indexed nftContract,\n bytes32 indexed previousMerkleRoot,\n bytes32 indexed newMerkleRoot,\n string[] publicKeyURI,\n string allowListURI\n );\n\n /**\n * @dev An event with updated drop URI for an nft contract.\n */\n event DropURIUpdated(address indexed nftContract, string newDropURI);\n\n /**\n * @dev An event with the updated creator payout address for an nft\n * contract.\n */\n event CreatorPayoutAddressUpdated(\n address indexed nftContract,\n address indexed newPayoutAddress\n );\n\n /**\n * @dev An event with the updated allowed fee recipient for an nft\n * contract.\n */\n event AllowedFeeRecipientUpdated(\n address indexed nftContract,\n address indexed feeRecipient,\n bool indexed allowed\n );\n\n /**\n * @dev An event with the updated validation parameters for server-side\n * signers.\n */\n event SignedMintValidationParamsUpdated(\n address indexed nftContract,\n address indexed signer,\n SignedMintValidationParams signedMintValidationParams\n ); \n\n /**\n * @dev An event with the updated payer for an nft contract.\n */\n event PayerUpdated(\n address indexed nftContract,\n address indexed payer,\n bool indexed allowed\n );\n}\n" }, "lib/ERC721A/contracts/IERC721A.sol": { "content": "// SPDX-License-Identifier: MIT\n// ERC721A Contracts v4.2.2\n// Creator: Chiru Labs\n\npragma solidity ^0.8.4;\n\n/**\n * @dev Interface of ERC721A.\n */\ninterface IERC721A {\n /**\n * The caller must own the token or be an approved operator.\n */\n error ApprovalCallerNotOwnerNorApproved();\n\n /**\n * The token does not exist.\n */\n error ApprovalQueryForNonexistentToken();\n\n /**\n * Cannot query the balance for the zero address.\n */\n error BalanceQueryForZeroAddress();\n\n /**\n * Cannot mint to the zero address.\n */\n error MintToZeroAddress();\n\n /**\n * The quantity of tokens minted must be more than zero.\n */\n error MintZeroQuantity();\n\n /**\n * The token does not exist.\n */\n error OwnerQueryForNonexistentToken();\n\n /**\n * The caller must own the token or be an approved operator.\n */\n error TransferCallerNotOwnerNorApproved();\n\n /**\n * The token must be owned by `from`.\n */\n error TransferFromIncorrectOwner();\n\n /**\n * Cannot safely transfer to a contract that does not implement the\n * ERC721Receiver interface.\n */\n error TransferToNonERC721ReceiverImplementer();\n\n /**\n * Cannot transfer to the zero address.\n */\n error TransferToZeroAddress();\n\n /**\n * The token does not exist.\n */\n error URIQueryForNonexistentToken();\n\n /**\n * The `quantity` minted with ERC2309 exceeds the safety limit.\n */\n error MintERC2309QuantityExceedsLimit();\n\n /**\n * The `extraData` cannot be set on an unintialized ownership slot.\n */\n error OwnershipNotInitializedForExtraData();\n\n // =============================================================\n // STRUCTS\n // =============================================================\n\n struct TokenOwnership {\n // The address of the owner.\n address addr;\n // Stores the start time of ownership with minimal overhead for tokenomics.\n uint64 startTimestamp;\n // Whether the token has been burned.\n bool burned;\n // Arbitrary data similar to `startTimestamp` that can be set via {_extraData}.\n uint24 extraData;\n }\n\n // =============================================================\n // TOKEN COUNTERS\n // =============================================================\n\n /**\n * @dev Returns the total number of tokens in existence.\n * Burned tokens will reduce the count.\n * To get the total number of tokens minted, please see {_totalMinted}.\n */\n function totalSupply() external view returns (uint256);\n\n // =============================================================\n // IERC165\n // =============================================================\n\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n\n // =============================================================\n // IERC721\n // =============================================================\n\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables\n * (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in `owner`'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`,\n * checking first that contract recipients are aware of the ERC721 protocol\n * to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be have been allowed to move\n * this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement\n * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom}\n * whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token\n * by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the\n * zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom}\n * for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n\n // =============================================================\n // IERC721Metadata\n // =============================================================\n\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n\n // =============================================================\n // IERC2309\n // =============================================================\n\n /**\n * @dev Emitted when tokens in `fromTokenId` to `toTokenId`\n * (inclusive) is transferred from `from` to `to`, as defined in the\n * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard.\n *\n * See {_mintERC2309} for more details.\n */\n event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to);\n}\n" }, "lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (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 Internal function that returns the initialized version. Returns `_initialized`\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Internal function that returns the initialized version. Returns `_initializing`\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" }, "lib/utility-contracts/src/ConstructorInitializable.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.4;\n\n/**\n * @author emo.eth\n * @notice Abstract smart contract that provides an onlyUninitialized modifier which only allows calling when\n * from within a constructor of some sort, whether directly instantiating an inherting contract,\n * or when delegatecalling from a proxy\n */\nabstract contract ConstructorInitializable {\n error AlreadyInitialized();\n\n modifier onlyConstructor() {\n if (address(this).code.length != 0) {\n revert AlreadyInitialized();\n }\n _;\n }\n}\n" }, "lib/openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.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://consensys.net/diligence/blog/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" } }, "settings": { "remappings": [ "ERC721A/=lib/ERC721A/contracts/", "ERC721A-Upgradeable/=lib/ERC721A-Upgradeable/contracts/", "ds-test/=lib/ds-test/src/", "forge-std/=lib/forge-std/src/", "murky/=lib/murky/src/", "openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/", "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/", "operator-filter-registry/=lib/operator-filter-registry/src/", "seadrop/=src/", "solmate/=lib/solmate/src/", "utility-contracts/=lib/utility-contracts/src/", "create2-scripts/=lib/create2-helpers/script/", "@openzeppelin/=lib/seaport/lib/openzeppelin-contracts/", "@rari-capital/solmate/=lib/seaport/lib/solmate/", "create2-helpers/=lib/create2-helpers/", "erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/", "seaport-core/=lib/seaport/lib/seaport-core/", "seaport-sol/=lib/seaport/lib/seaport-sol/", "seaport-types/=lib/seaport/lib/seaport-types/", "seaport/=lib/seaport/", "solady/=lib/solady/", "solarray/=lib/seaport/lib/solarray/src/" ], "optimizer": { "enabled": true, "runs": 1000000 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "none" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "viaIR": false, "libraries": {} } }}
1
20,290,538
28159d332aaddeed148487aae1d6c1f01de63280bd74b52ca0184771c7105ba5
3706f5b116b7ab294ea752724a25c6c9201d7cdd264ffa7f3ef462f1785c61e9
16148e9f25a7c2734300076d1c8a4a0d07488476
9035c0ba5a4cd5e306771734c5f431491e090717
04c95f38c22f9d52ede4ac5c7f8197f870d3055b
608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe
1
20,290,540
330bef2c964d93b01bd829f10925cae4d8e457573c666dc239052182b7c4703f
253d84611a03e5ca83c853d78caaeec2a6bcbbbb54e489d10c5626cdf49e2a9f
a7fb5ca286fc3fd67525629048a4de3ba24cba2e
c77ad0a71008d7094a62cfbd250a2eb2afdf2776
0bfe68f2f3dc606cbad20094e50b350e52f03d30
608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe
1
20,290,542
0fb9a9d3925cf557463ff2570bc53c03a209f7c246a2bac2f786a70972c4e910
78786651953883cdcaea57c384997f1ae685b77e729d0199be931e56b72d1921
be49bd130e126a917ddb5fabf7cdeb6dd9887f40
84654be796dad370032391d5479f8f1fd9ddd14e
bb48e9c85a8df45cbd977abd2f6a9e6016b8decb
604080600a3d393df3fe73265c27c849b0e1a62636f6007e8a74dc2a2584aa3d366025573d3d3d3d34865af16031565b363d3d373d3d363d855af45b3d82803e603c573d81fd5b3d81f3
73265c27c849b0e1a62636f6007e8a74dc2a2584aa3d366025573d3d3d3d34865af16031565b363d3d373d3d363d855af45b3d82803e603c573d81fd5b3d81f3
1
20,290,542
0fb9a9d3925cf557463ff2570bc53c03a209f7c246a2bac2f786a70972c4e910
665c7625275639c6253a4caa2b766016b20333b3ff1cbc26371f242c4c6da9b7
5cfcf7a5628aaf4416b6c1fa6b8a85c32e62cf07
5cfcf7a5628aaf4416b6c1fa6b8a85c32e62cf07
d4182d293fad87df5958406f3d172c987c41a442
60806040526040518060400160405280600c81526020017f44696c6c6f6e2050656e697300000000000000000000000000000000000000008152505f90816100479190610387565b506040518060400160405280600581526020017f50454e49530000000000000000000000000000000000000000000000000000008152506001908161008c9190610387565b506b033b2e3c9fd0803cac653600600255601260035f6101000a81548160ff021916908360ff1602179055503480156100c3575f80fd5b503360065f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060025460045f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2081905550610456565b5f81519050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f60028204905060018216806101c857607f821691505b6020821081036101db576101da610184565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f6008830261023d7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82610202565b6102478683610202565b95508019841693508086168417925050509392505050565b5f819050919050565b5f819050919050565b5f61028b6102866102818461025f565b610268565b61025f565b9050919050565b5f819050919050565b6102a483610271565b6102b86102b082610292565b84845461020e565b825550505050565b5f90565b6102cc6102c0565b6102d781848461029b565b505050565b5b818110156102fa576102ef5f826102c4565b6001810190506102dd565b5050565b601f82111561033f57610310816101e1565b610319846101f3565b81016020851015610328578190505b61033c610334856101f3565b8301826102dc565b50505b505050565b5f82821c905092915050565b5f61035f5f1984600802610344565b1980831691505092915050565b5f6103778383610350565b9150826002028217905092915050565b6103908261014d565b67ffffffffffffffff8111156103a9576103a8610157565b5b6103b382546101b1565b6103be8282856102fe565b5f60209050601f8311600181146103ef575f84156103dd578287015190505b6103e7858261036c565b86555061044e565b601f1984166103fd866101e1565b5f5b82811015610424578489015182556001820191506020850194506020810190506103ff565b86831015610441578489015161043d601f891682610350565b8355505b6001600288020188555050505b505050505050565b61135f806104635f395ff3fe608060405234801561000f575f80fd5b50600436106100b2575f3560e01c8063715018a61161006f578063715018a6146101a05780638da5cb5b146101aa57806395d89b41146101c8578063a9059cbb146101e6578063dd62ed3e14610216578063f2fde38b14610246576100b2565b806306fdde03146100b6578063095ea7b3146100d457806318160ddd1461010457806323b872dd14610122578063313ce5671461015257806370a0823114610170575b5f80fd5b6100be610262565b6040516100cb9190610d6a565b60405180910390f35b6100ee60048036038101906100e99190610e1b565b6102ed565b6040516100fb9190610e73565b60405180910390f35b61010c6103da565b6040516101199190610e9b565b60405180910390f35b61013c60048036038101906101379190610eb4565b6103e0565b6040516101499190610e73565b60405180910390f35b61015a6106f7565b6040516101679190610f1f565b60405180910390f35b61018a60048036038101906101859190610f38565b610709565b6040516101979190610e9b565b60405180910390f35b6101a861071e565b005b6101b261086a565b6040516101bf9190610f72565b60405180910390f35b6101d061088f565b6040516101dd9190610d6a565b60405180910390f35b61020060048036038101906101fb9190610e1b565b61091b565b60405161020d9190610e73565b60405180910390f35b610230600480360381019061022b9190610f8b565b610b1f565b60405161023d9190610e9b565b60405180910390f35b610260600480360381019061025b9190610f38565b610b3f565b005b5f805461026e90610ff6565b80601f016020809104026020016040519081016040528092919081815260200182805461029a90610ff6565b80156102e55780601f106102bc576101008083540402835291602001916102e5565b820191905f5260205f20905b8154815290600101906020018083116102c857829003601f168201915b505050505081565b5f8160055f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516103c89190610e9b565b60405180910390a36001905092915050565b60025481565b5f8160045f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20541015610461576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161045890611070565b60405180910390fd5b8160055f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054101561051c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610513906110d8565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610553575f80fd5b8160045f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825461059f9190611123565b925050819055508160045f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8282546105f29190611156565b925050819055508160055f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8282546106809190611123565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516106e49190610e9b565b60405180910390a3600190509392505050565b60035f9054906101000a900460ff1681565b6004602052805f5260405f205f915090505481565b60065f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146107ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107a4906111d3565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff1660065f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35f60065f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60065f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6001805461089c90610ff6565b80601f01602080910402602001604051908101604052809291908181526020018280546108c890610ff6565b80156109135780601f106108ea57610100808354040283529160200191610913565b820191905f5260205f20905b8154815290600101906020018083116108f657829003601f168201915b505050505081565b5f8160045f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054101561099c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109939061123b565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610a0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a01906112a3565b60405180910390fd5b8160045f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f828254610a569190611123565b925050819055508160045f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f828254610aa99190611156565b925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610b0d9190610e9b565b60405180910390a36001905092915050565b6005602052815f5260405f20602052805f5260405f205f91509150505481565b60065f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610bce576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bc5906111d3565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610c3c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c339061130b565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660065f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a38060065f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f610d3c82610cfa565b610d468185610d04565b9350610d56818560208601610d14565b610d5f81610d22565b840191505092915050565b5f6020820190508181035f830152610d828184610d32565b905092915050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610db782610d8e565b9050919050565b610dc781610dad565b8114610dd1575f80fd5b50565b5f81359050610de281610dbe565b92915050565b5f819050919050565b610dfa81610de8565b8114610e04575f80fd5b50565b5f81359050610e1581610df1565b92915050565b5f8060408385031215610e3157610e30610d8a565b5b5f610e3e85828601610dd4565b9250506020610e4f85828601610e07565b9150509250929050565b5f8115159050919050565b610e6d81610e59565b82525050565b5f602082019050610e865f830184610e64565b92915050565b610e9581610de8565b82525050565b5f602082019050610eae5f830184610e8c565b92915050565b5f805f60608486031215610ecb57610eca610d8a565b5b5f610ed886828701610dd4565b9350506020610ee986828701610dd4565b9250506040610efa86828701610e07565b9150509250925092565b5f60ff82169050919050565b610f1981610f04565b82525050565b5f602082019050610f325f830184610f10565b92915050565b5f60208284031215610f4d57610f4c610d8a565b5b5f610f5a84828501610dd4565b91505092915050565b610f6c81610dad565b82525050565b5f602082019050610f855f830184610f63565b92915050565b5f8060408385031215610fa157610fa0610d8a565b5b5f610fae85828601610dd4565b9250506020610fbf85828601610dd4565b9150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f600282049050600182168061100d57607f821691505b6020821081036110205761101f610fc9565b5b50919050565b7f3350454e495300000000000000000000000000000000000000000000000000005f82015250565b5f61105a600683610d04565b915061106582611026565b602082019050919050565b5f6020820190508181035f8301526110878161104e565b9050919050565b7f3450454e495300000000000000000000000000000000000000000000000000005f82015250565b5f6110c2600683610d04565b91506110cd8261108e565b602082019050919050565b5f6020820190508181035f8301526110ef816110b6565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f61112d82610de8565b915061113883610de8565b92508282039050818111156111505761114f6110f6565b5b92915050565b5f61116082610de8565b915061116b83610de8565b9250828201905080821115611183576111826110f6565b5b92915050565b7f3650454e495300000000000000000000000000000000000000000000000000005f82015250565b5f6111bd600683610d04565b91506111c882611189565b602082019050919050565b5f6020820190508181035f8301526111ea816111b1565b9050919050565b7f3150454e495300000000000000000000000000000000000000000000000000005f82015250565b5f611225600683610d04565b9150611230826111f1565b602082019050919050565b5f6020820190508181035f83015261125281611219565b9050919050565b7f3250454e495300000000000000000000000000000000000000000000000000005f82015250565b5f61128d600683610d04565b915061129882611259565b602082019050919050565b5f6020820190508181035f8301526112ba81611281565b9050919050565b7f3550454e495300000000000000000000000000000000000000000000000000005f82015250565b5f6112f5600683610d04565b9150611300826112c1565b602082019050919050565b5f6020820190508181035f830152611322816112e9565b905091905056fea2646970667358221220730e772f3fff78619fe12ae89e83d8b82ad5832b1d45e320c1848f01ac02060964736f6c634300081a0033
608060405234801561000f575f80fd5b50600436106100b2575f3560e01c8063715018a61161006f578063715018a6146101a05780638da5cb5b146101aa57806395d89b41146101c8578063a9059cbb146101e6578063dd62ed3e14610216578063f2fde38b14610246576100b2565b806306fdde03146100b6578063095ea7b3146100d457806318160ddd1461010457806323b872dd14610122578063313ce5671461015257806370a0823114610170575b5f80fd5b6100be610262565b6040516100cb9190610d6a565b60405180910390f35b6100ee60048036038101906100e99190610e1b565b6102ed565b6040516100fb9190610e73565b60405180910390f35b61010c6103da565b6040516101199190610e9b565b60405180910390f35b61013c60048036038101906101379190610eb4565b6103e0565b6040516101499190610e73565b60405180910390f35b61015a6106f7565b6040516101679190610f1f565b60405180910390f35b61018a60048036038101906101859190610f38565b610709565b6040516101979190610e9b565b60405180910390f35b6101a861071e565b005b6101b261086a565b6040516101bf9190610f72565b60405180910390f35b6101d061088f565b6040516101dd9190610d6a565b60405180910390f35b61020060048036038101906101fb9190610e1b565b61091b565b60405161020d9190610e73565b60405180910390f35b610230600480360381019061022b9190610f8b565b610b1f565b60405161023d9190610e9b565b60405180910390f35b610260600480360381019061025b9190610f38565b610b3f565b005b5f805461026e90610ff6565b80601f016020809104026020016040519081016040528092919081815260200182805461029a90610ff6565b80156102e55780601f106102bc576101008083540402835291602001916102e5565b820191905f5260205f20905b8154815290600101906020018083116102c857829003601f168201915b505050505081565b5f8160055f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516103c89190610e9b565b60405180910390a36001905092915050565b60025481565b5f8160045f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20541015610461576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161045890611070565b60405180910390fd5b8160055f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054101561051c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610513906110d8565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610553575f80fd5b8160045f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825461059f9190611123565b925050819055508160045f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8282546105f29190611156565b925050819055508160055f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8282546106809190611123565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516106e49190610e9b565b60405180910390a3600190509392505050565b60035f9054906101000a900460ff1681565b6004602052805f5260405f205f915090505481565b60065f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146107ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107a4906111d3565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff1660065f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35f60065f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60065f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6001805461089c90610ff6565b80601f01602080910402602001604051908101604052809291908181526020018280546108c890610ff6565b80156109135780601f106108ea57610100808354040283529160200191610913565b820191905f5260205f20905b8154815290600101906020018083116108f657829003601f168201915b505050505081565b5f8160045f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054101561099c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109939061123b565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610a0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a01906112a3565b60405180910390fd5b8160045f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f828254610a569190611123565b925050819055508160045f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f828254610aa99190611156565b925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610b0d9190610e9b565b60405180910390a36001905092915050565b6005602052815f5260405f20602052805f5260405f205f91509150505481565b60065f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610bce576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bc5906111d3565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610c3c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c339061130b565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660065f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a38060065f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f610d3c82610cfa565b610d468185610d04565b9350610d56818560208601610d14565b610d5f81610d22565b840191505092915050565b5f6020820190508181035f830152610d828184610d32565b905092915050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610db782610d8e565b9050919050565b610dc781610dad565b8114610dd1575f80fd5b50565b5f81359050610de281610dbe565b92915050565b5f819050919050565b610dfa81610de8565b8114610e04575f80fd5b50565b5f81359050610e1581610df1565b92915050565b5f8060408385031215610e3157610e30610d8a565b5b5f610e3e85828601610dd4565b9250506020610e4f85828601610e07565b9150509250929050565b5f8115159050919050565b610e6d81610e59565b82525050565b5f602082019050610e865f830184610e64565b92915050565b610e9581610de8565b82525050565b5f602082019050610eae5f830184610e8c565b92915050565b5f805f60608486031215610ecb57610eca610d8a565b5b5f610ed886828701610dd4565b9350506020610ee986828701610dd4565b9250506040610efa86828701610e07565b9150509250925092565b5f60ff82169050919050565b610f1981610f04565b82525050565b5f602082019050610f325f830184610f10565b92915050565b5f60208284031215610f4d57610f4c610d8a565b5b5f610f5a84828501610dd4565b91505092915050565b610f6c81610dad565b82525050565b5f602082019050610f855f830184610f63565b92915050565b5f8060408385031215610fa157610fa0610d8a565b5b5f610fae85828601610dd4565b9250506020610fbf85828601610dd4565b9150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f600282049050600182168061100d57607f821691505b6020821081036110205761101f610fc9565b5b50919050565b7f3350454e495300000000000000000000000000000000000000000000000000005f82015250565b5f61105a600683610d04565b915061106582611026565b602082019050919050565b5f6020820190508181035f8301526110878161104e565b9050919050565b7f3450454e495300000000000000000000000000000000000000000000000000005f82015250565b5f6110c2600683610d04565b91506110cd8261108e565b602082019050919050565b5f6020820190508181035f8301526110ef816110b6565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f61112d82610de8565b915061113883610de8565b92508282039050818111156111505761114f6110f6565b5b92915050565b5f61116082610de8565b915061116b83610de8565b9250828201905080821115611183576111826110f6565b5b92915050565b7f3650454e495300000000000000000000000000000000000000000000000000005f82015250565b5f6111bd600683610d04565b91506111c882611189565b602082019050919050565b5f6020820190508181035f8301526111ea816111b1565b9050919050565b7f3150454e495300000000000000000000000000000000000000000000000000005f82015250565b5f611225600683610d04565b9150611230826111f1565b602082019050919050565b5f6020820190508181035f83015261125281611219565b9050919050565b7f3250454e495300000000000000000000000000000000000000000000000000005f82015250565b5f61128d600683610d04565b915061129882611259565b602082019050919050565b5f6020820190508181035f8301526112ba81611281565b9050919050565b7f3550454e495300000000000000000000000000000000000000000000000000005f82015250565b5f6112f5600683610d04565b9150611300826112c1565b602082019050919050565b5f6020820190508181035f830152611322816112e9565b905091905056fea2646970667358221220730e772f3fff78619fe12ae89e83d8b82ad5832b1d45e320c1848f01ac02060964736f6c634300081a0033
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** Website : https://www.dillonpenis.com/ Twitter : https://x.com/DillonPenis Telegram : https://t.me/DillonPenis */ contract PENIS { string public name = "Dillon Penis"; string public symbol = "PENIS"; uint256 public totalSupply = 999999999999999999000000000; uint8 public decimals = 18; mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; address public owner; event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor() { owner = msg.sender; balanceOf[msg.sender] = totalSupply; } function transfer(address _to, uint256 _value) public returns (bool success) { require(balanceOf[msg.sender] >= _value, "1PENIS"); require(_to != address(0), "2PENIS"); balanceOf[msg.sender] -= _value; balanceOf[_to] += _value; emit Transfer(msg.sender, _to, _value); return true; } function approve(address _spender, uint256 _value) public returns (bool success) { allowance[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value, "3PENIS"); require(allowance[_from][msg.sender] >= _value, "4PENIS"); require(_to != address(0)); balanceOf[_from] -= _value; balanceOf[_to] += _value; allowance[_from][msg.sender] -= _value; emit Transfer(_from, _to, _value); return true; } function transferOwnership(address newOwner) public onlyOwner { require(newOwner != address(0), "5PENIS"); emit OwnershipTransferred(owner, newOwner); owner = newOwner; } function renounceOwnership() public onlyOwner { emit OwnershipTransferred(owner, address(0)); owner = address(0); } modifier onlyOwner() { require(msg.sender == owner, "6PENIS"); _; } }
1
20,290,542
0fb9a9d3925cf557463ff2570bc53c03a209f7c246a2bac2f786a70972c4e910
a73f32cf1d59925d5d5caa136925e43234ced651e2f615aad29b85b4597f1599
7bacc7c3d8ee993dc578311b3c59a9f1f2c52a68
7bacc7c3d8ee993dc578311b3c59a9f1f2c52a68
c05dcd6290abf130ee97cacfdf46abc2f3af4d1f
608060405234801561000f575f80fd5b50335f818152602081905260409020805460ff1916600190811790915580546001600160a01b03191690911790556106828061004a5f395ff3fe608060405234801561000f575f80fd5b5060043610610090575f3560e01c806386d516e81161006357806386d516e8146100ed578063a8b0574e146100f3578063cb8523c614610101578063d63a8e1114610116578063ee82ac5e14610148575f80fd5b80630f28c97d14610094578063252dba42146100a957806327e86d6e146100ca5780634d2301cc146100d2575b5f80fd5b425b6040519081526020015b60405180910390f35b6100bc6100b73660046103d1565b61015a565b6040516100a0929190610541565b6100966102fd565b6100966100e03660046105c1565b6001600160a01b03163190565b45610096565b6040514181526020016100a0565b61011461010f3660046105c1565b61030f565b005b6101386101243660046105c1565b5f6020819052908152604090205460ff1681565b60405190151581526020016100a0565b6100966101563660046105e1565b4090565b335f9081526020819052604081205460609060ff1615156001146101d25760405162461bcd60e51b815260206004820152602560248201527f75736572206e6f7420616c6c6f77656420746f2065786563757465206d756c746044820152641a58d85b1b60da1b606482015260840160405180910390fd5b439150825167ffffffffffffffff8111156101ef576101ef610348565b60405190808252806020026020018201604052801561022257816020015b606081526020019060019003908161020d5790505b5090505f5b83518110156102f7575f80858381518110610244576102446105f8565b60200260200101515f01516001600160a01b031686848151811061026a5761026a6105f8565b602002602001015160200151604051610283919061060c565b5f604051808303815f865af19150503d805f81146102bc576040519150601f19603f3d011682016040523d82523d5f602084013e6102c1565b606091505b5091509150816102cf575f80fd5b808484815181106102e2576102e26105f8565b60209081029190910101525050600101610227565b50915091565b5f610309600143610627565b40905090565b6001546001600160a01b03163314610325575f80fd5b6001600160a01b03165f908152602081905260409020805460ff19166001179055565b634e487b7160e01b5f52604160045260245ffd5b6040805190810167ffffffffffffffff8111828210171561037f5761037f610348565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156103ae576103ae610348565b604052919050565b80356001600160a01b03811681146103cc575f80fd5b919050565b5f60208083850312156103e2575f80fd5b823567ffffffffffffffff808211156103f9575f80fd5b818501915085601f83011261040c575f80fd5b81358181111561041e5761041e610348565b8060051b61042d858201610385565b9182528381018501918581019089841115610446575f80fd5b86860192505b8383101561051257823585811115610462575f80fd5b86016040601f19828d038101821315610479575f80fd5b61048161035c565b61048c8b85016103b6565b8152828401358981111561049e575f80fd5b8085019450508d603f8501126104b2575f80fd5b8a840135898111156104c6576104c6610348565b6104d68c84601f84011601610385565b92508083528e848287010111156104eb575f80fd5b808486018d8501375f9083018c0152808b019190915284525050918601919086019061044c565b9998505050505050505050565b5f5b83811015610539578181015183820152602001610521565b50505f910152565b5f60408201848352602060408185015281855180845260608601915060608160051b87010193508287015f5b828110156105b357878603605f190184528151805180885261059481888a0189850161051f565b601f01601f19169690960185019550928401929084019060010161056d565b509398975050505050505050565b5f602082840312156105d1575f80fd5b6105da826103b6565b9392505050565b5f602082840312156105f1575f80fd5b5035919050565b634e487b7160e01b5f52603260045260245ffd5b5f825161061d81846020870161051f565b9190910192915050565b8181038181111561064657634e487b7160e01b5f52601160045260245ffd5b9291505056fea2646970667358221220deb7cc9365717acd3f58212ea5841547615d761815dbc8eec88c4351dd8eddf864736f6c63430008170033
608060405234801561000f575f80fd5b5060043610610090575f3560e01c806386d516e81161006357806386d516e8146100ed578063a8b0574e146100f3578063cb8523c614610101578063d63a8e1114610116578063ee82ac5e14610148575f80fd5b80630f28c97d14610094578063252dba42146100a957806327e86d6e146100ca5780634d2301cc146100d2575b5f80fd5b425b6040519081526020015b60405180910390f35b6100bc6100b73660046103d1565b61015a565b6040516100a0929190610541565b6100966102fd565b6100966100e03660046105c1565b6001600160a01b03163190565b45610096565b6040514181526020016100a0565b61011461010f3660046105c1565b61030f565b005b6101386101243660046105c1565b5f6020819052908152604090205460ff1681565b60405190151581526020016100a0565b6100966101563660046105e1565b4090565b335f9081526020819052604081205460609060ff1615156001146101d25760405162461bcd60e51b815260206004820152602560248201527f75736572206e6f7420616c6c6f77656420746f2065786563757465206d756c746044820152641a58d85b1b60da1b606482015260840160405180910390fd5b439150825167ffffffffffffffff8111156101ef576101ef610348565b60405190808252806020026020018201604052801561022257816020015b606081526020019060019003908161020d5790505b5090505f5b83518110156102f7575f80858381518110610244576102446105f8565b60200260200101515f01516001600160a01b031686848151811061026a5761026a6105f8565b602002602001015160200151604051610283919061060c565b5f604051808303815f865af19150503d805f81146102bc576040519150601f19603f3d011682016040523d82523d5f602084013e6102c1565b606091505b5091509150816102cf575f80fd5b808484815181106102e2576102e26105f8565b60209081029190910101525050600101610227565b50915091565b5f610309600143610627565b40905090565b6001546001600160a01b03163314610325575f80fd5b6001600160a01b03165f908152602081905260409020805460ff19166001179055565b634e487b7160e01b5f52604160045260245ffd5b6040805190810167ffffffffffffffff8111828210171561037f5761037f610348565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156103ae576103ae610348565b604052919050565b80356001600160a01b03811681146103cc575f80fd5b919050565b5f60208083850312156103e2575f80fd5b823567ffffffffffffffff808211156103f9575f80fd5b818501915085601f83011261040c575f80fd5b81358181111561041e5761041e610348565b8060051b61042d858201610385565b9182528381018501918581019089841115610446575f80fd5b86860192505b8383101561051257823585811115610462575f80fd5b86016040601f19828d038101821315610479575f80fd5b61048161035c565b61048c8b85016103b6565b8152828401358981111561049e575f80fd5b8085019450508d603f8501126104b2575f80fd5b8a840135898111156104c6576104c6610348565b6104d68c84601f84011601610385565b92508083528e848287010111156104eb575f80fd5b808486018d8501375f9083018c0152808b019190915284525050918601919086019061044c565b9998505050505050505050565b5f5b83811015610539578181015183820152602001610521565b50505f910152565b5f60408201848352602060408185015281855180845260608601915060608160051b87010193508287015f5b828110156105b357878603605f190184528151805180885261059481888a0189850161051f565b601f01601f19169690960185019550928401929084019060010161056d565b509398975050505050505050565b5f602082840312156105d1575f80fd5b6105da826103b6565b9392505050565b5f602082840312156105f1575f80fd5b5035919050565b634e487b7160e01b5f52603260045260245ffd5b5f825161061d81846020870161051f565b9190910192915050565b8181038181111561064657634e487b7160e01b5f52601160045260245ffd5b9291505056fea2646970667358221220deb7cc9365717acd3f58212ea5841547615d761815dbc8eec88c4351dd8eddf864736f6c63430008170033
1
20,290,542
0fb9a9d3925cf557463ff2570bc53c03a209f7c246a2bac2f786a70972c4e910
63039a990fbeeea706a20cc14096b06b744ce8df7b2492b832116a6b849c2454
4a20805f146ea250cdbd51d60bcac147031d0b6c
4a20805f146ea250cdbd51d60bcac147031d0b6c
c24e2c15bec615ab0199dc1ee3694b04fade1987
60a060405260016006819055600980546001600160501b03191666010003002625a01790556012805462ffffff191690911790553480156200004057600080fd5b506040516200379c3803806200379c8339810160408190526200006391620005fe565b604080518082018252600d81526c46617274696e6720536869626160981b6020808301918252835180850190945260048452631190549560e21b90840152815173271682deb8c4e0901d1a1550ad2e64d568e699099391620000c9916003919062000558565b508051620000df90600490602084019062000558565b5050506000620000f46200034a60201b60201c565b600580546001600160a01b0319166001600160a01b038316908117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3506001600160a01b0316608052600780546001600160401b038316600160a01b026001600160e01b03199091161773271682deb8c4e0901d1a1550ad2e64d568e699091790557f8af398995b04c28e9951adb9721ef74c74f93e6a478f39e7e0777be13527e7ef600855737a250d5630b4cf539739df2c5dacb4c659f2488d620001cd8160016200034e565b600d80546001600160a01b0319166001600160a01b038316179055600060036004816603e871b540c00069d3c21bcecceda100000060646200021182600562000646565b6200021d919062000668565b600f5560646200022f82600562000646565b6200023b919062000668565b6011556127106200024e82600562000646565b6200025a919062000668565b601055601486905560158590556200027385876200068b565b601355601784905560188390556200028c83856200068b565b6016556019829055600e80546001600160a01b031916734a20805f146ea250cdbd51d60bcac147031d0b6c179055620002d9620002d16005546001600160a01b031690565b6001620003c8565b620002e6306001620003c8565b620002f561dead6001620003c8565b620003146200030c6005546001600160a01b031690565b60016200034e565b620003213060016200034e565b6200033061dead60016200034e565b6200033c338262000472565b5050505050505050620006e3565b3390565b6005546001600160a01b031633146200039d5760405162461bcd60e51b815260206004820181905260248201526000805160206200377c83398151915260448201526064015b60405180910390fd5b6001600160a01b03919091166000908152601d60205260409020805460ff1916911515919091179055565b6005546001600160a01b03163314620004135760405162461bcd60e51b815260206004820181905260248201526000805160206200377c833981519152604482015260640162000394565b6001600160a01b0382166000818152601c6020908152604091829020805460ff191685151590811790915591519182527f9d8f7706ea1113d1a167b526eca956215946dd36cc7df39eb16180222d8b5df7910160405180910390a25050565b6001600160a01b038216620004ca5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640162000394565b80600254620004da91906200068b565b6002556001600160a01b038216600090815260208190526040902054620005039082906200068b565b6001600160a01b038316600081815260208181526040808320949094559251848152919290917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b8280546200056690620006a6565b90600052602060002090601f0160209004810192826200058a5760008555620005d5565b82601f10620005a557805160ff1916838001178555620005d5565b82800160010185558215620005d5579182015b82811115620005d5578251825591602001919060010190620005b8565b50620005e3929150620005e7565b5090565b5b80821115620005e35760008155600101620005e8565b6000602082840312156200061157600080fd5b81516001600160401b03811681146200062957600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161562000663576200066362000630565b500290565b6000826200068657634e487b7160e01b600052601260045260246000fd5b500490565b60008219821115620006a157620006a162000630565b500190565b600181811c90821680620006bb57607f821691505b60208210811415620006dd57634e487b7160e01b600052602260045260246000fd5b50919050565b6080516130766200070660003960008181610c490152610c8b01526130766000f3fe60806040526004361061036f5760003560e01c80638ea5220f116101c6578063c0d78655116100f7578063e2ee328311610095578063f16816471161006f578063f1681647146109f4578063f2fde38b14610a23578063f637434214610a43578063f8b45b0514610a5957600080fd5b8063e2ee3283146109b5578063e2f45605146109c8578063f11a24d3146109de57600080fd5b8063ca628c78116100d1578063ca628c7814610924578063d257b34f14610939578063d85ba06314610959578063dd62ed3e1461096f57600080fd5b8063c0d78655146108ce578063c18bc195146108ee578063c8c8ebe41461090e57600080fd5b8063a0d82dc511610164578063a9059cbb1161013e578063a9059cbb1461083f578063b62496f51461085f578063bbc0c7421461088f578063c0246668146108ae57600080fd5b8063a0d82dc5146107dc578063a340f3bc146107f2578063a457c2d71461081f57600080fd5b806395d89b41116101a057806395d89b411461077b5780639a7a23d6146107905780639c3b4fdc146107b05780639fccce32146107c657600080fd5b80638ea5220f14610725578063924de9b714610745578063935cbe151461076557600080fd5b80633546211e116102a05780636ddd17131161023e578063751039fc11610218578063751039fc146106bd5780637571336a146106d25780638a8c523c146106f25780638da5cb5b1461070757600080fd5b80636ddd17131461065257806370a0823114610672578063715018a6146106a857600080fd5b80634fbee1931161027a5780634fbee193146105ce57806363bd1d4a1461060757806366ca9b831461061c5780636a486a8e1461063c57600080fd5b80633546211e1461056757806339509351146105945780634a62bb65146105b457600080fd5b80631a8145bb1161030d57806323b872dd116102e757806323b872dd146104f557806327c8f835146105155780632aec3ab91461052b578063313ce5671461054b57600080fd5b80631a8145bb1461049f5780631fe543e3146104b5578063203e727e146104d557600080fd5b806310d5de531161034957806310d5de53146103f85780631694505e1461042857806318160ddd146104605780631816467f1461047f57600080fd5b806302dbd8f81461037b57806306fdde031461039d578063095ea7b3146103c857600080fd5b3661037657005b600080fd5b34801561038757600080fd5b5061039b610396366004612af6565b610a6f565b005b3480156103a957600080fd5b506103b2610b0f565b6040516103bf9190612b18565b60405180910390f35b3480156103d457600080fd5b506103e86103e3366004612b82565b610ba1565b60405190151581526020016103bf565b34801561040457600080fd5b506103e8610413366004612bae565b601d6020526000908152604090205460ff1681565b34801561043457600080fd5b50600d54610448906001600160a01b031681565b6040516001600160a01b0390911681526020016103bf565b34801561046c57600080fd5b506002545b6040519081526020016103bf565b34801561048b57600080fd5b5061039b61049a366004612bae565b610bb7565b3480156104ab57600080fd5b50610471601a5481565b3480156104c157600080fd5b5061039b6104d0366004612be8565b610c3e565b3480156104e157600080fd5b5061039b6104f0366004612cb2565b610cc2565b34801561050157600080fd5b506103e8610510366004612ccb565b610d9f565b34801561052157600080fd5b5061044861dead81565b34801561053757600080fd5b5061039b610546366004612cb2565b610df1565b34801561055757600080fd5b50604051601281526020016103bf565b34801561057357600080fd5b50610471610582366004612bae565b600b6020526000908152604090205481565b3480156105a057600080fd5b506103e86105af366004612b82565b610e78565b3480156105c057600080fd5b506012546103e89060ff1681565b3480156105da57600080fd5b506103e86105e9366004612bae565b6001600160a01b03166000908152601c602052604090205460ff1690565b34801561061357600080fd5b5061039b610eaf565b34801561062857600080fd5b5061039b610637366004612af6565b610f08565b34801561064857600080fd5b5061047160165481565b34801561065e57600080fd5b506012546103e89062010000900460ff1681565b34801561067e57600080fd5b5061047161068d366004612bae565b6001600160a01b031660009081526020819052604090205490565b3480156106b457600080fd5b5061039b610f9b565b3480156106c957600080fd5b506103e861100f565b3480156106de57600080fd5b5061039b6106ed366004612d1a565b61104c565b3480156106fe57600080fd5b5061039b6110a1565b34801561071357600080fd5b506005546001600160a01b0316610448565b34801561073157600080fd5b50600e54610448906001600160a01b031681565b34801561075157600080fd5b5061039b610760366004612d53565b6110de565b34801561077157600080fd5b5061047160195481565b34801561078757600080fd5b506103b2611124565b34801561079c57600080fd5b5061039b6107ab366004612d1a565b611133565b3480156107bc57600080fd5b5061047160155481565b3480156107d257600080fd5b50610471601b5481565b3480156107e857600080fd5b5061047160185481565b3480156107fe57600080fd5b5061047161080d366004612bae565b600c6020526000908152604090205481565b34801561082b57600080fd5b506103e861083a366004612b82565b611167565b34801561084b57600080fd5b506103e861085a366004612b82565b61119e565b34801561086b57600080fd5b506103e861087a366004612bae565b601e6020526000908152604090205460ff1681565b34801561089b57600080fd5b506012546103e890610100900460ff1681565b3480156108ba57600080fd5b5061039b6108c9366004612d1a565b6111ab565b3480156108da57600080fd5b5061039b6108e9366004612bae565b611234565b3480156108fa57600080fd5b5061039b610909366004612cb2565b61128d565b34801561091a57600080fd5b50610471600f5481565b34801561093057600080fd5b5061039b61135e565b34801561094557600080fd5b506103e8610954366004612cb2565b6114a9565b34801561096557600080fd5b5061047160135481565b34801561097b57600080fd5b5061047161098a366004612d70565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b61039b6109c3366004612cb2565b6115f8565b3480156109d457600080fd5b5061047160105481565b3480156109ea57600080fd5b5061047160145481565b348015610a0057600080fd5b5061039b336000908152600c60209081526040808320839055600b909152812055565b348015610a2f57600080fd5b5061039b610a3e366004612bae565b61193d565b348015610a4f57600080fd5b5061047160175481565b348015610a6557600080fd5b5061047160115481565b6005546001600160a01b03163314610aa25760405162461bcd60e51b8152600401610a9990612d9e565b60405180910390fd5b60178290556018819055610ab68183612de9565b601681905560191015610b0b5760405162461bcd60e51b815260206004820152601d60248201527f4d757374206b656570206665657320617420323525206f72206c6573730000006044820152606401610a99565b5050565b606060038054610b1e90612e01565b80601f0160208091040260200160405190810160405280929190818152602001828054610b4a90612e01565b8015610b975780601f10610b6c57610100808354040283529160200191610b97565b820191906000526020600020905b815481529060010190602001808311610b7a57829003601f168201915b5050505050905090565b6000610bae338484611a28565b50600192915050565b6005546001600160a01b03163314610be15760405162461bcd60e51b8152600401610a9990612d9e565b600e546040516001600160a01b03918216918316907f90b8024c4923d3873ff5b9fcb43d0360d4b9217fa41225d07ba379993552e74390600090a3600e80546001600160a01b0319166001600160a01b0392909216919091179055565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610cb85760405163073e64fd60e21b81523360048201526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166024820152604401610a99565b610b0b8282611b4d565b6005546001600160a01b03163314610cec5760405162461bcd60e51b8152600401610a9990612d9e565b670de0b6b3a76400006103e8610d0160025490565b610d0c906001612e3c565b610d169190612e71565b610d209190612e71565b811015610d875760405162461bcd60e51b815260206004820152602f60248201527f43616e6e6f7420736574206d61785472616e73616374696f6e416d6f756e742060448201526e6c6f776572207468616e20302e312560881b6064820152608401610a99565b610d9981670de0b6b3a7640000612e3c565b600f5550565b6000610dac848484611d30565b6001600160a01b038416600090815260016020908152604080832033808552925290912054610de7918691610de2908690612e85565b611a28565b5060019392505050565b6005546001600160a01b03163314610e1b5760405162461bcd60e51b8152600401610a9990612d9e565b67016345785d8a0000811115610e735760405162461bcd60e51b815260206004820152601c60248201527f4d757374206b6565702056524620666565203c3d20302e3120455448000000006044820152606401610a99565b601955565b3360008181526001602090815260408083206001600160a01b03871684529091528120549091610bae918590610de2908690612de9565b6005546001600160a01b03163314610ed95760405162461bcd60e51b8152600401610a9990612d9e565b60405133904780156108fc02916000818181858888f19350505050158015610f05573d6000803e3d6000fd5b50565b6005546001600160a01b03163314610f325760405162461bcd60e51b8152600401610a9990612d9e565b60148290556015819055610f468183612de9565b601381905560141015610b0b5760405162461bcd60e51b815260206004820152601d60248201527f4d757374206b656570206665657320617420323025206f72206c6573730000006044820152606401610a99565b6005546001600160a01b03163314610fc55760405162461bcd60e51b8152600401610a9990612d9e565b6005546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600580546001600160a01b0319169055565b6005546000906001600160a01b0316331461103c5760405162461bcd60e51b8152600401610a9990612d9e565b506012805460ff19169055600190565b6005546001600160a01b031633146110765760405162461bcd60e51b8152600401610a9990612d9e565b6001600160a01b03919091166000908152601d60205260409020805460ff1916911515919091179055565b6005546001600160a01b031633146110cb5760405162461bcd60e51b8152600401610a9990612d9e565b6012805462ffff00191662010100179055565b6005546001600160a01b031633146111085760405162461bcd60e51b8152600401610a9990612d9e565b60128054911515620100000262ff000019909216919091179055565b606060048054610b1e90612e01565b6005546001600160a01b0316331461115d5760405162461bcd60e51b8152600401610a9990612d9e565b610b0b82826123d7565b3360008181526001602090815260408083206001600160a01b03871684529091528120549091610bae918590610de2908690612e85565b6000610bae338484611d30565b6005546001600160a01b031633146111d55760405162461bcd60e51b8152600401610a9990612d9e565b6001600160a01b0382166000818152601c6020908152604091829020805460ff191685151590811790915591519182527f9d8f7706ea1113d1a167b526eca956215946dd36cc7df39eb16180222d8b5df7910160405180910390a25050565b6005546001600160a01b0316331461125e5760405162461bcd60e51b8152600401610a9990612d9e565b8061126a81600161104c565b600d80546001600160a01b0319166001600160a01b039290921691909117905550565b6005546001600160a01b031633146112b75760405162461bcd60e51b8152600401610a9990612d9e565b670de0b6b3a76400006103e86112cc60025490565b6112d7906005612e3c565b6112e19190612e71565b6112eb9190612e71565b8110156113465760405162461bcd60e51b8152602060048201526024808201527f43616e6e6f7420736574206d617857616c6c6574206c6f776572207468616e20604482015263302e352560e01b6064820152608401610a99565b61135881670de0b6b3a7640000612e3c565b60115550565b6005546001600160a01b031633146113885760405162461bcd60e51b8152600401610a9990612d9e565b3063095ea7b38161139860025490565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af11580156113e3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114079190612e9c565b50306323b872dd816114216005546001600160a01b031690565b306000908152602081905260409020546040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015260448201526064016020604051808303816000875af1158015611485573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f059190612e9c565b6005546000906001600160a01b031633146114d65760405162461bcd60e51b8152600401610a9990612d9e565b620186a06114e360025490565b6114ee906001612e3c565b6114f89190612e71565b8210156115655760405162461bcd60e51b815260206004820152603560248201527f5377617020616d6f756e742063616e6e6f74206265206c6f776572207468616e60448201527410181718181892903a37ba30b61039bab838363c9760591b6064820152608401610a99565b606461157060025490565b61157b906001612e3c565b6115859190612e71565b8211156115ef5760405162461bcd60e51b815260206004820152603260248201527f5377617020616d6f756e742063616e6e6f74206265206869676865722074686160448201527137101892903a37ba30b61039bab838363c9760711b6064820152608401610a99565b50601055600190565b60065460011461161b5760405163558a1e0360e11b815260040160405180910390fd5b6002600655606461162b60025490565b6116359190612e71565b81111561169e5760405162461bcd60e51b815260206004820152603160248201527f43616e206e6f742066617274206d6f7265207468616e203125206f662074686560448201527020737570706c7920617420612074696d6560781b6064820152608401610a99565b336000908152600b6020526040902054156116f15760405162461bcd60e51b81526020600482015260136024820152724f6e65206661727420617420612074696d652160681b6044820152606401610a99565b6019543410156117395760405162461bcd60e51b8152602060048201526013602482015272496e73756666696369656e742056524646656560681b6044820152606401610a99565b600e546019546040516000926001600160a01b031691908381818185875af1925050503d8060008114611788576040519150601f19603f3d011682016040523d82523d6000602084013e61178d565b606091505b50509050806117d65760405162461bcd60e51b81526020600482015260156024820152744661696c656420746f2073656e642056524646656560581b6044820152606401610a99565b6117e0338361242b565b6007546008546009546040516305d3b1d360e41b81526004810192909252600160a01b830467ffffffffffffffff166024830152640100000000810461ffff16604483015263ffffffff808216606484015266010000000000009091041660848201526000916001600160a01b031690635d3b1d309060a4016020604051808303816000875af1158015611878573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061189c9190612eb9565b6000818152600a6020908152604080832080546001600160a01b031916339081179091558352600b9091529020819055905060646118db8460c7612e3c565b6118e59190612e71565b336000818152600c6020526040908190209290925590517ff1805d757050f42a8e9145be9851086ed2f6557c87d5fc651cd8a5c7ed923e929061192b9086815260200190565b60405180910390a25050600160065550565b6005546001600160a01b031633146119675760405162461bcd60e51b8152600401610a9990612d9e565b6001600160a01b0381166119cc5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610a99565b6005546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600580546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316611a8a5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610a99565b6001600160a01b038216611aeb5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610a99565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6000828152600a60205260409020546001600160a01b031680611bb25760405162461bcd60e51b815260206004820152601a60248201527f4e6f2067616d6520666f756e6420666f722074686520757365720000000000006044820152606401610a99565b600082600081518110611bc757611bc7612ed2565b6020026020010151905083600b6000846001600160a01b03166001600160a01b03168152602001908152602001600020541415611d2a576000611c0b600283612ee8565b905080611ca1576001600160a01b0383166000908152600c6020526040902054611c3690849061251f565b6001600160a01b0383166000818152600c6020526040908190205490517f639b3f89af73534c58698d78dfe9d0ab626a4e371f09056916e5057957e4334791611c949185916001919283529015156020830152604082015260600190565b60405180910390a2611d02565b6001600160a01b0383166000818152600c60205260408082205490517f639b3f89af73534c58698d78dfe9d0ab626a4e371f09056916e5057957e4334792611cf9928683529015156020830152604082015260600190565b60405180910390a25b506001600160a01b0382166000908152600c60209081526040808320839055600b9091528120555b50505050565b6001600160a01b038316611d565760405162461bcd60e51b8152600401610a9990612efc565b6001600160a01b038216611d7c5760405162461bcd60e51b8152600401610a9990612f41565b80611d9257611d8d838360006125f8565b505050565b60125460ff1615612108576005546001600160a01b03848116911614801590611dc957506005546001600160a01b03838116911614155b8015611ddd57506001600160a01b03821615155b8015611df457506001600160a01b03821661dead14155b8015611e0a5750600d54600160a01b900460ff16155b1561210857601254610100900460ff16611ea2576001600160a01b0383166000908152601c602052604090205460ff1680611e5d57506001600160a01b0382166000908152601c602052604090205460ff165b611ea25760405162461bcd60e51b81526020600482015260166024820152752a3930b234b7339034b9903737ba1030b1ba34bb329760511b6044820152606401610a99565b6001600160a01b0383166000908152601e602052604090205460ff168015611ee357506001600160a01b0382166000908152601d602052604090205460ff16155b15611fc757600f54811115611f585760405162461bcd60e51b815260206004820152603560248201527f427579207472616e7366657220616d6f756e742065786365656473207468652060448201527436b0bc2a3930b739b0b1ba34b7b720b6b7bab73a1760591b6064820152608401610a99565b6011546001600160a01b038316600090815260208190526040902054611f7e9083612de9565b1115611fc25760405162461bcd60e51b815260206004820152601360248201527213585e081dd85b1b195d08195e18d959591959606a1b6044820152606401610a99565b612108565b6001600160a01b0382166000908152601e602052604090205460ff16801561200857506001600160a01b0383166000908152601d602052604090205460ff16155b1561207e57600f54811115611fc25760405162461bcd60e51b815260206004820152603660248201527f53656c6c207472616e7366657220616d6f756e742065786365656473207468656044820152751036b0bc2a3930b739b0b1ba34b7b720b6b7bab73a1760511b6064820152608401610a99565b6001600160a01b0382166000908152601d602052604090205460ff16612108576011546001600160a01b0383166000908152602081905260409020546120c49083612de9565b11156121085760405162461bcd60e51b815260206004820152601360248201527213585e081dd85b1b195d08195e18d959591959606a1b6044820152606401610a99565b3060009081526020819052604090205460105481108015908190612134575060125462010000900460ff165b801561214a5750600d54600160a01b900460ff16155b801561216f57506001600160a01b0385166000908152601e602052604090205460ff16155b801561219457506001600160a01b0385166000908152601c602052604090205460ff16155b80156121b957506001600160a01b0384166000908152601c602052604090205460ff16155b156121e757600d805460ff60a01b1916600160a01b1790556121d96126e9565b600d805460ff60a01b191690555b600d546001600160a01b0386166000908152601c602052604090205460ff600160a01b90920482161591168061223557506001600160a01b0385166000908152601c602052604090205460ff165b1561223e575060005b600081156123c3576001600160a01b0386166000908152601e602052604090205460ff16801561227057506000601654115b156122f8576064601654866122859190612e3c565b61228f9190612e71565b9050601654601754826122a29190612e3c565b6122ac9190612e71565b601a60008282546122bd9190612de9565b90915550506016546018546122d29083612e3c565b6122dc9190612e71565b601b60008282546122ed9190612de9565b909155506123a59050565b6001600160a01b0387166000908152601e602052604090205460ff16801561232257506000601354115b156123a5576064601354866123379190612e3c565b6123419190612e71565b9050601354601454826123549190612e3c565b61235e9190612e71565b601a600082825461236f9190612de9565b90915550506013546015546123849083612e3c565b61238e9190612e71565b601b600082825461239f9190612de9565b90915550505b80156123b6576123b68730836125f8565b6123c08186612e85565b94505b6123ce8787876125f8565b50505050505050565b6001600160a01b0382166000818152601e6020526040808220805460ff191685151590811790915590519092917fffa9187bf1f18bf477bd0ea1bcbb64e93b6a98132473929edfce215cd9b16fab91a35050565b6001600160a01b03821661248b5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610a99565b6001600160a01b0382166000908152602081905260409020546124af908290612e85565b6001600160a01b0383166000908152602081905260409020556002546124d6908290612e85565b6002556040518181526000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020015b60405180910390a35050565b6001600160a01b0382166125755760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610a99565b806002546125839190612de9565b6002556001600160a01b0382166000908152602081905260409020546125aa908290612de9565b6001600160a01b038316600081815260208181526040808320949094559251848152919290917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101612513565b6001600160a01b03831661261e5760405162461bcd60e51b8152600401610a9990612efc565b6001600160a01b0382166126445760405162461bcd60e51b8152600401610a9990612f41565b6001600160a01b038316600090815260208190526040902054612668908290612e85565b6001600160a01b038085166000908152602081905260408082209390935590841681522054612698908290612de9565b6001600160a01b038381166000818152602081815260409182902094909455518481529092918616917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101611b40565b3060009081526020819052604081205490506000601b54601a5461270d9190612de9565b9050600082158061271c575081155b1561272657505050565b601054612734906014612e3c565b83111561274c57601054612749906014612e3c565b92505b6000600283601a548661275f9190612e3c565b6127699190612e71565b6127739190612e71565b905060006127818286612e85565b90504761278d826128e8565b60006127998247612e85565b9050600086601b54836127ac9190612e3c565b6127b69190612e71565b905060006127c48284612e85565b6000601a819055601b819055600e546040519293506001600160a01b031691849181818185875af1925050503d806000811461281c576040519150601f19603f3d011682016040523d82523d6000602084013e612821565b606091505b509097505085158015906128355750600081115b15612888576128448682612a42565b601a54604080518781526020810184905280820192909252517f17bbfb9a6069321b6ded73bd96327c9e6b7212a5cd51ff219cd61370acafb5619181900360600190a15b600e546040516001600160a01b03909116904790600081818185875af1925050503d80600081146128d5576040519150601f19603f3d011682016040523d82523d6000602084013e6128da565b606091505b505050505050505050505050565b604080516002808252606082018352600092602083019080368337019050509050308160008151811061291d5761291d612ed2565b6001600160a01b03928316602091820292909201810191909152600d54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015612976573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061299a9190612f84565b816001815181106129ad576129ad612ed2565b6001600160a01b039283166020918202929092010152600d546129d39130911684611a28565b600d5460405163791ac94760e01b81526001600160a01b039091169063791ac94790612a0c908590600090869030904290600401612fa1565b600060405180830381600087803b158015612a2657600080fd5b505af1158015612a3a573d6000803e3d6000fd5b505050505050565b600d54612a5a9030906001600160a01b031684611a28565b600d54600e5460405163f305d71960e01b81523060048201526024810185905260006044820181905260648201526001600160a01b0391821660848201524260a482015291169063f305d71990839060c40160606040518083038185885af1158015612aca573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190612aef9190613012565b5050505050565b60008060408385031215612b0957600080fd5b50508035926020909101359150565b600060208083528351808285015260005b81811015612b4557858101830151858201604001528201612b29565b81811115612b57576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b0381168114610f0557600080fd5b60008060408385031215612b9557600080fd5b8235612ba081612b6d565b946020939093013593505050565b600060208284031215612bc057600080fd5b8135612bcb81612b6d565b9392505050565b634e487b7160e01b600052604160045260246000fd5b60008060408385031215612bfb57600080fd5b8235915060208084013567ffffffffffffffff80821115612c1b57600080fd5b818601915086601f830112612c2f57600080fd5b813581811115612c4157612c41612bd2565b8060051b604051601f19603f83011681018181108582111715612c6657612c66612bd2565b604052918252848201925083810185019189831115612c8457600080fd5b938501935b82851015612ca257843584529385019392850192612c89565b8096505050505050509250929050565b600060208284031215612cc457600080fd5b5035919050565b600080600060608486031215612ce057600080fd5b8335612ceb81612b6d565b92506020840135612cfb81612b6d565b929592945050506040919091013590565b8015158114610f0557600080fd5b60008060408385031215612d2d57600080fd5b8235612d3881612b6d565b91506020830135612d4881612d0c565b809150509250929050565b600060208284031215612d6557600080fd5b8135612bcb81612d0c565b60008060408385031215612d8357600080fd5b8235612d8e81612b6d565b91506020830135612d4881612b6d565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b60008219821115612dfc57612dfc612dd3565b500190565b600181811c90821680612e1557607f821691505b60208210811415612e3657634e487b7160e01b600052602260045260246000fd5b50919050565b6000816000190483118215151615612e5657612e56612dd3565b500290565b634e487b7160e01b600052601260045260246000fd5b600082612e8057612e80612e5b565b500490565b600082821015612e9757612e97612dd3565b500390565b600060208284031215612eae57600080fd5b8151612bcb81612d0c565b600060208284031215612ecb57600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b600082612ef757612ef7612e5b565b500690565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b600060208284031215612f9657600080fd5b8151612bcb81612b6d565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015612ff15784516001600160a01b031683529383019391830191600101612fcc565b50506001600160a01b03969096166060850152505050608001529392505050565b60008060006060848603121561302757600080fd5b835192506020840151915060408401519050925092509256fea2646970667358221220c99e0fae5aca912c560f86b4f8dafae0cdbe619ec98a849b88684e224abcf54164736f6c634300080a00334f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657200000000000000000000000000000000000000000000000000000000000003b3
60806040526004361061036f5760003560e01c80638ea5220f116101c6578063c0d78655116100f7578063e2ee328311610095578063f16816471161006f578063f1681647146109f4578063f2fde38b14610a23578063f637434214610a43578063f8b45b0514610a5957600080fd5b8063e2ee3283146109b5578063e2f45605146109c8578063f11a24d3146109de57600080fd5b8063ca628c78116100d1578063ca628c7814610924578063d257b34f14610939578063d85ba06314610959578063dd62ed3e1461096f57600080fd5b8063c0d78655146108ce578063c18bc195146108ee578063c8c8ebe41461090e57600080fd5b8063a0d82dc511610164578063a9059cbb1161013e578063a9059cbb1461083f578063b62496f51461085f578063bbc0c7421461088f578063c0246668146108ae57600080fd5b8063a0d82dc5146107dc578063a340f3bc146107f2578063a457c2d71461081f57600080fd5b806395d89b41116101a057806395d89b411461077b5780639a7a23d6146107905780639c3b4fdc146107b05780639fccce32146107c657600080fd5b80638ea5220f14610725578063924de9b714610745578063935cbe151461076557600080fd5b80633546211e116102a05780636ddd17131161023e578063751039fc11610218578063751039fc146106bd5780637571336a146106d25780638a8c523c146106f25780638da5cb5b1461070757600080fd5b80636ddd17131461065257806370a0823114610672578063715018a6146106a857600080fd5b80634fbee1931161027a5780634fbee193146105ce57806363bd1d4a1461060757806366ca9b831461061c5780636a486a8e1461063c57600080fd5b80633546211e1461056757806339509351146105945780634a62bb65146105b457600080fd5b80631a8145bb1161030d57806323b872dd116102e757806323b872dd146104f557806327c8f835146105155780632aec3ab91461052b578063313ce5671461054b57600080fd5b80631a8145bb1461049f5780631fe543e3146104b5578063203e727e146104d557600080fd5b806310d5de531161034957806310d5de53146103f85780631694505e1461042857806318160ddd146104605780631816467f1461047f57600080fd5b806302dbd8f81461037b57806306fdde031461039d578063095ea7b3146103c857600080fd5b3661037657005b600080fd5b34801561038757600080fd5b5061039b610396366004612af6565b610a6f565b005b3480156103a957600080fd5b506103b2610b0f565b6040516103bf9190612b18565b60405180910390f35b3480156103d457600080fd5b506103e86103e3366004612b82565b610ba1565b60405190151581526020016103bf565b34801561040457600080fd5b506103e8610413366004612bae565b601d6020526000908152604090205460ff1681565b34801561043457600080fd5b50600d54610448906001600160a01b031681565b6040516001600160a01b0390911681526020016103bf565b34801561046c57600080fd5b506002545b6040519081526020016103bf565b34801561048b57600080fd5b5061039b61049a366004612bae565b610bb7565b3480156104ab57600080fd5b50610471601a5481565b3480156104c157600080fd5b5061039b6104d0366004612be8565b610c3e565b3480156104e157600080fd5b5061039b6104f0366004612cb2565b610cc2565b34801561050157600080fd5b506103e8610510366004612ccb565b610d9f565b34801561052157600080fd5b5061044861dead81565b34801561053757600080fd5b5061039b610546366004612cb2565b610df1565b34801561055757600080fd5b50604051601281526020016103bf565b34801561057357600080fd5b50610471610582366004612bae565b600b6020526000908152604090205481565b3480156105a057600080fd5b506103e86105af366004612b82565b610e78565b3480156105c057600080fd5b506012546103e89060ff1681565b3480156105da57600080fd5b506103e86105e9366004612bae565b6001600160a01b03166000908152601c602052604090205460ff1690565b34801561061357600080fd5b5061039b610eaf565b34801561062857600080fd5b5061039b610637366004612af6565b610f08565b34801561064857600080fd5b5061047160165481565b34801561065e57600080fd5b506012546103e89062010000900460ff1681565b34801561067e57600080fd5b5061047161068d366004612bae565b6001600160a01b031660009081526020819052604090205490565b3480156106b457600080fd5b5061039b610f9b565b3480156106c957600080fd5b506103e861100f565b3480156106de57600080fd5b5061039b6106ed366004612d1a565b61104c565b3480156106fe57600080fd5b5061039b6110a1565b34801561071357600080fd5b506005546001600160a01b0316610448565b34801561073157600080fd5b50600e54610448906001600160a01b031681565b34801561075157600080fd5b5061039b610760366004612d53565b6110de565b34801561077157600080fd5b5061047160195481565b34801561078757600080fd5b506103b2611124565b34801561079c57600080fd5b5061039b6107ab366004612d1a565b611133565b3480156107bc57600080fd5b5061047160155481565b3480156107d257600080fd5b50610471601b5481565b3480156107e857600080fd5b5061047160185481565b3480156107fe57600080fd5b5061047161080d366004612bae565b600c6020526000908152604090205481565b34801561082b57600080fd5b506103e861083a366004612b82565b611167565b34801561084b57600080fd5b506103e861085a366004612b82565b61119e565b34801561086b57600080fd5b506103e861087a366004612bae565b601e6020526000908152604090205460ff1681565b34801561089b57600080fd5b506012546103e890610100900460ff1681565b3480156108ba57600080fd5b5061039b6108c9366004612d1a565b6111ab565b3480156108da57600080fd5b5061039b6108e9366004612bae565b611234565b3480156108fa57600080fd5b5061039b610909366004612cb2565b61128d565b34801561091a57600080fd5b50610471600f5481565b34801561093057600080fd5b5061039b61135e565b34801561094557600080fd5b506103e8610954366004612cb2565b6114a9565b34801561096557600080fd5b5061047160135481565b34801561097b57600080fd5b5061047161098a366004612d70565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b61039b6109c3366004612cb2565b6115f8565b3480156109d457600080fd5b5061047160105481565b3480156109ea57600080fd5b5061047160145481565b348015610a0057600080fd5b5061039b336000908152600c60209081526040808320839055600b909152812055565b348015610a2f57600080fd5b5061039b610a3e366004612bae565b61193d565b348015610a4f57600080fd5b5061047160175481565b348015610a6557600080fd5b5061047160115481565b6005546001600160a01b03163314610aa25760405162461bcd60e51b8152600401610a9990612d9e565b60405180910390fd5b60178290556018819055610ab68183612de9565b601681905560191015610b0b5760405162461bcd60e51b815260206004820152601d60248201527f4d757374206b656570206665657320617420323525206f72206c6573730000006044820152606401610a99565b5050565b606060038054610b1e90612e01565b80601f0160208091040260200160405190810160405280929190818152602001828054610b4a90612e01565b8015610b975780601f10610b6c57610100808354040283529160200191610b97565b820191906000526020600020905b815481529060010190602001808311610b7a57829003601f168201915b5050505050905090565b6000610bae338484611a28565b50600192915050565b6005546001600160a01b03163314610be15760405162461bcd60e51b8152600401610a9990612d9e565b600e546040516001600160a01b03918216918316907f90b8024c4923d3873ff5b9fcb43d0360d4b9217fa41225d07ba379993552e74390600090a3600e80546001600160a01b0319166001600160a01b0392909216919091179055565b336001600160a01b037f000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e699091614610cb85760405163073e64fd60e21b81523360048201526001600160a01b037f000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e69909166024820152604401610a99565b610b0b8282611b4d565b6005546001600160a01b03163314610cec5760405162461bcd60e51b8152600401610a9990612d9e565b670de0b6b3a76400006103e8610d0160025490565b610d0c906001612e3c565b610d169190612e71565b610d209190612e71565b811015610d875760405162461bcd60e51b815260206004820152602f60248201527f43616e6e6f7420736574206d61785472616e73616374696f6e416d6f756e742060448201526e6c6f776572207468616e20302e312560881b6064820152608401610a99565b610d9981670de0b6b3a7640000612e3c565b600f5550565b6000610dac848484611d30565b6001600160a01b038416600090815260016020908152604080832033808552925290912054610de7918691610de2908690612e85565b611a28565b5060019392505050565b6005546001600160a01b03163314610e1b5760405162461bcd60e51b8152600401610a9990612d9e565b67016345785d8a0000811115610e735760405162461bcd60e51b815260206004820152601c60248201527f4d757374206b6565702056524620666565203c3d20302e3120455448000000006044820152606401610a99565b601955565b3360008181526001602090815260408083206001600160a01b03871684529091528120549091610bae918590610de2908690612de9565b6005546001600160a01b03163314610ed95760405162461bcd60e51b8152600401610a9990612d9e565b60405133904780156108fc02916000818181858888f19350505050158015610f05573d6000803e3d6000fd5b50565b6005546001600160a01b03163314610f325760405162461bcd60e51b8152600401610a9990612d9e565b60148290556015819055610f468183612de9565b601381905560141015610b0b5760405162461bcd60e51b815260206004820152601d60248201527f4d757374206b656570206665657320617420323025206f72206c6573730000006044820152606401610a99565b6005546001600160a01b03163314610fc55760405162461bcd60e51b8152600401610a9990612d9e565b6005546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600580546001600160a01b0319169055565b6005546000906001600160a01b0316331461103c5760405162461bcd60e51b8152600401610a9990612d9e565b506012805460ff19169055600190565b6005546001600160a01b031633146110765760405162461bcd60e51b8152600401610a9990612d9e565b6001600160a01b03919091166000908152601d60205260409020805460ff1916911515919091179055565b6005546001600160a01b031633146110cb5760405162461bcd60e51b8152600401610a9990612d9e565b6012805462ffff00191662010100179055565b6005546001600160a01b031633146111085760405162461bcd60e51b8152600401610a9990612d9e565b60128054911515620100000262ff000019909216919091179055565b606060048054610b1e90612e01565b6005546001600160a01b0316331461115d5760405162461bcd60e51b8152600401610a9990612d9e565b610b0b82826123d7565b3360008181526001602090815260408083206001600160a01b03871684529091528120549091610bae918590610de2908690612e85565b6000610bae338484611d30565b6005546001600160a01b031633146111d55760405162461bcd60e51b8152600401610a9990612d9e565b6001600160a01b0382166000818152601c6020908152604091829020805460ff191685151590811790915591519182527f9d8f7706ea1113d1a167b526eca956215946dd36cc7df39eb16180222d8b5df7910160405180910390a25050565b6005546001600160a01b0316331461125e5760405162461bcd60e51b8152600401610a9990612d9e565b8061126a81600161104c565b600d80546001600160a01b0319166001600160a01b039290921691909117905550565b6005546001600160a01b031633146112b75760405162461bcd60e51b8152600401610a9990612d9e565b670de0b6b3a76400006103e86112cc60025490565b6112d7906005612e3c565b6112e19190612e71565b6112eb9190612e71565b8110156113465760405162461bcd60e51b8152602060048201526024808201527f43616e6e6f7420736574206d617857616c6c6574206c6f776572207468616e20604482015263302e352560e01b6064820152608401610a99565b61135881670de0b6b3a7640000612e3c565b60115550565b6005546001600160a01b031633146113885760405162461bcd60e51b8152600401610a9990612d9e565b3063095ea7b38161139860025490565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af11580156113e3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114079190612e9c565b50306323b872dd816114216005546001600160a01b031690565b306000908152602081905260409020546040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015260448201526064016020604051808303816000875af1158015611485573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f059190612e9c565b6005546000906001600160a01b031633146114d65760405162461bcd60e51b8152600401610a9990612d9e565b620186a06114e360025490565b6114ee906001612e3c565b6114f89190612e71565b8210156115655760405162461bcd60e51b815260206004820152603560248201527f5377617020616d6f756e742063616e6e6f74206265206c6f776572207468616e60448201527410181718181892903a37ba30b61039bab838363c9760591b6064820152608401610a99565b606461157060025490565b61157b906001612e3c565b6115859190612e71565b8211156115ef5760405162461bcd60e51b815260206004820152603260248201527f5377617020616d6f756e742063616e6e6f74206265206869676865722074686160448201527137101892903a37ba30b61039bab838363c9760711b6064820152608401610a99565b50601055600190565b60065460011461161b5760405163558a1e0360e11b815260040160405180910390fd5b6002600655606461162b60025490565b6116359190612e71565b81111561169e5760405162461bcd60e51b815260206004820152603160248201527f43616e206e6f742066617274206d6f7265207468616e203125206f662074686560448201527020737570706c7920617420612074696d6560781b6064820152608401610a99565b336000908152600b6020526040902054156116f15760405162461bcd60e51b81526020600482015260136024820152724f6e65206661727420617420612074696d652160681b6044820152606401610a99565b6019543410156117395760405162461bcd60e51b8152602060048201526013602482015272496e73756666696369656e742056524646656560681b6044820152606401610a99565b600e546019546040516000926001600160a01b031691908381818185875af1925050503d8060008114611788576040519150601f19603f3d011682016040523d82523d6000602084013e61178d565b606091505b50509050806117d65760405162461bcd60e51b81526020600482015260156024820152744661696c656420746f2073656e642056524646656560581b6044820152606401610a99565b6117e0338361242b565b6007546008546009546040516305d3b1d360e41b81526004810192909252600160a01b830467ffffffffffffffff166024830152640100000000810461ffff16604483015263ffffffff808216606484015266010000000000009091041660848201526000916001600160a01b031690635d3b1d309060a4016020604051808303816000875af1158015611878573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061189c9190612eb9565b6000818152600a6020908152604080832080546001600160a01b031916339081179091558352600b9091529020819055905060646118db8460c7612e3c565b6118e59190612e71565b336000818152600c6020526040908190209290925590517ff1805d757050f42a8e9145be9851086ed2f6557c87d5fc651cd8a5c7ed923e929061192b9086815260200190565b60405180910390a25050600160065550565b6005546001600160a01b031633146119675760405162461bcd60e51b8152600401610a9990612d9e565b6001600160a01b0381166119cc5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610a99565b6005546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600580546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316611a8a5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610a99565b6001600160a01b038216611aeb5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610a99565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6000828152600a60205260409020546001600160a01b031680611bb25760405162461bcd60e51b815260206004820152601a60248201527f4e6f2067616d6520666f756e6420666f722074686520757365720000000000006044820152606401610a99565b600082600081518110611bc757611bc7612ed2565b6020026020010151905083600b6000846001600160a01b03166001600160a01b03168152602001908152602001600020541415611d2a576000611c0b600283612ee8565b905080611ca1576001600160a01b0383166000908152600c6020526040902054611c3690849061251f565b6001600160a01b0383166000818152600c6020526040908190205490517f639b3f89af73534c58698d78dfe9d0ab626a4e371f09056916e5057957e4334791611c949185916001919283529015156020830152604082015260600190565b60405180910390a2611d02565b6001600160a01b0383166000818152600c60205260408082205490517f639b3f89af73534c58698d78dfe9d0ab626a4e371f09056916e5057957e4334792611cf9928683529015156020830152604082015260600190565b60405180910390a25b506001600160a01b0382166000908152600c60209081526040808320839055600b9091528120555b50505050565b6001600160a01b038316611d565760405162461bcd60e51b8152600401610a9990612efc565b6001600160a01b038216611d7c5760405162461bcd60e51b8152600401610a9990612f41565b80611d9257611d8d838360006125f8565b505050565b60125460ff1615612108576005546001600160a01b03848116911614801590611dc957506005546001600160a01b03838116911614155b8015611ddd57506001600160a01b03821615155b8015611df457506001600160a01b03821661dead14155b8015611e0a5750600d54600160a01b900460ff16155b1561210857601254610100900460ff16611ea2576001600160a01b0383166000908152601c602052604090205460ff1680611e5d57506001600160a01b0382166000908152601c602052604090205460ff165b611ea25760405162461bcd60e51b81526020600482015260166024820152752a3930b234b7339034b9903737ba1030b1ba34bb329760511b6044820152606401610a99565b6001600160a01b0383166000908152601e602052604090205460ff168015611ee357506001600160a01b0382166000908152601d602052604090205460ff16155b15611fc757600f54811115611f585760405162461bcd60e51b815260206004820152603560248201527f427579207472616e7366657220616d6f756e742065786365656473207468652060448201527436b0bc2a3930b739b0b1ba34b7b720b6b7bab73a1760591b6064820152608401610a99565b6011546001600160a01b038316600090815260208190526040902054611f7e9083612de9565b1115611fc25760405162461bcd60e51b815260206004820152601360248201527213585e081dd85b1b195d08195e18d959591959606a1b6044820152606401610a99565b612108565b6001600160a01b0382166000908152601e602052604090205460ff16801561200857506001600160a01b0383166000908152601d602052604090205460ff16155b1561207e57600f54811115611fc25760405162461bcd60e51b815260206004820152603660248201527f53656c6c207472616e7366657220616d6f756e742065786365656473207468656044820152751036b0bc2a3930b739b0b1ba34b7b720b6b7bab73a1760511b6064820152608401610a99565b6001600160a01b0382166000908152601d602052604090205460ff16612108576011546001600160a01b0383166000908152602081905260409020546120c49083612de9565b11156121085760405162461bcd60e51b815260206004820152601360248201527213585e081dd85b1b195d08195e18d959591959606a1b6044820152606401610a99565b3060009081526020819052604090205460105481108015908190612134575060125462010000900460ff165b801561214a5750600d54600160a01b900460ff16155b801561216f57506001600160a01b0385166000908152601e602052604090205460ff16155b801561219457506001600160a01b0385166000908152601c602052604090205460ff16155b80156121b957506001600160a01b0384166000908152601c602052604090205460ff16155b156121e757600d805460ff60a01b1916600160a01b1790556121d96126e9565b600d805460ff60a01b191690555b600d546001600160a01b0386166000908152601c602052604090205460ff600160a01b90920482161591168061223557506001600160a01b0385166000908152601c602052604090205460ff165b1561223e575060005b600081156123c3576001600160a01b0386166000908152601e602052604090205460ff16801561227057506000601654115b156122f8576064601654866122859190612e3c565b61228f9190612e71565b9050601654601754826122a29190612e3c565b6122ac9190612e71565b601a60008282546122bd9190612de9565b90915550506016546018546122d29083612e3c565b6122dc9190612e71565b601b60008282546122ed9190612de9565b909155506123a59050565b6001600160a01b0387166000908152601e602052604090205460ff16801561232257506000601354115b156123a5576064601354866123379190612e3c565b6123419190612e71565b9050601354601454826123549190612e3c565b61235e9190612e71565b601a600082825461236f9190612de9565b90915550506013546015546123849083612e3c565b61238e9190612e71565b601b600082825461239f9190612de9565b90915550505b80156123b6576123b68730836125f8565b6123c08186612e85565b94505b6123ce8787876125f8565b50505050505050565b6001600160a01b0382166000818152601e6020526040808220805460ff191685151590811790915590519092917fffa9187bf1f18bf477bd0ea1bcbb64e93b6a98132473929edfce215cd9b16fab91a35050565b6001600160a01b03821661248b5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610a99565b6001600160a01b0382166000908152602081905260409020546124af908290612e85565b6001600160a01b0383166000908152602081905260409020556002546124d6908290612e85565b6002556040518181526000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020015b60405180910390a35050565b6001600160a01b0382166125755760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610a99565b806002546125839190612de9565b6002556001600160a01b0382166000908152602081905260409020546125aa908290612de9565b6001600160a01b038316600081815260208181526040808320949094559251848152919290917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101612513565b6001600160a01b03831661261e5760405162461bcd60e51b8152600401610a9990612efc565b6001600160a01b0382166126445760405162461bcd60e51b8152600401610a9990612f41565b6001600160a01b038316600090815260208190526040902054612668908290612e85565b6001600160a01b038085166000908152602081905260408082209390935590841681522054612698908290612de9565b6001600160a01b038381166000818152602081815260409182902094909455518481529092918616917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101611b40565b3060009081526020819052604081205490506000601b54601a5461270d9190612de9565b9050600082158061271c575081155b1561272657505050565b601054612734906014612e3c565b83111561274c57601054612749906014612e3c565b92505b6000600283601a548661275f9190612e3c565b6127699190612e71565b6127739190612e71565b905060006127818286612e85565b90504761278d826128e8565b60006127998247612e85565b9050600086601b54836127ac9190612e3c565b6127b69190612e71565b905060006127c48284612e85565b6000601a819055601b819055600e546040519293506001600160a01b031691849181818185875af1925050503d806000811461281c576040519150601f19603f3d011682016040523d82523d6000602084013e612821565b606091505b509097505085158015906128355750600081115b15612888576128448682612a42565b601a54604080518781526020810184905280820192909252517f17bbfb9a6069321b6ded73bd96327c9e6b7212a5cd51ff219cd61370acafb5619181900360600190a15b600e546040516001600160a01b03909116904790600081818185875af1925050503d80600081146128d5576040519150601f19603f3d011682016040523d82523d6000602084013e6128da565b606091505b505050505050505050505050565b604080516002808252606082018352600092602083019080368337019050509050308160008151811061291d5761291d612ed2565b6001600160a01b03928316602091820292909201810191909152600d54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015612976573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061299a9190612f84565b816001815181106129ad576129ad612ed2565b6001600160a01b039283166020918202929092010152600d546129d39130911684611a28565b600d5460405163791ac94760e01b81526001600160a01b039091169063791ac94790612a0c908590600090869030904290600401612fa1565b600060405180830381600087803b158015612a2657600080fd5b505af1158015612a3a573d6000803e3d6000fd5b505050505050565b600d54612a5a9030906001600160a01b031684611a28565b600d54600e5460405163f305d71960e01b81523060048201526024810185905260006044820181905260648201526001600160a01b0391821660848201524260a482015291169063f305d71990839060c40160606040518083038185885af1158015612aca573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190612aef9190613012565b5050505050565b60008060408385031215612b0957600080fd5b50508035926020909101359150565b600060208083528351808285015260005b81811015612b4557858101830151858201604001528201612b29565b81811115612b57576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b0381168114610f0557600080fd5b60008060408385031215612b9557600080fd5b8235612ba081612b6d565b946020939093013593505050565b600060208284031215612bc057600080fd5b8135612bcb81612b6d565b9392505050565b634e487b7160e01b600052604160045260246000fd5b60008060408385031215612bfb57600080fd5b8235915060208084013567ffffffffffffffff80821115612c1b57600080fd5b818601915086601f830112612c2f57600080fd5b813581811115612c4157612c41612bd2565b8060051b604051601f19603f83011681018181108582111715612c6657612c66612bd2565b604052918252848201925083810185019189831115612c8457600080fd5b938501935b82851015612ca257843584529385019392850192612c89565b8096505050505050509250929050565b600060208284031215612cc457600080fd5b5035919050565b600080600060608486031215612ce057600080fd5b8335612ceb81612b6d565b92506020840135612cfb81612b6d565b929592945050506040919091013590565b8015158114610f0557600080fd5b60008060408385031215612d2d57600080fd5b8235612d3881612b6d565b91506020830135612d4881612d0c565b809150509250929050565b600060208284031215612d6557600080fd5b8135612bcb81612d0c565b60008060408385031215612d8357600080fd5b8235612d8e81612b6d565b91506020830135612d4881612b6d565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b60008219821115612dfc57612dfc612dd3565b500190565b600181811c90821680612e1557607f821691505b60208210811415612e3657634e487b7160e01b600052602260045260246000fd5b50919050565b6000816000190483118215151615612e5657612e56612dd3565b500290565b634e487b7160e01b600052601260045260246000fd5b600082612e8057612e80612e5b565b500490565b600082821015612e9757612e97612dd3565b500390565b600060208284031215612eae57600080fd5b8151612bcb81612d0c565b600060208284031215612ecb57600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b600082612ef757612ef7612e5b565b500690565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b600060208284031215612f9657600080fd5b8151612bcb81612b6d565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015612ff15784516001600160a01b031683529383019391830191600101612fcc565b50506001600160a01b03969096166060850152505050608001529392505050565b60008060006060848603121561302757600080fd5b835192506020840151915060408401519050925092509256fea2646970667358221220c99e0fae5aca912c560f86b4f8dafae0cdbe619ec98a849b88684e224abcf54164736f6c634300080a0033
{{ "language": "Solidity", "sources": { "fartingshiba.sol": { "content": "/*⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\r\n⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣐⢂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\r\n⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠠⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠤⠀⠀⢀⠀⠀⢀⠀⢀⣤⣤⣾⣿⣿⣷⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀\r\n⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣤⣶⣶⣶⣦⣦⣢⢀⠀⢀⣠⣴⣶⣶⣿⣷⣶⣤⣆⣤⠐⠄⠈⣴⣿⡿⠹⠟⠀⠀⠚⠛⢻⣷⡆⠀⠀⠀⠀⠀⠀\r\n⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⡀⠀⠀⠀⠀⠀⢠⣾⣿⣿⠿⠛⠛⠿⢿⣿⣿⣷⣿⠿⠟⠛⠛⠉⠛⠻⢿⣿⣿⣷⣄⠀⠻⣿⣧⣀⡀⠀⠐⠀⠀⠀⣿⣯⠅⠀⠀⠀⠀⠀\r\n⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣤⣼⣀⠤⢀⠀⠀⠀⣾⣿⡟⠀⠀⠀⠀⠀⠀⠈⠛⣿⣷⡂⠀⠀⠀⠀⠀⠀⠀⠙⢿⣿⣿⣤⠀⠈⣽⣯⠀⠀⠀⡀⠀⠛⢿⡏⠀⠀⠀⠀⠀⠀\r\n⠀⠀⠀⠀⠀⠀⠀⠀⣸⣿⡿⢻⣿⣀⠀⠂⠀⢠⣿⠿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠻⣿⡀⠀⠀⠀⠀⠀⠀⠀⠘⣿⣿⡏⠀⠀⠻⣷⣶⣠⣼⢧⣬⣶⣿⠗⠀⠀⠀⠀⠀⠀\r\n⠀⠀⠀⠀⠀⠀⠀⣾⣿⠋⠀⠀⢈⣙⣷⣆⠀⢸⣿⣵⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠁⠀⠀⠀⠀⠀⠀⠀⠀⢹⣿⡏⠀⠀⠀⠀⠉⠉⠀⠈⠉⠉⠀⠀⠀⠀⠀⠀⠀⠀\r\n⠀⠀⠀⠀⠀⠀⠀⠿⣿⣱⣴⣷⣼⣿⡿⠏⠀⠀⠘⣿⣆⠀⠠⠀⠀⠀⠀THE⠀⠀⠀⠀⠀⠀⠀⠀⠀⣤⣴⣾⣿⣿⣿⣷⣶⣴⣦⡀⠲⠨⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\r\n⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⠀⠀⠀⠈⠁⠀⠀⢀⣴⣿⡿⢧⣀⠒⠀⠀⠀⠀⠀FIRST⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠙⠻⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\r\n⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠀⠀⠀⠀⠀⠀⢤⣿⣿⠋⠀⠀⢩⣄⠀⠀⠀⠀⠀⠀⠀⠀FART⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢻⣿⣿⣧⡄⠈⠀⢠⣄⠀⠀⠀⠀⠀\r\n⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠄⣿⣻⡃⠀⠀⠀⠀⢿⣦⣄⠂⠀⠀⠀⠀⠀⠀⠀TO⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⣿⣿⣺⠀⣠⣴⣶⣄⡀⠀⠀⠀\r\n⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢸⣿⣼⠇⠀⠀⠀⠀⠈⢻⣿⣷⣦⣤⣤⣤⣾⡄⠄⠀EARN ⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⡟⣀⣿⣿⣿⣿⣶⣶⣶⡀\r\n⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⢻⣿⣶⡀⠀⠀⠀⠀⢠⡽⠛⣿⣿⠋⠁⣿⣧⠀⠆⠀⠀⠀TOKEN ⠀⠀⠀⣰⣿⣿⣿⠇⢴⣿⣿⢿⡿⠛⠻⣿⣿\r\n⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣿⣿⣦⣄⠀⠀⣾⡇⠀⠸⣿⣷⣶⣿⣿⣧⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⣿⠟⠁⢈⣿⢿⡁⠀⠀⠀⠙⢿⣿\r\n⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠛⡟⠿⣿⣯⠋⢀⡀⠈⠈⠉⠉⠻⣿⣿⣶⣤⣄⡀⠀⠀⠀⠀⣠⣠⣴⠿⣿⣿⣿⣷⡄⠀⢿⣿⣦⣀⣴⣆⣤⣿⣿\r\n⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⡿⠉⠀⣌⠁⠉⠀⢀⣠⡾⠂⠡⠈⠉⠉⠁⠀⠀⠀⠀⠉⠁⠀⠀⠈⠻⣿⣿⣿⠆⠀⠀⠉⠉⠙⢛⣟⠟⠁\r\n⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⡋⣠⣾⠏⣴⣴⣶⡿⠃⠀⠀⠀⠈⠀⠀⢠⣦⠈⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⣿⣿⡀⠀⠀⠀⠉⠀⠀⠀⠀\r\n⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣴⣿⣿⣿⣿⣷⣿⣿⣿⣿⣅⠀⠀⠀⠀⠀⠀⢠⣴⣿⣦⣀⠀⠀⠀⠀⠀⠀⠀⣠⣿⣿⠿⠁⠀⠀⠀⠀⠀⠀⠀⠀\r\n⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣾⣿⣿⣿⣿⣿⡿⠟⠀⠘⠻⣿⣷⣀⡀⠀⠀⣀⣾⡟⠋⠛⢿⣿⣶⣤⣤⣤⣴⣾⣿⣿⡿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀\r\n⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣿⣿⣿⣿⣿⠟⠁⠀⠀⠀⠀⠂⠈⠙⢻⡿⡿⠟⠛⠉⠀⠀⠀⠀⠈⠙⢛⢿⠿⠿⠻⠻⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\r\n⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\r\n⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⣿⡿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\r\n⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣴⣿⠟⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\r\n⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⡟⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\r\n⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\r\n FARTING SHIBA\r\nThe first FART TO EARN token\r\n\r\n● Deflationary farting supply\r\n● Fast farts secured by Chainlink VRF\r\n● Noisy fart to earn, stinky fart to lose\r\n\r\nWebsite: https://fartingshiba.site/\r\nDocumentation: https://docs.fartingshiba.site/\r\nTelegram: https://t.me/fartingshiba/\r\n\r\n*/\r\n\r\n// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.0;\r\n\r\nimport \"@chainlink/contracts/src/v0.8/VRFConsumerBaseV2.sol\";\r\nimport \"@chainlink/contracts/src/v0.8/interfaces/VRFCoordinatorV2Interface.sol\";\r\n\r\nabstract contract Context {\r\n function _msgSender() internal view virtual returns (address) {\r\n return msg.sender;\r\n }\r\n\r\n function _msgData() internal view virtual returns (bytes calldata) {\r\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\r\n return msg.data;\r\n }\r\n}\r\n\r\ninterface IUniswapV2Pair {\r\n event Approval(address indexed owner, address indexed spender, uint value);\r\n event Transfer(address indexed from, address indexed to, uint value);\r\n function name() external pure returns (string memory);\r\n function symbol() external pure returns (string memory);\r\n function decimals() external pure returns (uint8);\r\n function totalSupply() external view returns (uint);\r\n function balanceOf(address owner) external view returns (uint);\r\n function allowance(address owner, address spender) external view returns (uint);\r\n function approve(address spender, uint value) external returns (bool);\r\n function transfer(address to, uint value) external returns (bool);\r\n function transferFrom(address from, address to, uint value) external returns (bool);\r\n function DOMAIN_SEPARATOR() external view returns (bytes32);\r\n function PERMIT_TYPEHASH() external pure returns (bytes32);\r\n function nonces(address owner) external view returns (uint);\r\n function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;\r\n event Mint(address indexed sender, uint amount0, uint amount1);\r\n event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);\r\n event Swap(\r\n address indexed sender,\r\n uint amount0In,\r\n uint amount1In,\r\n uint amount0Out,\r\n uint amount1Out,\r\n address indexed to\r\n );\r\n event Sync(uint112 reserve0, uint112 reserve1);\r\n function MINIMUM_LIQUIDITY() external pure returns (uint);\r\n function factory() external view returns (address);\r\n function token0() external view returns (address);\r\n function token1() external view returns (address);\r\n function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);\r\n function price0CumulativeLast() external view returns (uint);\r\n function price1CumulativeLast() external view returns (uint);\r\n function kLast() external view returns (uint);\r\n function mint(address to) external returns (uint liquidity);\r\n function burn(address to) external returns (uint amount0, uint amount1);\r\n function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;\r\n function skim(address to) external;\r\n function sync() external;\r\n function initialize(address, address) external;\r\n}\r\n\r\ninterface IUniswapV2Factory {\r\n event PairCreated(address indexed token0, address indexed token1, address pair, uint);\r\n function feeTo() external view returns (address);\r\n function feeToSetter() external view returns (address);\r\n function getPair(address tokenA, address tokenB) external view returns (address pair);\r\n function allPairs(uint) external view returns (address pair);\r\n function allPairsLength() external view returns (uint);\r\n function createPair(address tokenA, address tokenB) external returns (address pair);\r\n function setFeeTo(address) external;\r\n function setFeeToSetter(address) external;\r\n}\r\n\r\ninterface IERC20 {\r\n function totalSupply() external view returns (uint256);\r\n function balanceOf(address account) external view returns (uint256);\r\n function transfer(address recipient, uint256 amount) external returns (bool);\r\n function allowance(address owner, address spender) external view returns (uint256);\r\n function approve(address spender, uint256 amount) external returns (bool);\r\n function transferFrom(\r\n address sender,\r\n address recipient,\r\n uint256 amount\r\n ) external returns (bool);\r\n event Transfer(address indexed from, address indexed to, uint256 value);\r\n event Approval(address indexed owner, address indexed spender, uint256 value);\r\n}\r\n\r\ninterface IERC20Metadata is IERC20 {\r\n function name() external view returns (string memory);\r\n function symbol() external view returns (string memory);\r\n function decimals() external view returns (uint8);\r\n}\r\n\r\ncontract ERC20 is Context, IERC20, IERC20Metadata {\r\n mapping(address => uint256) private _balances;\r\n mapping(address => mapping(address => uint256)) private _allowances;\r\n uint256 private _totalSupply;\r\n string private _name;\r\n string private _symbol;\r\n constructor(string memory name_, string memory symbol_) {\r\n _name = name_;\r\n _symbol = symbol_;\r\n }\r\n function name() public view virtual override returns (string memory) {\r\n return _name;\r\n }\r\n function symbol() public view virtual override returns (string memory) {\r\n return _symbol;\r\n }\r\n function decimals() public view virtual override returns (uint8) {\r\n return 18;\r\n }\r\n function totalSupply() public view virtual override returns (uint256) {\r\n return _totalSupply;\r\n }\r\n function balanceOf(address account) public view virtual override returns (uint256) {\r\n return _balances[account];\r\n }\r\n function transfer(address recipient, uint256 amount) public virtual override returns (bool) {\r\n _transfer(_msgSender(), recipient, amount);\r\n return true;\r\n }\r\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\r\n return _allowances[owner][spender];\r\n }\r\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\r\n _approve(_msgSender(), spender, amount);\r\n return true;\r\n }\r\n function transferFrom(\r\n address sender,\r\n address recipient,\r\n uint256 amount\r\n ) public virtual override returns (bool) {\r\n _transfer(sender, recipient, amount);\r\n _approve(sender, _msgSender(), _allowances[sender][_msgSender()] - amount );\r\n return true;\r\n }\r\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\r\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue );\r\n return true;\r\n }\r\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\r\n _approve(_msgSender(), spender, _allowances[_msgSender()][spender] - subtractedValue );\r\n return true;\r\n }\r\n function _transfer(\r\n address sender,\r\n address recipient,\r\n uint256 amount\r\n ) internal virtual {\r\n require(sender != address(0), \"ERC20: transfer from the zero address\");\r\n require(recipient != address(0), \"ERC20: transfer to the zero address\");\r\n _beforeTokenTransfer(sender, recipient, amount);\r\n _balances[sender] = _balances[sender] - amount;\r\n _balances[recipient] = _balances[recipient] + amount;\r\n emit Transfer(sender, recipient, amount);\r\n }\r\n function _mint(address account, uint256 amount) internal virtual {\r\n require(account != address(0), \"ERC20: mint to the zero address\");\r\n _beforeTokenTransfer(address(0), account, amount);\r\n _totalSupply = _totalSupply + amount;\r\n _balances[account] = _balances[account] + amount;\r\n emit Transfer(address(0), account, amount);\r\n }\r\n function _burn(address account, uint256 amount) internal virtual {\r\n require(account != address(0), \"ERC20: burn from the zero address\");\r\n _beforeTokenTransfer(account, address(0), amount);\r\n _balances[account] = _balances[account] - amount;\r\n _totalSupply = _totalSupply - amount;\r\n emit Transfer(account, address(0), amount);\r\n }\r\n function _approve(\r\n address owner,\r\n address spender,\r\n uint256 amount\r\n ) internal virtual {\r\n require(owner != address(0), \"ERC20: approve from the zero address\");\r\n require(spender != address(0), \"ERC20: approve to the zero address\");\r\n _allowances[owner][spender] = amount;\r\n emit Approval(owner, spender, amount);\r\n }\r\n function _beforeTokenTransfer(\r\n address from,\r\n address to,\r\n uint256 amount\r\n ) internal virtual {}\r\n}\r\n\r\ncontract Ownable is Context {\r\n address private _owner;\r\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\r\n constructor () {\r\n address msgSender = _msgSender();\r\n _owner = msgSender;\r\n emit OwnershipTransferred(address(0), msgSender);\r\n }\r\n function owner() public view returns (address) {\r\n return _owner;\r\n }\r\n modifier onlyOwner() {\r\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\r\n _;\r\n }\r\n function renounceOwnership() public virtual onlyOwner {\r\n emit OwnershipTransferred(_owner, address(0));\r\n _owner = address(0);\r\n }\r\n function transferOwnership(address newOwner) public virtual onlyOwner {\r\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\r\n emit OwnershipTransferred(_owner, newOwner);\r\n _owner = newOwner;\r\n }\r\n}\r\n\r\ninterface IUniswapV2Router01 {\r\n function factory() external pure returns (address);\r\n function WETH() external pure returns (address);\r\n function addLiquidity(\r\n address tokenA,\r\n address tokenB,\r\n uint amountADesired,\r\n uint amountBDesired,\r\n uint amountAMin,\r\n uint amountBMin,\r\n address to,\r\n uint deadline\r\n ) external returns (uint amountA, uint amountB, uint liquidity);\r\n function addLiquidityETH(\r\n address token,\r\n uint amountTokenDesired,\r\n uint amountTokenMin,\r\n uint amountETHMin,\r\n address to,\r\n uint deadline\r\n ) external payable returns (uint amountToken, uint amountETH, uint liquidity);\r\n function removeLiquidity(\r\n address tokenA,\r\n address tokenB,\r\n uint liquidity,\r\n uint amountAMin,\r\n uint amountBMin,\r\n address to,\r\n uint deadline\r\n ) external returns (uint amountA, uint amountB);\r\n function removeLiquidityETH(\r\n address token,\r\n uint liquidity,\r\n uint amountTokenMin,\r\n uint amountETHMin,\r\n address to,\r\n uint deadline\r\n ) external returns (uint amountToken, uint amountETH);\r\n function removeLiquidityWithPermit(\r\n address tokenA,\r\n address tokenB,\r\n uint liquidity,\r\n uint amountAMin,\r\n uint amountBMin,\r\n address to,\r\n uint deadline,\r\n bool approveMax, uint8 v, bytes32 r, bytes32 s\r\n ) external returns (uint amountA, uint amountB);\r\n function removeLiquidityETHWithPermit(\r\n address token,\r\n uint liquidity,\r\n uint amountTokenMin,\r\n uint amountETHMin,\r\n address to,\r\n uint deadline,\r\n bool approveMax, uint8 v, bytes32 r, bytes32 s\r\n ) external returns (uint amountToken, uint amountETH);\r\n function swapExactTokensForTokens(\r\n uint amountIn,\r\n uint amountOutMin,\r\n address[] calldata path,\r\n address to,\r\n uint deadline\r\n ) external returns (uint[] memory amounts);\r\n function swapTokensForExactTokens(\r\n uint amountOut,\r\n uint amountInMax,\r\n address[] calldata path,\r\n address to,\r\n uint deadline\r\n ) external returns (uint[] memory amounts);\r\n function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)\r\n external\r\n payable\r\n returns (uint[] memory amounts);\r\n function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)\r\n external\r\n returns (uint[] memory amounts);\r\n function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)\r\n external\r\n returns (uint[] memory amounts);\r\n function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)\r\n external\r\n payable\r\n returns (uint[] memory amounts);\r\n function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);\r\n function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);\r\n function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);\r\n function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);\r\n function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);\r\n}\r\n\r\ninterface IUniswapV2Router02 is IUniswapV2Router01 {\r\n function removeLiquidityETHSupportingFeeOnTransferTokens(\r\n address token,\r\n uint liquidity,\r\n uint amountTokenMin,\r\n uint amountETHMin,\r\n address to,\r\n uint deadline\r\n ) external returns (uint amountETH);\r\n function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(\r\n address token,\r\n uint liquidity,\r\n uint amountTokenMin,\r\n uint amountETHMin,\r\n address to,\r\n uint deadline,\r\n bool approveMax, uint8 v, bytes32 r, bytes32 s\r\n ) external returns (uint amountETH);\r\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\r\n uint amountIn,\r\n uint amountOutMin,\r\n address[] calldata path,\r\n address to,\r\n uint deadline\r\n ) external;\r\n function swapExactETHForTokensSupportingFeeOnTransferTokens(\r\n uint amountOutMin,\r\n address[] calldata path,\r\n address to,\r\n uint deadline\r\n ) external payable;\r\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\r\n uint amountIn,\r\n uint amountOutMin,\r\n address[] calldata path,\r\n address to,\r\n uint deadline\r\n ) external;\r\n}\r\n\r\nerror Reentrancy();\r\n\r\nabstract contract ReentrancyGuard {\r\n uint256 private locked = 1;\r\n modifier nonReentrant() {\r\n if (locked != 1) {\r\n revert Reentrancy();\r\n }\r\n locked = 2;\r\n _;\r\n locked = 1;\r\n }\r\n}\r\n\r\ncontract FartingShiba is ERC20, Ownable, ReentrancyGuard, VRFConsumerBaseV2 {\r\n VRFCoordinatorV2Interface private COORDINATOR;\r\n uint64 private s_subscriptionId;\r\n bytes32 private keyHash;\r\n uint32 private callbackGasLimit = 2500000;\r\n uint16 private requestConfirmations = 3;\r\n uint32 private numWords = 1;\r\n\r\n mapping(uint256 => address) private requestIdToSender;\r\n mapping(address => uint256) public userIdFart;\r\n mapping(address => uint256) public betsizeFart;\r\n event betFart(address indexed from, uint amount);\r\n event winFart(address indexed from, uint roll, bool won, uint amount); \r\n\r\n IUniswapV2Router02 public uniswapV2Router;\r\n address public constant deadAddress = address(0xdead);\r\n\r\n bool private swapping;\r\n\r\n address public devWallet;\r\n \r\n uint256 public maxTransactionAmount;\r\n uint256 public swapTokensAtAmount;\r\n uint256 public maxWallet;\r\n\r\n bool public limitsInEffect = true;\r\n bool public tradingActive = false;\r\n bool public swapEnabled = false;\r\n \r\n uint256 public buyTotalFees;\r\n uint256 public buyLiquidityFee;\r\n uint256 public buyDevFee;\r\n \r\n uint256 public sellTotalFees;\r\n uint256 public sellLiquidityFee;\r\n uint256 public sellDevFee;\r\n\r\n uint256 public VRFFee; \r\n \r\n uint256 public tokensForLiquidity;\r\n uint256 public tokensForDev;\r\n \r\n // exlcude from fees and max transaction amount\r\n mapping (address => bool) private _isExcludedFromFees;\r\n mapping (address => bool) public _isExcludedMaxTransactionAmount;\r\n\r\n // store addresses that a automatic market maker pairs. Any transfer *to* these addresses\r\n // could be subject to a maximum transfer amount\r\n mapping (address => bool) public automatedMarketMakerPairs;\r\n\r\n event UpdateUniswapV2Router(address indexed newAddress, address indexed oldAddress);\r\n event ExcludeFromFees(address indexed account, bool isExcluded);\r\n event SetAutomatedMarketMakerPair(address indexed pair, bool indexed value);\r\n event devWalletUpdated(address indexed newWallet, address indexed oldWallet);\r\n event SwapAndLiquify(\r\n uint256 tokensSwapped,\r\n uint256 ethReceived,\r\n uint256 tokensIntoLiquidity\r\n );\r\n\r\n constructor(uint64 subscriptionId) ERC20(\"Farting Shiba\", \"FART\") VRFConsumerBaseV2(0x271682DEB8C4E0901D1a1550aD2e64D568E69909) {\r\n COORDINATOR = VRFCoordinatorV2Interface(0x271682DEB8C4E0901D1a1550aD2e64D568E69909);\r\n s_subscriptionId = subscriptionId;\r\n keyHash = 0x8af398995b04c28e9951adb9721ef74c74f93e6a478f39e7e0777be13527e7ef;\r\n\r\n IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\r\n \r\n excludeFromMaxTransaction(address(_uniswapV2Router), true);\r\n uniswapV2Router = _uniswapV2Router;\r\n \r\n uint256 _buyLiquidityFee = 0;\r\n uint256 _buyDevFee = 3;\r\n uint256 _sellLiquidityFee = 4;\r\n uint256 _sellDevFee = 3;\r\n\r\n uint256 _VRFFee = 0.0011 ether;\r\n \r\n uint256 totalSupply = 1000000 * 1e18;\r\n \r\n maxTransactionAmount = totalSupply * 5 / 100; // 5% maxTransactionAmountTxn\r\n maxWallet = totalSupply * 5 / 100; // 5% maxWallet\r\n swapTokensAtAmount = totalSupply * 5 / 10000; // 0.05% swap wallet\r\n\r\n buyLiquidityFee = _buyLiquidityFee;\r\n buyDevFee = _buyDevFee;\r\n buyTotalFees = buyLiquidityFee + buyDevFee;\r\n \r\n sellLiquidityFee = _sellLiquidityFee;\r\n sellDevFee = _sellDevFee;\r\n sellTotalFees = sellLiquidityFee + sellDevFee;\r\n\r\n VRFFee = _VRFFee;\r\n \r\n devWallet = address(0x4a20805f146Ea250CDbD51D60BCaC147031D0b6C); // set as dev wallet\r\n\r\n // exclude from paying fees or having max transaction amount\r\n excludeFromFees(owner(), true);\r\n excludeFromFees(address(this), true);\r\n excludeFromFees(address(0xdead), true);\r\n \r\n excludeFromMaxTransaction(owner(), true);\r\n excludeFromMaxTransaction(address(this), true);\r\n excludeFromMaxTransaction(address(0xdead), true);\r\n \r\n _mint(msg.sender, totalSupply);\r\n }\r\n\r\n receive() external payable {}\r\n\r\n function fart(uint256 _amount) nonReentrant public payable {\r\n require(_amount <= totalSupply() / 100, \"Can not fart more than 1% of the supply at a time\");\r\n require(userIdFart[msg.sender] == 0, \"One fart at a time!\");\r\n require(msg.value >= VRFFee, \"Insufficient VRFFee\");\r\n\r\n (bool sent, ) = devWallet.call{value: VRFFee}(\"\");\r\n require(sent, \"Failed to send VRFFee\");\r\n\r\n _burn(msg.sender, _amount);\r\n uint256 requestId = COORDINATOR.requestRandomWords(\r\n keyHash,\r\n s_subscriptionId,\r\n requestConfirmations,\r\n callbackGasLimit,\r\n numWords\r\n );\r\n requestIdToSender[requestId] = msg.sender;\r\n userIdFart[msg.sender] = requestId;\r\n betsizeFart[msg.sender] = (_amount * 199 / 100);\r\n emit betFart(msg.sender, _amount);\r\n }\r\n\r\n function fulfillRandomWords(uint256 requestId, uint256[] memory randomWords) internal override {\r\n address user = requestIdToSender[requestId];\r\n require(user != address(0), \"No game found for the user\");\r\n\r\n uint256 randomNumber = randomWords[0];\r\n\r\n // Fart Game Logic\r\n if (userIdFart[user] == requestId) {\r\n uint256 secretnum = randomNumber % 2;\r\n if (secretnum == 0){\r\n _mint(user, betsizeFart[user]);\r\n emit winFart(user, secretnum, true, betsizeFart[user]);\r\n }\r\n else {\r\n emit winFart(user, secretnum, false, betsizeFart[user]);\r\n }\r\n delete betsizeFart[user];\r\n delete userIdFart[user];\r\n }\r\n }\r\n\r\n function dangerClearCacheFart() public {\r\n delete betsizeFart[msg.sender];\r\n delete userIdFart[msg.sender];\r\n }\r\n\r\n function setRouter(address router) public onlyOwner{\r\n IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(router);\r\n \r\n excludeFromMaxTransaction(address(_uniswapV2Router), true);\r\n uniswapV2Router = _uniswapV2Router;\r\n }\r\n\r\n // once enabled, can never be turned off\r\n function enableTrading() external onlyOwner {\r\n tradingActive = true;\r\n swapEnabled = true;\r\n }\r\n \r\n function removeLimits() external onlyOwner returns (bool){\r\n limitsInEffect = false;\r\n return true;\r\n }\r\n \r\n // change the minimum amount of tokens to sell from fees\r\n function updateSwapTokensAtAmount(uint256 newAmount) external onlyOwner returns (bool){\r\n \t require(newAmount >= totalSupply() * 1 / 100000, \"Swap amount cannot be lower than 0.001% total supply.\");\r\n \t require(newAmount <= totalSupply() * 1 / 100, \"Swap amount cannot be higher than 1% total supply.\");\r\n \t swapTokensAtAmount = newAmount;\r\n \t return true;\r\n \t}\r\n \r\n function updateMaxTxnAmount(uint256 newNum) external onlyOwner {\r\n require(newNum >= (totalSupply() * 1 / 1000)/1e18, \"Cannot set maxTransactionAmount lower than 0.1%\");\r\n maxTransactionAmount = newNum * (10**18);\r\n }\r\n\r\n function updateMaxWalletAmount(uint256 newNum) external onlyOwner {\r\n require(newNum >= (totalSupply() * 5 / 1000)/1e18, \"Cannot set maxWallet lower than 0.5%\");\r\n maxWallet = newNum * (10**18);\r\n }\r\n \r\n function excludeFromMaxTransaction(address updAds, bool isEx) public onlyOwner {\r\n _isExcludedMaxTransactionAmount[updAds] = isEx;\r\n }\r\n \r\n // only use to disable contract sales if absolutely necessary (emergency use only)\r\n function updateSwapEnabled(bool enabled) external onlyOwner(){\r\n swapEnabled = enabled;\r\n }\r\n \r\n function updateBuyFees(uint256 _liquidityFee, uint256 _devFee) external onlyOwner {\r\n buyLiquidityFee = _liquidityFee;\r\n buyDevFee = _devFee;\r\n buyTotalFees = buyLiquidityFee + buyDevFee;\r\n require(buyTotalFees <= 20, \"Must keep fees at 20% or less\");\r\n }\r\n \r\n function updateSellFees(uint256 _liquidityFee, uint256 _devFee) external onlyOwner {\r\n sellLiquidityFee = _liquidityFee;\r\n sellDevFee = _devFee;\r\n sellTotalFees = sellLiquidityFee + sellDevFee;\r\n require(sellTotalFees <= 25, \"Must keep fees at 25% or less\");\r\n }\r\n\r\n function updateVRFFee(uint256 _newFee) external onlyOwner {\r\n require(_newFee <= 0.1 ether, \"Must keep VRF fee <= 0.1 ETH\");\r\n VRFFee = _newFee;\r\n }\r\n\r\n function excludeFromFees(address account, bool excluded) public onlyOwner {\r\n _isExcludedFromFees[account] = excluded;\r\n emit ExcludeFromFees(account, excluded);\r\n }\r\n\r\n function setAutomatedMarketMakerPair(address pair, bool value) public onlyOwner {\r\n _setAutomatedMarketMakerPair(pair, value);\r\n }\r\n\r\n function _setAutomatedMarketMakerPair(address pair, bool value) private {\r\n automatedMarketMakerPairs[pair] = value;\r\n\r\n emit SetAutomatedMarketMakerPair(pair, value);\r\n }\r\n \r\n function updateDevWallet(address newWallet) external onlyOwner {\r\n emit devWalletUpdated(newWallet, devWallet);\r\n devWallet = newWallet;\r\n }\r\n \r\n function isExcludedFromFees(address account) public view returns(bool) {\r\n return _isExcludedFromFees[account];\r\n }\r\n \r\n function _transfer(\r\n address from,\r\n address to,\r\n uint256 amount\r\n ) internal override {\r\n require(from != address(0), \"ERC20: transfer from the zero address\");\r\n require(to != address(0), \"ERC20: transfer to the zero address\");\r\n \r\n if(amount == 0) {\r\n super._transfer(from, to, 0);\r\n return;\r\n }\r\n \r\n if(limitsInEffect){\r\n if (\r\n from != owner() &&\r\n to != owner() &&\r\n to != address(0) &&\r\n to != address(0xdead) &&\r\n !swapping\r\n ){\r\n if(!tradingActive){\r\n require(_isExcludedFromFees[from] || _isExcludedFromFees[to], \"Trading is not active.\");\r\n }\r\n\r\n //when buy\r\n if (automatedMarketMakerPairs[from] && !_isExcludedMaxTransactionAmount[to]) {\r\n require(amount <= maxTransactionAmount, \"Buy transfer amount exceeds the maxTransactionAmount.\");\r\n require(amount + balanceOf(to) <= maxWallet, \"Max wallet exceeded\");\r\n }\r\n \r\n //when sell\r\n else if (automatedMarketMakerPairs[to] && !_isExcludedMaxTransactionAmount[from]) {\r\n require(amount <= maxTransactionAmount, \"Sell transfer amount exceeds the maxTransactionAmount.\");\r\n }\r\n else if(!_isExcludedMaxTransactionAmount[to]){\r\n require(amount + balanceOf(to) <= maxWallet, \"Max wallet exceeded\");\r\n }\r\n }\r\n }\r\n \r\n\t\tuint256 contractTokenBalance = balanceOf(address(this));\r\n \r\n bool canSwap = contractTokenBalance >= swapTokensAtAmount;\r\n\r\n if( \r\n canSwap &&\r\n swapEnabled &&\r\n !swapping &&\r\n !automatedMarketMakerPairs[from] &&\r\n !_isExcludedFromFees[from] &&\r\n !_isExcludedFromFees[to]\r\n ) {\r\n swapping = true; \r\n swapBack();\r\n swapping = false;\r\n }\r\n bool takeFee = !swapping;\r\n\r\n // if any account belongs to _isExcludedFromFee account then remove the fee\r\n if(_isExcludedFromFees[from] || _isExcludedFromFees[to]) {\r\n takeFee = false;\r\n }\r\n \r\n uint256 fees = 0;\r\n // only take fees on buys/sells, do not take on wallet transfers\r\n if(takeFee){\r\n // on sell\r\n if (automatedMarketMakerPairs[to] && sellTotalFees > 0){\r\n fees = amount * sellTotalFees / 100;\r\n tokensForLiquidity += fees * sellLiquidityFee / sellTotalFees;\r\n tokensForDev += fees * sellDevFee / sellTotalFees;\r\n }\r\n // on buy\r\n else if(automatedMarketMakerPairs[from] && buyTotalFees > 0) {\r\n \t fees = amount * buyTotalFees / 100;\r\n \t tokensForLiquidity += fees * buyLiquidityFee / buyTotalFees;\r\n tokensForDev += fees * buyDevFee / buyTotalFees;\r\n } \r\n if(fees > 0){ \r\n super._transfer(from, address(this), fees);\r\n } \t\r\n \tamount -= fees;\r\n }\r\n super._transfer(from, to, amount);\r\n }\r\n\r\n function swapTokensForEth(uint256 tokenAmount) private {\r\n\r\n // generate the uniswap pair path of token -> WETH\r\n address[] memory path = new address[](2);\r\n path[0] = address(this);\r\n path[1] = uniswapV2Router.WETH();\r\n\r\n _approve(address(this), address(uniswapV2Router), tokenAmount);\r\n\r\n // make the swap\r\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\r\n tokenAmount,\r\n 0, // accept any amount of ETH\r\n path,\r\n address(this),\r\n block.timestamp\r\n );\r\n }\r\n \r\n function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {\r\n // approve token transfer to cover all possible scenarios\r\n _approve(address(this), address(uniswapV2Router), tokenAmount);\r\n\r\n // add the liquidity\r\n uniswapV2Router.addLiquidityETH{value: ethAmount}(\r\n address(this),\r\n tokenAmount,\r\n 0, // slippage is unavoidable\r\n 0, // slippage is unavoidable\r\n devWallet,\r\n block.timestamp\r\n );\r\n }\r\n\r\n function swapBack() private {\r\n uint256 contractBalance = balanceOf(address(this));\r\n uint256 totalTokensToSwap = tokensForLiquidity + tokensForDev;\r\n bool success;\r\n \r\n if(contractBalance == 0 || totalTokensToSwap == 0) {return;}\r\n\r\n if(contractBalance > swapTokensAtAmount * 20){\r\n contractBalance = swapTokensAtAmount * 20;\r\n }\r\n \r\n // Halve the amount of liquidity tokens\r\n uint256 liquidityTokens = contractBalance * tokensForLiquidity / totalTokensToSwap / 2;\r\n uint256 amountToSwapForETH = contractBalance - liquidityTokens;\r\n \r\n uint256 initialETHBalance = address(this).balance;\r\n\r\n swapTokensForEth(amountToSwapForETH); \r\n \r\n uint256 ethBalance = address(this).balance - initialETHBalance;\r\n \r\n uint256 ethForDev = ethBalance * tokensForDev / totalTokensToSwap;\r\n \r\n uint256 ethForLiquidity = ethBalance - ethForDev;\r\n \r\n tokensForLiquidity = 0;\r\n tokensForDev = 0;\r\n \r\n (success,) = address(devWallet).call{value: ethForDev}(\"\");\r\n \r\n if(liquidityTokens > 0 && ethForLiquidity > 0){\r\n addLiquidity(liquidityTokens, ethForLiquidity);\r\n emit SwapAndLiquify(amountToSwapForETH, ethForLiquidity, tokensForLiquidity);\r\n }\r\n (success,) = address(devWallet).call{value: address(this).balance}(\"\");\r\n }\r\n \r\n function payout() public onlyOwner {\r\n payable(msg.sender).transfer(address(this).balance);\r\n }\r\n\r\n function withdrawToken() public onlyOwner {\r\n this.approve(address(this), totalSupply());\r\n this.transferFrom(address(this), owner(), balanceOf(address(this))); \r\n }\r\n}" }, "@chainlink/contracts/src/v0.8/interfaces/VRFCoordinatorV2Interface.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface VRFCoordinatorV2Interface {\n /**\n * @notice Get configuration relevant for making requests\n * @return minimumRequestConfirmations global min for request confirmations\n * @return maxGasLimit global max for request gas limit\n * @return s_provingKeyHashes list of registered key hashes\n */\n function getRequestConfig() external view returns (uint16, uint32, bytes32[] memory);\n\n /**\n * @notice Request a set of random words.\n * @param keyHash - Corresponds to a particular oracle job which uses\n * that key for generating the VRF proof. Different keyHash's have different gas price\n * ceilings, so you can select a specific one to bound your maximum per request cost.\n * @param subId - The ID of the VRF subscription. Must be funded\n * with the minimum subscription balance required for the selected keyHash.\n * @param minimumRequestConfirmations - How many blocks you'd like the\n * oracle to wait before responding to the request. See SECURITY CONSIDERATIONS\n * for why you may want to request more. The acceptable range is\n * [minimumRequestBlockConfirmations, 200].\n * @param callbackGasLimit - How much gas you'd like to receive in your\n * fulfillRandomWords callback. Note that gasleft() inside fulfillRandomWords\n * may be slightly less than this amount because of gas used calling the function\n * (argument decoding etc.), so you may need to request slightly more than you expect\n * to have inside fulfillRandomWords. The acceptable range is\n * [0, maxGasLimit]\n * @param numWords - The number of uint256 random values you'd like to receive\n * in your fulfillRandomWords callback. Note these numbers are expanded in a\n * secure way by the VRFCoordinator from a single random value supplied by the oracle.\n * @return requestId - A unique identifier of the request. Can be used to match\n * a request to a response in fulfillRandomWords.\n */\n function requestRandomWords(\n bytes32 keyHash,\n uint64 subId,\n uint16 minimumRequestConfirmations,\n uint32 callbackGasLimit,\n uint32 numWords\n ) external returns (uint256 requestId);\n\n /**\n * @notice Create a VRF subscription.\n * @return subId - A unique subscription id.\n * @dev You can manage the consumer set dynamically with addConsumer/removeConsumer.\n * @dev Note to fund the subscription, use transferAndCall. For example\n * @dev LINKTOKEN.transferAndCall(\n * @dev address(COORDINATOR),\n * @dev amount,\n * @dev abi.encode(subId));\n */\n function createSubscription() external returns (uint64 subId);\n\n /**\n * @notice Get a VRF subscription.\n * @param subId - ID of the subscription\n * @return balance - LINK balance of the subscription in juels.\n * @return reqCount - number of requests for this subscription, determines fee tier.\n * @return owner - owner of the subscription.\n * @return consumers - list of consumer address which are able to use this subscription.\n */\n function getSubscription(\n uint64 subId\n ) external view returns (uint96 balance, uint64 reqCount, address owner, address[] memory consumers);\n\n /**\n * @notice Request subscription owner transfer.\n * @param subId - ID of the subscription\n * @param newOwner - proposed new owner of the subscription\n */\n function requestSubscriptionOwnerTransfer(uint64 subId, address newOwner) external;\n\n /**\n * @notice Request subscription owner transfer.\n * @param subId - ID of the subscription\n * @dev will revert if original owner of subId has\n * not requested that msg.sender become the new owner.\n */\n function acceptSubscriptionOwnerTransfer(uint64 subId) external;\n\n /**\n * @notice Add a consumer to a VRF subscription.\n * @param subId - ID of the subscription\n * @param consumer - New consumer which can use the subscription\n */\n function addConsumer(uint64 subId, address consumer) external;\n\n /**\n * @notice Remove a consumer from a VRF subscription.\n * @param subId - ID of the subscription\n * @param consumer - Consumer to remove from the subscription\n */\n function removeConsumer(uint64 subId, address consumer) external;\n\n /**\n * @notice Cancel a subscription\n * @param subId - ID of the subscription\n * @param to - Where to send the remaining LINK to\n */\n function cancelSubscription(uint64 subId, address to) external;\n\n /*\n * @notice Check to see if there exists a request commitment consumers\n * for all consumers and keyhashes for a given sub.\n * @param subId - ID of the subscription\n * @return true if there exists at least one unfulfilled request for the subscription, false\n * otherwise.\n */\n function pendingRequestExists(uint64 subId) external view returns (bool);\n}\n" }, "@chainlink/contracts/src/v0.8/VRFConsumerBaseV2.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/** ****************************************************************************\n * @notice Interface for contracts using VRF randomness\n * *****************************************************************************\n * @dev PURPOSE\n *\n * @dev Reggie the Random Oracle (not his real job) wants to provide randomness\n * @dev to Vera the verifier in such a way that Vera can be sure he's not\n * @dev making his output up to suit himself. Reggie provides Vera a public key\n * @dev to which he knows the secret key. Each time Vera provides a seed to\n * @dev Reggie, he gives back a value which is computed completely\n * @dev deterministically from the seed and the secret key.\n *\n * @dev Reggie provides a proof by which Vera can verify that the output was\n * @dev correctly computed once Reggie tells it to her, but without that proof,\n * @dev the output is indistinguishable to her from a uniform random sample\n * @dev from the output space.\n *\n * @dev The purpose of this contract is to make it easy for unrelated contracts\n * @dev to talk to Vera the verifier about the work Reggie is doing, to provide\n * @dev simple access to a verifiable source of randomness. It ensures 2 things:\n * @dev 1. The fulfillment came from the VRFCoordinator\n * @dev 2. The consumer contract implements fulfillRandomWords.\n * *****************************************************************************\n * @dev USAGE\n *\n * @dev Calling contracts must inherit from VRFConsumerBase, and can\n * @dev initialize VRFConsumerBase's attributes in their constructor as\n * @dev shown:\n *\n * @dev contract VRFConsumer {\n * @dev constructor(<other arguments>, address _vrfCoordinator, address _link)\n * @dev VRFConsumerBase(_vrfCoordinator) public {\n * @dev <initialization with other arguments goes here>\n * @dev }\n * @dev }\n *\n * @dev The oracle will have given you an ID for the VRF keypair they have\n * @dev committed to (let's call it keyHash). Create subscription, fund it\n * @dev and your consumer contract as a consumer of it (see VRFCoordinatorInterface\n * @dev subscription management functions).\n * @dev Call requestRandomWords(keyHash, subId, minimumRequestConfirmations,\n * @dev callbackGasLimit, numWords),\n * @dev see (VRFCoordinatorInterface for a description of the arguments).\n *\n * @dev Once the VRFCoordinator has received and validated the oracle's response\n * @dev to your request, it will call your contract's fulfillRandomWords method.\n *\n * @dev The randomness argument to fulfillRandomWords is a set of random words\n * @dev generated from your requestId and the blockHash of the request.\n *\n * @dev If your contract could have concurrent requests open, you can use the\n * @dev requestId returned from requestRandomWords to track which response is associated\n * @dev with which randomness request.\n * @dev See \"SECURITY CONSIDERATIONS\" for principles to keep in mind,\n * @dev if your contract could have multiple requests in flight simultaneously.\n *\n * @dev Colliding `requestId`s are cryptographically impossible as long as seeds\n * @dev differ.\n *\n * *****************************************************************************\n * @dev SECURITY CONSIDERATIONS\n *\n * @dev A method with the ability to call your fulfillRandomness method directly\n * @dev could spoof a VRF response with any random value, so it's critical that\n * @dev it cannot be directly called by anything other than this base contract\n * @dev (specifically, by the VRFConsumerBase.rawFulfillRandomness method).\n *\n * @dev For your users to trust that your contract's random behavior is free\n * @dev from malicious interference, it's best if you can write it so that all\n * @dev behaviors implied by a VRF response are executed *during* your\n * @dev fulfillRandomness method. If your contract must store the response (or\n * @dev anything derived from it) and use it later, you must ensure that any\n * @dev user-significant behavior which depends on that stored value cannot be\n * @dev manipulated by a subsequent VRF request.\n *\n * @dev Similarly, both miners and the VRF oracle itself have some influence\n * @dev over the order in which VRF responses appear on the blockchain, so if\n * @dev your contract could have multiple VRF requests in flight simultaneously,\n * @dev you must ensure that the order in which the VRF responses arrive cannot\n * @dev be used to manipulate your contract's user-significant behavior.\n *\n * @dev Since the block hash of the block which contains the requestRandomness\n * @dev call is mixed into the input to the VRF *last*, a sufficiently powerful\n * @dev miner could, in principle, fork the blockchain to evict the block\n * @dev containing the request, forcing the request to be included in a\n * @dev different block with a different hash, and therefore a different input\n * @dev to the VRF. However, such an attack would incur a substantial economic\n * @dev cost. This cost scales with the number of blocks the VRF oracle waits\n * @dev until it calls responds to a request. It is for this reason that\n * @dev that you can signal to an oracle you'd like them to wait longer before\n * @dev responding to the request (however this is not enforced in the contract\n * @dev and so remains effective only in the case of unmodified oracle software).\n */\nabstract contract VRFConsumerBaseV2 {\n error OnlyCoordinatorCanFulfill(address have, address want);\n address private immutable vrfCoordinator;\n\n /**\n * @param _vrfCoordinator address of VRFCoordinator contract\n */\n constructor(address _vrfCoordinator) {\n vrfCoordinator = _vrfCoordinator;\n }\n\n /**\n * @notice fulfillRandomness handles the VRF response. Your contract must\n * @notice implement it. See \"SECURITY CONSIDERATIONS\" above for important\n * @notice principles to keep in mind when implementing your fulfillRandomness\n * @notice method.\n *\n * @dev VRFConsumerBaseV2 expects its subcontracts to have a method with this\n * @dev signature, and will call it once it has verified the proof\n * @dev associated with the randomness. (It is triggered via a call to\n * @dev rawFulfillRandomness, below.)\n *\n * @param requestId The Id initially returned by requestRandomness\n * @param randomWords the VRF output expanded to the requested number of words\n */\n function fulfillRandomWords(uint256 requestId, uint256[] memory randomWords) internal virtual;\n\n // rawFulfillRandomness is called by VRFCoordinator when it receives a valid VRF\n // proof. rawFulfillRandomness then calls fulfillRandomness, after validating\n // the origin of the call\n function rawFulfillRandomWords(uint256 requestId, uint256[] memory randomWords) external {\n if (msg.sender != vrfCoordinator) {\n revert OnlyCoordinatorCanFulfill(msg.sender, vrfCoordinator);\n }\n fulfillRandomWords(requestId, randomWords);\n }\n}\n" } }, "settings": { "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } } }}
1
20,290,542
0fb9a9d3925cf557463ff2570bc53c03a209f7c246a2bac2f786a70972c4e910
65fa2b575028b537be87d28340e3704415c9e477507042a01802cef76d4d94b4
bfbcdd04dda68cfcfba2d687ffce365fd46d5f5f
bfbcdd04dda68cfcfba2d687ffce365fd46d5f5f
33ef91167e9a0cb8b948a7961a5b1a49e773c28d
608060405260176006556019600755600560085560146009556014600a556019600b556014600c556000600d556009600a6200003c919062000348565b6200004c906301312d0062000360565b600e556200005d6009600a62000348565b6200006d906301312d0062000360565b600f556200007e6009600a62000348565b6200008d90621e848062000360565b6010556200009e6009600a62000348565b620000ae906301312d0062000360565b6011556013805461ffff60a81b1916905560006014819055601555348015620000d657600080fd5b50600080546001600160a01b031916339081178255604051909182917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350600580546001600160a01b03191633179055620001386009600a62000348565b6200014890633b9aca0062000360565b336000908152600160208190526040822092909255600390620001736000546001600160a01b031690565b6001600160a01b03908116825260208083019390935260409182016000908120805495151560ff199687161790553081526003909352818320805485166001908117909155600554909116835291208054909216179055620001d23390565b6001600160a01b031660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6200020c6009600a62000348565b6200021c90633b9aca0062000360565b60405190815260200160405180910390a36200037a565b634e487b7160e01b600052601160045260246000fd5b600181815b808511156200028a5781600019048211156200026e576200026e62000233565b808516156200027c57918102915b93841c93908002906200024e565b509250929050565b600082620002a35750600162000342565b81620002b25750600062000342565b8160018114620002cb5760028114620002d657620002f6565b600191505062000342565b60ff841115620002ea57620002ea62000233565b50506001821b62000342565b5060208310610133831016604e8410600b84101617156200031b575081810a62000342565b62000327838362000249565b80600019048211156200033e576200033e62000233565b0290505b92915050565b60006200035960ff84168362000292565b9392505050565b808202811582820484141762000342576200034262000233565b6120a6806200038a6000396000f3fe60806040526004361061014f5760003560e01c8063751039fc116100b6578063b054b5361161006f578063b054b536146103de578063bf474bed146103fe578063c9567bf914610414578063d34628cc14610429578063dd62ed3e14610449578063ec1f3f631461048f57600080fd5b8063751039fc146103265780637d1db4a51461033b5780638da5cb5b146103515780638f9a55c01461037957806395d89b411461038f578063a9059cbb146103be57600080fd5b806331c2d8471161010857806331c2d8471461024b5780633bbac5791461026d5780634782f779146102a657806351bc3c85146102c657806370a08231146102db578063715018a61461031157600080fd5b806306fdde031461015b578063095ea7b3146101a65780630faee56f146101d657806318160ddd146101fa57806323b872dd1461020f578063313ce5671461022f57600080fd5b3661015657005b600080fd5b34801561016757600080fd5b5060408051808201909152601081526f26baba30b73a102137bcb99021b63ab160811b60208201525b60405161019d9190611b55565b60405180910390f35b3480156101b257600080fd5b506101c66101c1366004611bcc565b6104af565b604051901515815260200161019d565b3480156101e257600080fd5b506101ec60115481565b60405190815260200161019d565b34801561020657600080fd5b506101ec6104c6565b34801561021b57600080fd5b506101c661022a366004611bf8565b6104e7565b34801561023b57600080fd5b506040516009815260200161019d565b34801561025757600080fd5b5061026b610266366004611c4f565b610550565b005b34801561027957600080fd5b506101c6610288366004611d14565b6001600160a01b031660009081526004602052604090205460ff1690565b3480156102b257600080fd5b5061026b6102c1366004611bcc565b6105e5565b3480156102d257600080fd5b5061026b61069a565b3480156102e757600080fd5b506101ec6102f6366004611d14565b6001600160a01b031660009081526001602052604090205490565b34801561031d57600080fd5b5061026b6106e9565b34801561033257600080fd5b5061026b61075d565b34801561034757600080fd5b506101ec600e5481565b34801561035d57600080fd5b506000546040516001600160a01b03909116815260200161019d565b34801561038557600080fd5b506101ec600f5481565b34801561039b57600080fd5b5060408051808201909152600681526526a121a62aa160d11b6020820152610190565b3480156103ca57600080fd5b506101c66103d9366004611bcc565b61080f565b3480156103ea57600080fd5b5061026b6103f9366004611d14565b61081c565b34801561040a57600080fd5b506101ec60105481565b34801561042057600080fd5b5061026b610945565b34801561043557600080fd5b5061026b610444366004611c4f565b61100a565b34801561045557600080fd5b506101ec610464366004611d31565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b34801561049b57600080fd5b5061026b6104aa366004611d6a565b611092565b60006104bc3384846110d9565b5060015b92915050565b60006104d46009600a611e7d565b6104e290633b9aca00611e8c565b905090565b60006104f48484846111fd565b610546843361054185604051806060016040528060288152602001612049602891396001600160a01b038a16600090815260026020908152604080832033845290915290205491906117b8565b6110d9565b5060019392505050565b6000546001600160a01b031633146105835760405162461bcd60e51b815260040161057a90611ea3565b60405180910390fd5b60005b81518110156105e1576000600460008484815181106105a7576105a7611ed8565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055600101610586565b5050565b6000546001600160a01b0316331461060f5760405162461bcd60e51b815260040161057a90611ea3565b8047101561065f5760405162461bcd60e51b815260206004820152601860248201527f496e73756666696369656e74204554482062616c616e63650000000000000000604482015260640161057a565b6040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015610695573d6000803e3d6000fd5b505050565b6005546001600160a01b0316336001600160a01b0316146106ba57600080fd5b3060009081526001602052604090205480156106d9576106d9816117f2565b4780156105e1576105e18161196c565b6000546001600160a01b031633146107135760405162461bcd60e51b815260040161057a90611ea3565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146107875760405162461bcd60e51b815260040161057a90611ea3565b6107936009600a611e7d565b6107a190633b9aca00611e8c565b600e556107b06009600a611e7d565b6107be90633b9aca00611e8c565b600f557f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6107ee6009600a611e7d565b6107fc90633b9aca00611e8c565b60405190815260200160405180910390a1565b60006104bc3384846111fd565b6000546001600160a01b031633146108465760405162461bcd60e51b815260040161057a90611ea3565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa15801561088d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108b19190611eee565b9050816001600160a01b031663a9059cbb6108d46000546001600160a01b031690565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018490526044016020604051808303816000875af1158015610921573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106959190611f07565b6000546001600160a01b0316331461096f5760405162461bcd60e51b815260040161057a90611ea3565b601354600160a01b900460ff16156109c95760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161057a565b601280546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610a12903090610a046009600a611e7d565b61054190633b9aca00611e8c565b6012546040805163c45a015560e01b815290516000926001600160a01b03169163c45a01559160048083019260209291908290030181865afa158015610a5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a809190611f29565b6001600160a01b031663e6a43905601260009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ae1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b059190611f29565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152306024820152604401602060405180830381865afa158015610b4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b739190611f29565b6001600160a01b031603610d1457601260009054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610bd4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bf89190611f29565b6001600160a01b031663c9c6539630601260009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c7e9190611f29565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610ccb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cef9190611f29565b601380546001600160a01b0319166001600160a01b0392909216919091179055610e9f565b601260009054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d67573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d8b9190611f29565b6001600160a01b031663e6a43905601260009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610dec573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e109190611f29565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152306024820152604401602060405180830381865afa158015610e5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7e9190611f29565b601380546001600160a01b0319166001600160a01b03929092169190911790555b6012546001600160a01b031663f305d7194730610ed1816001600160a01b031660009081526001602052604090205490565b600080610ee66000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610f4e573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f739190611f46565b505060135460125460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610fcc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff09190611f07565b506013805462ff00ff60a01b19166201000160a01b179055565b6000546001600160a01b031633146110345760405162461bcd60e51b815260040161057a90611ea3565b60005b81518110156105e15760016004600084848151811061105857611058611ed8565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055600101611037565b6005546001600160a01b0316336001600160a01b0316146110b257600080fd5b60085481111580156110c657506009548111155b6110cf57600080fd5b6008819055600955565b6001600160a01b03831661113b5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161057a565b6001600160a01b03821661119c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161057a565b6001600160a01b0383811660008181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166112615760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161057a565b6001600160a01b0382166112c35760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161057a565b600081116113255760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161057a565b600080546001600160a01b0385811691161480159061135257506000546001600160a01b03848116911614155b15611675576001600160a01b03841660009081526004602052604090205460ff1615801561139957506001600160a01b03831660009081526004602052604090205460ff16155b6113a257600080fd5b6113ce60646113c8600a54600d54116113bd576006546113c1565b6008545b85906119a6565b90611a2f565b6013549091506001600160a01b0385811691161480156113fc57506012546001600160a01b03848116911614155b801561142157506001600160a01b03831660009081526003602052604090205460ff16155b1561150957600e548211156114785760405162461bcd60e51b815260206004820152601960248201527f4578636565647320746865205f6d61785478416d6f756e742e00000000000000604482015260640161057a565b600f548261149b856001600160a01b031660009081526001602052604090205490565b6114a59190611f74565b11156114f35760405162461bcd60e51b815260206004820152601a60248201527f4578636565647320746865206d617857616c6c657453697a652e000000000000604482015260640161057a565b600d805490600061150383611f87565b91905055505b6013546001600160a01b03848116911614801561152f57506001600160a01b0384163014155b1561155c5761155960646113c8600b54600d541161154f576007546113c1565b60095485906119a6565b90505b30600090815260016020526040902054601354600160a81b900460ff1615801561159357506013546001600160a01b038581169116145b80156115a85750601354600160b01b900460ff165b80156115b5575060105481115b80156115c45750600c54600d54115b15611673576015544311156115d95760006014555b60036014541061162b5760405162461bcd60e51b815260206004820152601760248201527f4f6e6c7920332073656c6c732070657220626c6f636b21000000000000000000604482015260640161057a565b6116486116438461163e84601154611a71565b611a71565b6117f2565b478015611658576116584761196c565b6014805490600061166883611f87565b909155505043601555505b505b80156116ef57306000908152600160205260409020546116959082611a86565b30600081815260016020526040908190209290925590516001600160a01b038616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906116e69085815260200190565b60405180910390a35b6001600160a01b0384166000908152600160205260409020546117129083611ae5565b6001600160a01b0385166000908152600160205260409020556117576117388383611ae5565b6001600160a01b03851660009081526001602052604090205490611a86565b6001600160a01b0380851660008181526001602052604090209290925585167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6117a18585611ae5565b60405190815260200160405180910390a350505050565b600081848411156117dc5760405162461bcd60e51b815260040161057a9190611b55565b5060006117e98486611fa0565b95945050505050565b6013805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061183a5761183a611ed8565b6001600160a01b03928316602091820292909201810191909152601254604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611893573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118b79190611f29565b816001815181106118ca576118ca611ed8565b6001600160a01b0392831660209182029290920101526012546118f091309116846110d9565b60125460405163791ac94760e01b81526001600160a01b039091169063791ac94790611929908590600090869030904290600401611fb3565b600060405180830381600087803b15801561194357600080fd5b505af1158015611957573d6000803e3d6000fd5b50506013805460ff60a81b1916905550505050565b6005546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156105e1573d6000803e3d6000fd5b6000826000036119b8575060006104c0565b60006119c48385611e8c565b9050826119d18583612026565b14611a285760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161057a565b9392505050565b6000611a2883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611b27565b6000818311611a805782611a28565b50919050565b600080611a938385611f74565b905083811015611a285760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161057a565b6000611a2883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506117b8565b60008183611b485760405162461bcd60e51b815260040161057a9190611b55565b5060006117e98486612026565b60006020808352835180602085015260005b81811015611b8357858101830151858201604001528201611b67565b506000604082860101526040601f19601f8301168501019250505092915050565b6001600160a01b0381168114611bb957600080fd5b50565b8035611bc781611ba4565b919050565b60008060408385031215611bdf57600080fd5b8235611bea81611ba4565b946020939093013593505050565b600080600060608486031215611c0d57600080fd5b8335611c1881611ba4565b92506020840135611c2881611ba4565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611c6257600080fd5b823567ffffffffffffffff80821115611c7a57600080fd5b818501915085601f830112611c8e57600080fd5b813581811115611ca057611ca0611c39565b8060051b604051601f19603f83011681018181108582111715611cc557611cc5611c39565b604052918252848201925083810185019188831115611ce357600080fd5b938501935b82851015611d0857611cf985611bbc565b84529385019392850192611ce8565b98975050505050505050565b600060208284031215611d2657600080fd5b8135611a2881611ba4565b60008060408385031215611d4457600080fd5b8235611d4f81611ba4565b91506020830135611d5f81611ba4565b809150509250929050565b600060208284031215611d7c57600080fd5b5035919050565b634e487b7160e01b600052601160045260246000fd5b600181815b80851115611dd4578160001904821115611dba57611dba611d83565b80851615611dc757918102915b93841c9390800290611d9e565b509250929050565b600082611deb575060016104c0565b81611df8575060006104c0565b8160018114611e0e5760028114611e1857611e34565b60019150506104c0565b60ff841115611e2957611e29611d83565b50506001821b6104c0565b5060208310610133831016604e8410600b8410161715611e57575081810a6104c0565b611e618383611d99565b8060001904821115611e7557611e75611d83565b029392505050565b6000611a2860ff841683611ddc565b80820281158282048414176104c0576104c0611d83565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b600060208284031215611f0057600080fd5b5051919050565b600060208284031215611f1957600080fd5b81518015158114611a2857600080fd5b600060208284031215611f3b57600080fd5b8151611a2881611ba4565b600080600060608486031215611f5b57600080fd5b8351925060208401519150604084015190509250925092565b808201808211156104c0576104c0611d83565b600060018201611f9957611f99611d83565b5060010190565b818103818111156104c0576104c0611d83565b600060a08201878352602087602085015260a0604085015281875180845260c08601915060208901935060005b818110156120055784516001600160a01b031683529383019391830191600101611fe0565b50506001600160a01b03969096166060850152505050608001529392505050565b60008261204357634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122082cf5f54e1986bd958d70bcceb0b86c65c20896b4bca4a8dc3f27861de838cf764736f6c63430008170033
60806040526004361061014f5760003560e01c8063751039fc116100b6578063b054b5361161006f578063b054b536146103de578063bf474bed146103fe578063c9567bf914610414578063d34628cc14610429578063dd62ed3e14610449578063ec1f3f631461048f57600080fd5b8063751039fc146103265780637d1db4a51461033b5780638da5cb5b146103515780638f9a55c01461037957806395d89b411461038f578063a9059cbb146103be57600080fd5b806331c2d8471161010857806331c2d8471461024b5780633bbac5791461026d5780634782f779146102a657806351bc3c85146102c657806370a08231146102db578063715018a61461031157600080fd5b806306fdde031461015b578063095ea7b3146101a65780630faee56f146101d657806318160ddd146101fa57806323b872dd1461020f578063313ce5671461022f57600080fd5b3661015657005b600080fd5b34801561016757600080fd5b5060408051808201909152601081526f26baba30b73a102137bcb99021b63ab160811b60208201525b60405161019d9190611b55565b60405180910390f35b3480156101b257600080fd5b506101c66101c1366004611bcc565b6104af565b604051901515815260200161019d565b3480156101e257600080fd5b506101ec60115481565b60405190815260200161019d565b34801561020657600080fd5b506101ec6104c6565b34801561021b57600080fd5b506101c661022a366004611bf8565b6104e7565b34801561023b57600080fd5b506040516009815260200161019d565b34801561025757600080fd5b5061026b610266366004611c4f565b610550565b005b34801561027957600080fd5b506101c6610288366004611d14565b6001600160a01b031660009081526004602052604090205460ff1690565b3480156102b257600080fd5b5061026b6102c1366004611bcc565b6105e5565b3480156102d257600080fd5b5061026b61069a565b3480156102e757600080fd5b506101ec6102f6366004611d14565b6001600160a01b031660009081526001602052604090205490565b34801561031d57600080fd5b5061026b6106e9565b34801561033257600080fd5b5061026b61075d565b34801561034757600080fd5b506101ec600e5481565b34801561035d57600080fd5b506000546040516001600160a01b03909116815260200161019d565b34801561038557600080fd5b506101ec600f5481565b34801561039b57600080fd5b5060408051808201909152600681526526a121a62aa160d11b6020820152610190565b3480156103ca57600080fd5b506101c66103d9366004611bcc565b61080f565b3480156103ea57600080fd5b5061026b6103f9366004611d14565b61081c565b34801561040a57600080fd5b506101ec60105481565b34801561042057600080fd5b5061026b610945565b34801561043557600080fd5b5061026b610444366004611c4f565b61100a565b34801561045557600080fd5b506101ec610464366004611d31565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b34801561049b57600080fd5b5061026b6104aa366004611d6a565b611092565b60006104bc3384846110d9565b5060015b92915050565b60006104d46009600a611e7d565b6104e290633b9aca00611e8c565b905090565b60006104f48484846111fd565b610546843361054185604051806060016040528060288152602001612049602891396001600160a01b038a16600090815260026020908152604080832033845290915290205491906117b8565b6110d9565b5060019392505050565b6000546001600160a01b031633146105835760405162461bcd60e51b815260040161057a90611ea3565b60405180910390fd5b60005b81518110156105e1576000600460008484815181106105a7576105a7611ed8565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055600101610586565b5050565b6000546001600160a01b0316331461060f5760405162461bcd60e51b815260040161057a90611ea3565b8047101561065f5760405162461bcd60e51b815260206004820152601860248201527f496e73756666696369656e74204554482062616c616e63650000000000000000604482015260640161057a565b6040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015610695573d6000803e3d6000fd5b505050565b6005546001600160a01b0316336001600160a01b0316146106ba57600080fd5b3060009081526001602052604090205480156106d9576106d9816117f2565b4780156105e1576105e18161196c565b6000546001600160a01b031633146107135760405162461bcd60e51b815260040161057a90611ea3565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146107875760405162461bcd60e51b815260040161057a90611ea3565b6107936009600a611e7d565b6107a190633b9aca00611e8c565b600e556107b06009600a611e7d565b6107be90633b9aca00611e8c565b600f557f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6107ee6009600a611e7d565b6107fc90633b9aca00611e8c565b60405190815260200160405180910390a1565b60006104bc3384846111fd565b6000546001600160a01b031633146108465760405162461bcd60e51b815260040161057a90611ea3565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa15801561088d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108b19190611eee565b9050816001600160a01b031663a9059cbb6108d46000546001600160a01b031690565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018490526044016020604051808303816000875af1158015610921573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106959190611f07565b6000546001600160a01b0316331461096f5760405162461bcd60e51b815260040161057a90611ea3565b601354600160a01b900460ff16156109c95760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161057a565b601280546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610a12903090610a046009600a611e7d565b61054190633b9aca00611e8c565b6012546040805163c45a015560e01b815290516000926001600160a01b03169163c45a01559160048083019260209291908290030181865afa158015610a5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a809190611f29565b6001600160a01b031663e6a43905601260009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ae1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b059190611f29565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152306024820152604401602060405180830381865afa158015610b4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b739190611f29565b6001600160a01b031603610d1457601260009054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610bd4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bf89190611f29565b6001600160a01b031663c9c6539630601260009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c7e9190611f29565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610ccb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cef9190611f29565b601380546001600160a01b0319166001600160a01b0392909216919091179055610e9f565b601260009054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d67573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d8b9190611f29565b6001600160a01b031663e6a43905601260009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610dec573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e109190611f29565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152306024820152604401602060405180830381865afa158015610e5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7e9190611f29565b601380546001600160a01b0319166001600160a01b03929092169190911790555b6012546001600160a01b031663f305d7194730610ed1816001600160a01b031660009081526001602052604090205490565b600080610ee66000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610f4e573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f739190611f46565b505060135460125460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610fcc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff09190611f07565b506013805462ff00ff60a01b19166201000160a01b179055565b6000546001600160a01b031633146110345760405162461bcd60e51b815260040161057a90611ea3565b60005b81518110156105e15760016004600084848151811061105857611058611ed8565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055600101611037565b6005546001600160a01b0316336001600160a01b0316146110b257600080fd5b60085481111580156110c657506009548111155b6110cf57600080fd5b6008819055600955565b6001600160a01b03831661113b5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161057a565b6001600160a01b03821661119c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161057a565b6001600160a01b0383811660008181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166112615760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161057a565b6001600160a01b0382166112c35760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161057a565b600081116113255760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161057a565b600080546001600160a01b0385811691161480159061135257506000546001600160a01b03848116911614155b15611675576001600160a01b03841660009081526004602052604090205460ff1615801561139957506001600160a01b03831660009081526004602052604090205460ff16155b6113a257600080fd5b6113ce60646113c8600a54600d54116113bd576006546113c1565b6008545b85906119a6565b90611a2f565b6013549091506001600160a01b0385811691161480156113fc57506012546001600160a01b03848116911614155b801561142157506001600160a01b03831660009081526003602052604090205460ff16155b1561150957600e548211156114785760405162461bcd60e51b815260206004820152601960248201527f4578636565647320746865205f6d61785478416d6f756e742e00000000000000604482015260640161057a565b600f548261149b856001600160a01b031660009081526001602052604090205490565b6114a59190611f74565b11156114f35760405162461bcd60e51b815260206004820152601a60248201527f4578636565647320746865206d617857616c6c657453697a652e000000000000604482015260640161057a565b600d805490600061150383611f87565b91905055505b6013546001600160a01b03848116911614801561152f57506001600160a01b0384163014155b1561155c5761155960646113c8600b54600d541161154f576007546113c1565b60095485906119a6565b90505b30600090815260016020526040902054601354600160a81b900460ff1615801561159357506013546001600160a01b038581169116145b80156115a85750601354600160b01b900460ff165b80156115b5575060105481115b80156115c45750600c54600d54115b15611673576015544311156115d95760006014555b60036014541061162b5760405162461bcd60e51b815260206004820152601760248201527f4f6e6c7920332073656c6c732070657220626c6f636b21000000000000000000604482015260640161057a565b6116486116438461163e84601154611a71565b611a71565b6117f2565b478015611658576116584761196c565b6014805490600061166883611f87565b909155505043601555505b505b80156116ef57306000908152600160205260409020546116959082611a86565b30600081815260016020526040908190209290925590516001600160a01b038616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906116e69085815260200190565b60405180910390a35b6001600160a01b0384166000908152600160205260409020546117129083611ae5565b6001600160a01b0385166000908152600160205260409020556117576117388383611ae5565b6001600160a01b03851660009081526001602052604090205490611a86565b6001600160a01b0380851660008181526001602052604090209290925585167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6117a18585611ae5565b60405190815260200160405180910390a350505050565b600081848411156117dc5760405162461bcd60e51b815260040161057a9190611b55565b5060006117e98486611fa0565b95945050505050565b6013805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061183a5761183a611ed8565b6001600160a01b03928316602091820292909201810191909152601254604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611893573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118b79190611f29565b816001815181106118ca576118ca611ed8565b6001600160a01b0392831660209182029290920101526012546118f091309116846110d9565b60125460405163791ac94760e01b81526001600160a01b039091169063791ac94790611929908590600090869030904290600401611fb3565b600060405180830381600087803b15801561194357600080fd5b505af1158015611957573d6000803e3d6000fd5b50506013805460ff60a81b1916905550505050565b6005546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156105e1573d6000803e3d6000fd5b6000826000036119b8575060006104c0565b60006119c48385611e8c565b9050826119d18583612026565b14611a285760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161057a565b9392505050565b6000611a2883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611b27565b6000818311611a805782611a28565b50919050565b600080611a938385611f74565b905083811015611a285760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161057a565b6000611a2883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506117b8565b60008183611b485760405162461bcd60e51b815260040161057a9190611b55565b5060006117e98486612026565b60006020808352835180602085015260005b81811015611b8357858101830151858201604001528201611b67565b506000604082860101526040601f19601f8301168501019250505092915050565b6001600160a01b0381168114611bb957600080fd5b50565b8035611bc781611ba4565b919050565b60008060408385031215611bdf57600080fd5b8235611bea81611ba4565b946020939093013593505050565b600080600060608486031215611c0d57600080fd5b8335611c1881611ba4565b92506020840135611c2881611ba4565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611c6257600080fd5b823567ffffffffffffffff80821115611c7a57600080fd5b818501915085601f830112611c8e57600080fd5b813581811115611ca057611ca0611c39565b8060051b604051601f19603f83011681018181108582111715611cc557611cc5611c39565b604052918252848201925083810185019188831115611ce357600080fd5b938501935b82851015611d0857611cf985611bbc565b84529385019392850192611ce8565b98975050505050505050565b600060208284031215611d2657600080fd5b8135611a2881611ba4565b60008060408385031215611d4457600080fd5b8235611d4f81611ba4565b91506020830135611d5f81611ba4565b809150509250929050565b600060208284031215611d7c57600080fd5b5035919050565b634e487b7160e01b600052601160045260246000fd5b600181815b80851115611dd4578160001904821115611dba57611dba611d83565b80851615611dc757918102915b93841c9390800290611d9e565b509250929050565b600082611deb575060016104c0565b81611df8575060006104c0565b8160018114611e0e5760028114611e1857611e34565b60019150506104c0565b60ff841115611e2957611e29611d83565b50506001821b6104c0565b5060208310610133831016604e8410600b8410161715611e57575081810a6104c0565b611e618383611d99565b8060001904821115611e7557611e75611d83565b029392505050565b6000611a2860ff841683611ddc565b80820281158282048414176104c0576104c0611d83565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b600060208284031215611f0057600080fd5b5051919050565b600060208284031215611f1957600080fd5b81518015158114611a2857600080fd5b600060208284031215611f3b57600080fd5b8151611a2881611ba4565b600080600060608486031215611f5b57600080fd5b8351925060208401519150604084015190509250925092565b808201808211156104c0576104c0611d83565b600060018201611f9957611f99611d83565b5060010190565b818103818111156104c0576104c0611d83565b600060a08201878352602087602085015260a0604085015281875180845260c08601915060208901935060005b818110156120055784516001600160a01b031683529383019391830191600101611fe0565b50506001600160a01b03969096166060850152505050608001529392505050565b60008261204357634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122082cf5f54e1986bd958d70bcceb0b86c65c20896b4bca4a8dc3f27861de838cf764736f6c63430008170033
{{ "language": "Solidity", "sources": { "src/MBCLUB.sol": { "content": "/*\nPepe, Brett, Landwolf, and Andy stumbled upon a hidden, glowing cave in a forgotten forest. They drank from a mysterious cauldron, instantly transforming into bizarre, grotesque forms... \nMeet their new identities: the Mutant Boy's Club.\n\nhttps://mutantboysclub.xyz/\nhttps://x.com/boysclubmutant\nhttps://t.me/mutantboysclub\n*/\n\npragma solidity 0.8.23;\n\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n}\n\ninterface IERC20 {\n function totalSupply() external view returns (uint256);\n function balanceOf(address account) external view returns (uint256);\n function transfer(address recipient, uint256 amount) external returns (bool);\n function allowance(address owner, address spender) external view returns (uint256);\n function approve(address spender, uint256 amount) external returns (bool);\n function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\n event Transfer(address indexed from, address indexed to, uint256 value);\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n\nlibrary SafeMath {\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a, \"SafeMath: addition overflow\");\n return c;\n }\n\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return sub(a, b, \"SafeMath: subtraction overflow\");\n }\n\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n require(b <= a, errorMessage);\n uint256 c = a - b;\n return c;\n }\n\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n uint256 c = a * b;\n require(c / a == b, \"SafeMath: multiplication overflow\");\n return c;\n }\n\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return div(a, b, \"SafeMath: division by zero\");\n }\n\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n require(b > 0, errorMessage);\n uint256 c = a / b;\n return c;\n }\n\n}\n\ncontract Ownable is Context {\n address private _owner;\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n constructor () {\n address msgSender = _msgSender();\n _owner = msgSender;\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n function owner() public view returns (address) {\n return _owner;\n }\n\n modifier onlyOwner() {\n require(_owner == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n _owner = address(0);\n }\n\n}\n\ninterface IUniswapV2Factory {\n function createPair(address tokenA, address tokenB) external returns (address pair);\n function getPair(address tokenA, address tokenB) external view returns (address pair);\n}\n\ninterface IUniswapV2Router02 {\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n function factory() external pure returns (address);\n function WETH() external pure returns (address);\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n ) external payable returns (uint amountToken, uint amountETH, uint liquidity);\n}\n\ncontract MBCLUB is Context, IERC20, Ownable {\n using SafeMath for uint256;\n mapping (address => uint256) private _balances;\n mapping (address => mapping (address => uint256)) private _allowances;\n mapping (address => bool) private _isExcludedFromFee;\n mapping (address => bool) private bots;\n address payable private _taxWallet;\n\n uint256 private _initialBuyTax=23;\n uint256 private _initialSellTax=25;\n uint256 private _finalBuyTax=5;\n uint256 private _finalSellTax=20;\n uint256 private _reduceBuyTaxAt=20;\n uint256 private _reduceSellTaxAt=25;\n uint256 private _preventSwapBefore=20;\n uint256 private _buyCount=0;\n\n uint8 private constant _decimals = 9;\n uint256 private constant _tTotal = 1_000_000_000 * 10**_decimals;\n string private constant _name = unicode\"Mutant Boys Club\";\n string private constant _symbol = unicode\"MBCLUB\";\n uint256 public _maxTxAmount = 20_000_000 * 10**_decimals;\n uint256 public _maxWalletSize = 20_000_000 * 10**_decimals;\n uint256 public _taxSwapThreshold= 2_000_000 * 10**_decimals;\n uint256 public _maxTaxSwap= 20_000_000 * 10**_decimals;\n \n IUniswapV2Router02 private uniswapV2Router;\n address private uniswapV2Pair;\n bool private tradingOpen;\n bool private inSwap = false;\n bool private swapEnabled = false;\n uint256 private sellCount = 0;\n uint256 private lastSellBlock = 0;\n event MaxTxAmountUpdated(uint _maxTxAmount);\n modifier lockTheSwap {\n inSwap = true;\n _;\n inSwap = false;\n }\n\n constructor () {\n _taxWallet = payable(_msgSender());\n _balances[_msgSender()] = _tTotal;\n _isExcludedFromFee[owner()] = true;\n _isExcludedFromFee[address(this)] = true;\n _isExcludedFromFee[_taxWallet] = true;\n\n emit Transfer(address(0), _msgSender(), _tTotal);\n }\n\n function name() public pure returns (string memory) {\n return _name;\n }\n\n function symbol() public pure returns (string memory) {\n return _symbol;\n }\n\n function decimals() public pure returns (uint8) {\n return _decimals;\n }\n\n function totalSupply() public pure override returns (uint256) {\n return _tTotal;\n }\n\n function balanceOf(address account) public view override returns (uint256) {\n return _balances[account];\n }\n\n function transfer(address recipient, uint256 amount) public override returns (bool) {\n _transfer(_msgSender(), recipient, amount);\n return true;\n }\n\n function allowance(address owner, address spender) public view override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n function approve(address spender, uint256 amount) public override returns (bool) {\n _approve(_msgSender(), spender, amount);\n return true;\n }\n\n function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {\n _transfer(sender, recipient, amount);\n _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, \"ERC20: transfer amount exceeds allowance\"));\n return true;\n }\n\n function _approve(address owner, address spender, uint256 amount) private {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n function _transfer(address from, address to, uint256 amount) private {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n require(amount > 0, \"Transfer amount must be greater than zero\");\n uint256 taxAmount=0;\n if (from != owner() && to != owner()) {\n require(!bots[from] && !bots[to]);\n taxAmount = amount.mul((_buyCount>_reduceBuyTaxAt)?_finalBuyTax:_initialBuyTax).div(100);\n\n if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] ) {\n require(amount <= _maxTxAmount, \"Exceeds the _maxTxAmount.\");\n require(balanceOf(to) + amount <= _maxWalletSize, \"Exceeds the maxWalletSize.\");\n _buyCount++;\n }\n\n if(to == uniswapV2Pair && from!= address(this) ){\n taxAmount = amount.mul((_buyCount>_reduceSellTaxAt)?_finalSellTax:_initialSellTax).div(100);\n }\n\n uint256 contractTokenBalance = balanceOf(address(this));\n if (!inSwap && to == uniswapV2Pair && swapEnabled && contractTokenBalance > _taxSwapThreshold && _buyCount > _preventSwapBefore) {\n if (block.number > lastSellBlock) {\n sellCount = 0;\n }\n require(sellCount < 3, \"Only 3 sells per block!\");\n swapTokensForEth(min(amount, min(contractTokenBalance, _maxTaxSwap)));\n uint256 contractETHBalance = address(this).balance;\n if (contractETHBalance > 0) {\n sendETHToFee(address(this).balance);\n }\n sellCount++;\n lastSellBlock = block.number;\n }\n }\n\n if(taxAmount>0){\n _balances[address(this)]=_balances[address(this)].add(taxAmount);\n emit Transfer(from, address(this),taxAmount);\n }\n _balances[from]=_balances[from].sub(amount);\n _balances[to]=_balances[to].add(amount.sub(taxAmount));\n emit Transfer(from, to, amount.sub(taxAmount));\n }\n\n\n function min(uint256 a, uint256 b) private pure returns (uint256){\n return (a>b)?b:a;\n }\n\n function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {\n address[] memory path = new address[](2);\n path[0] = address(this);\n path[1] = uniswapV2Router.WETH();\n _approve(address(this), address(uniswapV2Router), tokenAmount);\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\n tokenAmount,\n 0,\n path,\n address(this),\n block.timestamp\n );\n }\n\n function removeLimits() external onlyOwner{\n _maxTxAmount = _tTotal;\n _maxWalletSize=_tTotal;\n emit MaxTxAmountUpdated(_tTotal);\n }\n\n function sendETHToFee(uint256 amount) private {\n _taxWallet.transfer(amount);\n }\n\n function withdrawETH(address payable to, uint256 amount) external onlyOwner {\n require(address(this).balance >= amount, \"Insufficient ETH balance\");\n to.transfer(amount);\n }\n\n function addBots(address[] memory bots_) public onlyOwner {\n for (uint i = 0; i < bots_.length; i++) {\n bots[bots_[i]] = true;\n }\n }\n\n function delBots(address[] memory notbot) public onlyOwner {\n for (uint i = 0; i < notbot.length; i++) {\n bots[notbot[i]] = false;\n }\n }\n\n function isBot(address a) public view returns (bool){\n return bots[a];\n }\n\n function openTrading() external onlyOwner() {\n require(!tradingOpen,\"trading is already open\");\n uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);\n _approve(address(this), address(uniswapV2Router), _tTotal);\n if (IUniswapV2Factory(uniswapV2Router.factory()).getPair(uniswapV2Router.WETH(), address(this)) == address(0)) {\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());\n }\n else {\n uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).getPair(uniswapV2Router.WETH(), address(this));\n } \n uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);\n IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);\n swapEnabled = true;\n tradingOpen = true;\n }\n\n \n function reduceFee(uint256 _newFee) external{\n require(_msgSender()==_taxWallet);\n require(_newFee<=_finalBuyTax && _newFee<=_finalSellTax);\n _finalBuyTax=_newFee;\n _finalSellTax=_newFee;\n }\n\n receive() external payable {}\n\n function manualSwap() external {\n require(_msgSender()==_taxWallet);\n uint256 tokenBalance=balanceOf(address(this));\n if(tokenBalance>0){\n swapTokensForEth(tokenBalance);\n }\n uint256 ethBalance=address(this).balance;\n if(ethBalance>0){\n sendETHToFee(ethBalance);\n }\n }\n\n function recoverAllERC20(address tokenAddress) public onlyOwner {\n\n uint256 balance = IERC20(tokenAddress).balanceOf(address(this));\n\n IERC20(tokenAddress).transfer(owner(), balance);\n\n }\n}" } }, "settings": { "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "viaIR": false, "libraries": {} } }}
1
20,290,543
4b13c64d51b3a84a8cf2f4b2e8c72999cbc695fc27b01e6726074fe8e9d2d7b5
16b7f57f62d7fce264e9cb635eaa06271830f339ec7f8ae63f6a1b5c8d959542
2cad75e380ddb12329231df6793a0343917be8b3
7e80bd5a2e8fca0b160254d43ac9f43ac2cc1052
8379ede3556b7b6ad65e00702c2eca7f01e0c1c1
6080604052348015600f57600080fd5b50604051610191380380610191833981016040819052602c9160b4565b6001600160a01b03811660905760405162461bcd60e51b815260206004820152602260248201527f496e76616c69642073696e676c65746f6e20616464726573732070726f766964604482015261195960f21b606482015260840160405180910390fd5b600080546001600160a01b0319166001600160a01b039290921691909117905560e2565b60006020828403121560c557600080fd5b81516001600160a01b038116811460db57600080fd5b9392505050565b60a1806100f06000396000f3fe6080604052600073ffffffffffffffffffffffffffffffffffffffff8154167fa619486e00000000000000000000000000000000000000000000000000000000823503604d57808252602082f35b3682833781823684845af490503d82833e806066573d82fd5b503d81f3fea2646970667358221220f459f654b2dfcb442c5cba1925f8fabafea34ef6bbc3d170d739523834b41f4264736f6c634300081900330000000000000000000000008873b07428f621e543ff4577e812ee7bda43a4d5
6080604052600073ffffffffffffffffffffffffffffffffffffffff8154167fa619486e00000000000000000000000000000000000000000000000000000000823503604d57808252602082f35b3682833781823684845af490503d82833e806066573d82fd5b503d81f3fea2646970667358221220f459f654b2dfcb442c5cba1925f8fabafea34ef6bbc3d170d739523834b41f4264736f6c63430008190033
{{ "language": "Solidity", "sources": { "contracts/Proxy.sol": { "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity 0.8.25;\n\n// This code was borrowed from Safe's v1.4.1-build.0:\n// https://github.com/safe-global/safe-smart-account/blob/8b9023d9a2627ecbb5c40592e762857980f8e880/contracts/proxies/SafeProxy.sol\n//\n// The only changes applied were the rename of the interface and the contract.\n\n/**\n * @title IProxyWithMasterCopy - Helper interface to access the singleton address of the Proxy on-chain.\n * @author Richard Meissner - @rmeissner\n */\ninterface IProxyWithMasterCopy {\n function masterCopy() external view returns (address);\n}\n\n/**\n * @title Proxy - Generic proxy contract allows to execute all transactions applying the code of a master contract.\n * @author Stefan George - <[email protected]>\n * @author Richard Meissner - <[email protected]>\n */\n// slither-disable-next-line locked-ether\ncontract Proxy {\n // Singleton always needs to be first declared variable, to ensure that it is at the same location in the contracts to which calls are delegated.\n // To reduce deployment costs this variable is internal and needs to be retrieved via `getStorageAt`\n // slither-disable-next-line immutable-states\n address internal singleton;\n\n /**\n * @notice Constructor function sets address of singleton contract.\n * @param _singleton Singleton address.\n */\n constructor(address _singleton) {\n require(_singleton != address(0), \"Invalid singleton address provided\");\n singleton = _singleton;\n }\n\n /// @dev Fallback function forwards all transactions and returns all received return data.\n fallback() external payable {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let _singleton := and(\n sload(0),\n 0xffffffffffffffffffffffffffffffffffffffff\n )\n // 0xa619486e == keccak(\"masterCopy()\"). The value is right padded to 32-bytes with 0s\n if eq(\n calldataload(0),\n 0xa619486e00000000000000000000000000000000000000000000000000000000\n ) {\n mstore(0, _singleton)\n return(0, 0x20)\n }\n calldatacopy(0, 0, calldatasize())\n let success := delegatecall(\n gas(),\n _singleton,\n 0,\n calldatasize(),\n 0,\n 0\n )\n returndatacopy(0, 0, returndatasize())\n if eq(success, 0) {\n revert(0, returndatasize())\n }\n return(0, returndatasize())\n }\n }\n}\n" } }, "settings": { "optimizer": { "enabled": true, "runs": 10000 }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} } }}
1
20,290,543
4b13c64d51b3a84a8cf2f4b2e8c72999cbc695fc27b01e6726074fe8e9d2d7b5
16b7f57f62d7fce264e9cb635eaa06271830f339ec7f8ae63f6a1b5c8d959542
2cad75e380ddb12329231df6793a0343917be8b3
7e80bd5a2e8fca0b160254d43ac9f43ac2cc1052
efb436ad6713fd80ab164cc504e38aa949f14434
6080604052348015600f57600080fd5b50604051610191380380610191833981016040819052602c9160b4565b6001600160a01b03811660905760405162461bcd60e51b815260206004820152602260248201527f496e76616c69642073696e676c65746f6e20616464726573732070726f766964604482015261195960f21b606482015260840160405180910390fd5b600080546001600160a01b0319166001600160a01b039290921691909117905560e2565b60006020828403121560c557600080fd5b81516001600160a01b038116811460db57600080fd5b9392505050565b60a1806100f06000396000f3fe6080604052600073ffffffffffffffffffffffffffffffffffffffff8154167fa619486e00000000000000000000000000000000000000000000000000000000823503604d57808252602082f35b3682833781823684845af490503d82833e806066573d82fd5b503d81f3fea2646970667358221220f89ca516c377163343639e4278fbb9e3e2d018eddf7c97364e813fbb6dac5a8764736f6c6343000819003300000000000000000000000041675c099f32341bf84bfc5382af534df5c7461a
6080604052600073ffffffffffffffffffffffffffffffffffffffff8154167fa619486e00000000000000000000000000000000000000000000000000000000823503604d57808252602082f35b3682833781823684845af490503d82833e806066573d82fd5b503d81f3fea2646970667358221220f89ca516c377163343639e4278fbb9e3e2d018eddf7c97364e813fbb6dac5a8764736f6c63430008190033
1
20,290,544
a6146dbd4cf46c2b46e5c78dec3ab64c482da5105be97a783c78c891f7b53eba
0123406e30155a88c4bd48ad6dfb969a18f2f663abd419ccbf3c92ba69376546
9862d074e33003726fa05c74f0142995f33a3250
9862d074e33003726fa05c74f0142995f33a3250
1ff0f4d2a35f5ce0f631ee992c952276e2b9ceb0
6060604052739862d074e33003726fa05c74f0142995f33a32506000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550341561006357600080fd5b5b6102f9806100736000396000f3006060604052361561004a576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063c8fea2fb1461004e578063ff03ad56146100af575b5b5b005b341561005957600080fd5b6100ad600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506100e6565b005b6100e4600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610210565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610209578290508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb85846000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15156101eb57600080fd5b6102c65a03f115156101fc57600080fd5b50505060405180519050505b5b5b50505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102c857803373ffffffffffffffffffffffffffffffffffffffff16311015156102c6578173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015156102c557600080fd5b5b5b5b5b50505600a165627a7a72305820fe8e241acfb8e01e0521fa37f6b871952cdb705636e58db8766ec68e79742e930029
6060604052361561004a576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063c8fea2fb1461004e578063ff03ad56146100af575b5b5b005b341561005957600080fd5b6100ad600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506100e6565b005b6100e4600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610210565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610209578290508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb85846000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15156101eb57600080fd5b6102c65a03f115156101fc57600080fd5b50505060405180519050505b5b5b50505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102c857803373ffffffffffffffffffffffffffffffffffffffff16311015156102c6578173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015156102c557600080fd5b5b5b5b5b50505600a165627a7a72305820fe8e241acfb8e01e0521fa37f6b871952cdb705636e58db8766ec68e79742e930029
1
20,290,546
af9541d4d9f4ac9314b4d50f0a8d4fcf054c17dbc4f6273a41174b780e9fe7a5
622f52c0be6c83f19980e7409896ea933b65d3a2aa5040401e234bb28548cec6
a7fb5ca286fc3fd67525629048a4de3ba24cba2e
c77ad0a71008d7094a62cfbd250a2eb2afdf2776
69282478ed46f8d195ef5ad11ed373b98c6ee470
608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe
1
20,290,547
d142d37f6e4f3f307a3cc93a6741dbe8fc759cfa80efaa35ad81c8ce472f27f6
66ec11ff0724cd1fb2ac2426cf86cf15a3b8df7c9d78f31d48b865754bf51780
4e565f63257d90f988e5ec9d065bab00f94d2dfd
9fa5c5733b53814692de4fb31fd592070de5f5f0
ddb87973268e6c80d959337c62d74b54086e16c2
608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe
1
20,290,548
fcf971f3d2def76feb039a1ad7cbc7b06bfd383c6c2b8bb479d551393890162e
bdd4106c4108d36f18ee71c27fc205b3f39dae2f25d63a2896ea09e401df84a3
4e565f63257d90f988e5ec9d065bab00f94d2dfd
9fa5c5733b53814692de4fb31fd592070de5f5f0
e42386a6d4ce2ef52a69c03b21f6a2d503834515
608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe
1
20,290,548
fcf971f3d2def76feb039a1ad7cbc7b06bfd383c6c2b8bb479d551393890162e
1a67f91f3d988e4e4d4a82f88c77a1f2d834eed0a3a7e910b91f2ffecf5d0aeb
5cfcf7a5628aaf4416b6c1fa6b8a85c32e62cf07
5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f
80a14cb1f5a48d95a9cc0e8c429b71fc3b0bd24e
60806040526001600c5534801561001557600080fd5b506040514690806052612d228239604080519182900360520182208282018252600a8352692ab734b9bbb0b8102b1960b11b6020938401528151808301835260018152603160f81b908401528151808401919091527fbfcc8ef98ffbf7b6c3fec7bf5185b566b9863e35a9d83acd49ad6824b5969738818301527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606082015260808101949094523060a0808601919091528151808603909101815260c09094019052825192019190912060035550600580546001600160a01b03191633179055612c1d806101056000396000f3fe608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a7146105da578063d505accf146105e2578063dd62ed3e14610640578063fff6cae91461067b576101b9565b8063ba9a7a5614610597578063bc25cf771461059f578063c45a0155146105d2576101b9565b80637ecebe00116100d35780637ecebe00146104d757806389afcb441461050a57806395d89b4114610556578063a9059cbb1461055e576101b9565b80636a6278421461046957806370a082311461049c5780637464fc3d146104cf576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610416578063485cc9551461041e5780635909c0d5146104595780635a3d549314610461576101b9565b806323b872dd146103ad57806330adf81f146103f0578063313ce567146103f8576101b9565b8063095ea7b311610197578063095ea7b3146103155780630dfe16811461036257806318160ddd14610393576101b9565b8063022c0d9f146101be57806306fdde03146102595780630902f1ac146102d6575b600080fd5b610257600480360360808110156101d457600080fd5b81359160208101359173ffffffffffffffffffffffffffffffffffffffff604083013516919081019060808101606082013564010000000081111561021857600080fd5b82018360208201111561022a57600080fd5b8035906020019184600183028401116401000000008311171561024c57600080fd5b509092509050610683565b005b610261610d57565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029b578181015183820152602001610283565b50505050905090810190601f1680156102c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102de610d90565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b61034e6004803603604081101561032b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de5565b604080519115158252519081900360200190f35b61036a610dfc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61039b610e18565b60408051918252519081900360200190f35b61034e600480360360608110156103c357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e1e565b61039b610efd565b610400610f21565b6040805160ff9092168252519081900360200190f35b61039b610f26565b6102576004803603604081101561043457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610f2c565b61039b611005565b61039b61100b565b61039b6004803603602081101561047f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611011565b61039b600480360360208110156104b257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113cb565b61039b6113dd565b61039b600480360360208110156104ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113e3565b61053d6004803603602081101561052057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113f5565b6040805192835260208301919091528051918290030190f35b610261611892565b61034e6004803603604081101561057457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356118cb565b61039b6118d8565b610257600480360360208110156105b557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166118de565b61036a611ad4565b61036a611af0565b610257600480360360e08110156105f857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b0c565b61039b6004803603604081101561065657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611dd8565b610257611df5565b600c546001146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55841515806107075750600084115b61075c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b2f6025913960400191505060405180910390fd5b600080610767610d90565b5091509150816dffffffffffffffffffffffffffff168710801561079a5750806dffffffffffffffffffffffffffff1686105b6107ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b786021913960400191505060405180910390fd5b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff91821691908116908916821480159061085457508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b6108bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a156108d0576108d0828a8d611fdb565b89156108e1576108e1818a8c611fdb565b86156109c3578873ffffffffffffffffffffffffffffffffffffffff166310d1e85c338d8d8c8c6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050505b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8416916370a08231916024808301926020929190829003018186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191955073ffffffffffffffffffffffffffffffffffffffff8316916370a0823191602480820192602092909190829003018186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d6020811015610af557600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a90038311610b1f576000610b35565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610b59576000610b6f565b89856dffffffffffffffffffffffffffff160383035b90506000821180610b805750600081115b610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b546024913960400191505060405180910390fd5b6000610c09610beb84600363ffffffff6121e816565b610bfd876103e863ffffffff6121e816565b9063ffffffff61226e16565b90506000610c21610beb84600363ffffffff6121e816565b9050610c59620f4240610c4d6dffffffffffffffffffffffffffff8b8116908b1663ffffffff6121e816565b9063ffffffff6121e816565b610c69838363ffffffff6121e816565b1015610cd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610ce4848488886122e0565b60408051838152602081018390528082018d9052606081018c9052905173ffffffffffffffffffffffffffffffffffffffff8b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a81526020017f556e69737761702056320000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610df233848461259c565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610ee85773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610eb6908363ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610ef384848461260b565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610fb257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c5460011461108457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611094610d90565b50600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905193955091935060009273ffffffffffffffffffffffffffffffffffffffff909116916370a08231916024808301926020929190829003018186803b15801561110e57600080fd5b505afa158015611122573d6000803e3d6000fd5b505050506040513d602081101561113857600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905192935060009273ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d60208110156111db57600080fd5b505190506000611201836dffffffffffffffffffffffffffff871663ffffffff61226e16565b90506000611225836dffffffffffffffffffffffffffff871663ffffffff61226e16565b9050600061123387876126ec565b600054909150806112705761125c6103e8610bfd611257878763ffffffff6121e816565b612878565b985061126b60006103e86128ca565b6112cd565b6112ca6dffffffffffffffffffffffffffff8916611294868463ffffffff6121e816565b8161129b57fe5b046dffffffffffffffffffffffffffff89166112bd868563ffffffff6121e816565b816112c457fe5b0461297a565b98505b60008911611326576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612bc16028913960400191505060405180910390fd5b6113308a8a6128ca565b61133c86868a8a6122e0565b811561137e5760085461137a906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461146957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611479610d90565b50600654600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905194965092945073ffffffffffffffffffffffffffffffffffffffff9182169391169160009184916370a08231916024808301926020929190829003018186803b1580156114fb57600080fd5b505afa15801561150f573d6000803e3d6000fd5b505050506040513d602081101561152557600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191925060009173ffffffffffffffffffffffffffffffffffffffff8516916370a08231916024808301926020929190829003018186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d60208110156115c357600080fd5b5051306000908152600160205260408120549192506115e288886126ec565b600054909150806115f9848763ffffffff6121e816565b8161160057fe5b049a5080611614848663ffffffff6121e816565b8161161b57fe5b04995060008b11801561162e575060008a115b611683576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612b996028913960400191505060405180910390fd5b61168d3084612992565b611698878d8d611fdb565b6116a3868d8c611fdb565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8916916370a08231916024808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d602081101561173957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191965073ffffffffffffffffffffffffffffffffffffffff8816916370a0823191602480820192602092909190829003018186803b1580156117ab57600080fd5b505afa1580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b505193506117e585858b8b6122e0565b811561182757600854611823906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b604080518c8152602081018c9052815173ffffffffffffffffffffffffffffffffffffffff8f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f554e492d5632000000000000000000000000000000000000000000000000000081525081565b6000610df233848461260b565b6103e881565b600c5460011461194f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654600754600854604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff9485169490931692611a2b9285928792611a26926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff61226e16565b611fdb565b600854604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611aca9284928792611a26926e01000000000000000000000000000090046dffffffffffffffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff8616916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611b7b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff80891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e2808201937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019281900390910190855afa158015611cdc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611d5757508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611dc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611dcd89898961259c565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611e6657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611fd49273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b158015611f7a57600080fd5b505afa158015611f8e573d6000803e3d6000fd5b505050506040513d6020811015611fa457600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166122e0565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e743235362900000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b602083106120e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016120a4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612143576040519150601f19603f3d011682016040523d82523d6000602084013e612148565b606091505b5091509150818015612176575080511580612176575080806020019051602081101561217357600080fd5b50515b6121e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b60008115806122035750508082028282828161220057fe5b04145b610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061230c57506dffffffffffffffffffffffffffff8311155b61237757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906123c757506dffffffffffffffffffffffffffff841615155b80156123e257506dffffffffffffffffffffffffffff831615155b15612492578063ffffffff16612425856123fb86612a57565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169063ffffffff612a7b16565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff8116612465846123fb87612a57565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054612641908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160205260408082209390935590841681522054612683908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561275757600080fd5b505afa15801561276b573d6000803e3d6000fd5b505050506040513d602081101561278157600080fd5b5051600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061286457801561285f5760006127d86112576dffffffffffffffffffffffffffff88811690881663ffffffff6121e816565b905060006127e583612878565b90508082111561285c576000612813612804848463ffffffff61226e16565b6000549063ffffffff6121e816565b905060006128388361282c86600563ffffffff6121e816565b9063ffffffff612abc16565b9050600081838161284557fe5b04905080156128585761285887826128ca565b5050505b50505b612870565b8015612870576000600b555b505092915050565b600060038211156128bb575080600160028204015b818110156128b5578091506002818285816128a457fe5b0401816128ad57fe5b04905061288d565b506128c5565b81156128c5575060015b919050565b6000546128dd908263ffffffff612abc16565b600090815573ffffffffffffffffffffffffffffffffffffffff8316815260016020526040902054612915908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000818310612989578161298b565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020546129c8908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081209190915554612a02908263ffffffff61226e16565b600090815560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff841681612ab457fe5b049392505050565b80820182811015610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158207dca18479e58487606bf70c79e44d8dee62353c9ee6d01f9a9d70885b8765f2264736f6c63430005100032454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e747261637429
608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a7146105da578063d505accf146105e2578063dd62ed3e14610640578063fff6cae91461067b576101b9565b8063ba9a7a5614610597578063bc25cf771461059f578063c45a0155146105d2576101b9565b80637ecebe00116100d35780637ecebe00146104d757806389afcb441461050a57806395d89b4114610556578063a9059cbb1461055e576101b9565b80636a6278421461046957806370a082311461049c5780637464fc3d146104cf576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610416578063485cc9551461041e5780635909c0d5146104595780635a3d549314610461576101b9565b806323b872dd146103ad57806330adf81f146103f0578063313ce567146103f8576101b9565b8063095ea7b311610197578063095ea7b3146103155780630dfe16811461036257806318160ddd14610393576101b9565b8063022c0d9f146101be57806306fdde03146102595780630902f1ac146102d6575b600080fd5b610257600480360360808110156101d457600080fd5b81359160208101359173ffffffffffffffffffffffffffffffffffffffff604083013516919081019060808101606082013564010000000081111561021857600080fd5b82018360208201111561022a57600080fd5b8035906020019184600183028401116401000000008311171561024c57600080fd5b509092509050610683565b005b610261610d57565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029b578181015183820152602001610283565b50505050905090810190601f1680156102c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102de610d90565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b61034e6004803603604081101561032b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de5565b604080519115158252519081900360200190f35b61036a610dfc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61039b610e18565b60408051918252519081900360200190f35b61034e600480360360608110156103c357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e1e565b61039b610efd565b610400610f21565b6040805160ff9092168252519081900360200190f35b61039b610f26565b6102576004803603604081101561043457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610f2c565b61039b611005565b61039b61100b565b61039b6004803603602081101561047f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611011565b61039b600480360360208110156104b257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113cb565b61039b6113dd565b61039b600480360360208110156104ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113e3565b61053d6004803603602081101561052057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113f5565b6040805192835260208301919091528051918290030190f35b610261611892565b61034e6004803603604081101561057457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356118cb565b61039b6118d8565b610257600480360360208110156105b557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166118de565b61036a611ad4565b61036a611af0565b610257600480360360e08110156105f857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b0c565b61039b6004803603604081101561065657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611dd8565b610257611df5565b600c546001146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55841515806107075750600084115b61075c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b2f6025913960400191505060405180910390fd5b600080610767610d90565b5091509150816dffffffffffffffffffffffffffff168710801561079a5750806dffffffffffffffffffffffffffff1686105b6107ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b786021913960400191505060405180910390fd5b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff91821691908116908916821480159061085457508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b6108bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a156108d0576108d0828a8d611fdb565b89156108e1576108e1818a8c611fdb565b86156109c3578873ffffffffffffffffffffffffffffffffffffffff166310d1e85c338d8d8c8c6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050505b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8416916370a08231916024808301926020929190829003018186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191955073ffffffffffffffffffffffffffffffffffffffff8316916370a0823191602480820192602092909190829003018186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d6020811015610af557600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a90038311610b1f576000610b35565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610b59576000610b6f565b89856dffffffffffffffffffffffffffff160383035b90506000821180610b805750600081115b610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b546024913960400191505060405180910390fd5b6000610c09610beb84600363ffffffff6121e816565b610bfd876103e863ffffffff6121e816565b9063ffffffff61226e16565b90506000610c21610beb84600363ffffffff6121e816565b9050610c59620f4240610c4d6dffffffffffffffffffffffffffff8b8116908b1663ffffffff6121e816565b9063ffffffff6121e816565b610c69838363ffffffff6121e816565b1015610cd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610ce4848488886122e0565b60408051838152602081018390528082018d9052606081018c9052905173ffffffffffffffffffffffffffffffffffffffff8b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a81526020017f556e69737761702056320000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610df233848461259c565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610ee85773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610eb6908363ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610ef384848461260b565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610fb257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c5460011461108457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611094610d90565b50600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905193955091935060009273ffffffffffffffffffffffffffffffffffffffff909116916370a08231916024808301926020929190829003018186803b15801561110e57600080fd5b505afa158015611122573d6000803e3d6000fd5b505050506040513d602081101561113857600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905192935060009273ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d60208110156111db57600080fd5b505190506000611201836dffffffffffffffffffffffffffff871663ffffffff61226e16565b90506000611225836dffffffffffffffffffffffffffff871663ffffffff61226e16565b9050600061123387876126ec565b600054909150806112705761125c6103e8610bfd611257878763ffffffff6121e816565b612878565b985061126b60006103e86128ca565b6112cd565b6112ca6dffffffffffffffffffffffffffff8916611294868463ffffffff6121e816565b8161129b57fe5b046dffffffffffffffffffffffffffff89166112bd868563ffffffff6121e816565b816112c457fe5b0461297a565b98505b60008911611326576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612bc16028913960400191505060405180910390fd5b6113308a8a6128ca565b61133c86868a8a6122e0565b811561137e5760085461137a906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461146957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611479610d90565b50600654600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905194965092945073ffffffffffffffffffffffffffffffffffffffff9182169391169160009184916370a08231916024808301926020929190829003018186803b1580156114fb57600080fd5b505afa15801561150f573d6000803e3d6000fd5b505050506040513d602081101561152557600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191925060009173ffffffffffffffffffffffffffffffffffffffff8516916370a08231916024808301926020929190829003018186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d60208110156115c357600080fd5b5051306000908152600160205260408120549192506115e288886126ec565b600054909150806115f9848763ffffffff6121e816565b8161160057fe5b049a5080611614848663ffffffff6121e816565b8161161b57fe5b04995060008b11801561162e575060008a115b611683576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612b996028913960400191505060405180910390fd5b61168d3084612992565b611698878d8d611fdb565b6116a3868d8c611fdb565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8916916370a08231916024808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d602081101561173957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191965073ffffffffffffffffffffffffffffffffffffffff8816916370a0823191602480820192602092909190829003018186803b1580156117ab57600080fd5b505afa1580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b505193506117e585858b8b6122e0565b811561182757600854611823906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b604080518c8152602081018c9052815173ffffffffffffffffffffffffffffffffffffffff8f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f554e492d5632000000000000000000000000000000000000000000000000000081525081565b6000610df233848461260b565b6103e881565b600c5460011461194f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654600754600854604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff9485169490931692611a2b9285928792611a26926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff61226e16565b611fdb565b600854604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611aca9284928792611a26926e01000000000000000000000000000090046dffffffffffffffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff8616916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611b7b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff80891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e2808201937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019281900390910190855afa158015611cdc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611d5757508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611dc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611dcd89898961259c565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611e6657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611fd49273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b158015611f7a57600080fd5b505afa158015611f8e573d6000803e3d6000fd5b505050506040513d6020811015611fa457600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166122e0565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e743235362900000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b602083106120e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016120a4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612143576040519150601f19603f3d011682016040523d82523d6000602084013e612148565b606091505b5091509150818015612176575080511580612176575080806020019051602081101561217357600080fd5b50515b6121e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b60008115806122035750508082028282828161220057fe5b04145b610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061230c57506dffffffffffffffffffffffffffff8311155b61237757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906123c757506dffffffffffffffffffffffffffff841615155b80156123e257506dffffffffffffffffffffffffffff831615155b15612492578063ffffffff16612425856123fb86612a57565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169063ffffffff612a7b16565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff8116612465846123fb87612a57565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054612641908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160205260408082209390935590841681522054612683908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561275757600080fd5b505afa15801561276b573d6000803e3d6000fd5b505050506040513d602081101561278157600080fd5b5051600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061286457801561285f5760006127d86112576dffffffffffffffffffffffffffff88811690881663ffffffff6121e816565b905060006127e583612878565b90508082111561285c576000612813612804848463ffffffff61226e16565b6000549063ffffffff6121e816565b905060006128388361282c86600563ffffffff6121e816565b9063ffffffff612abc16565b9050600081838161284557fe5b04905080156128585761285887826128ca565b5050505b50505b612870565b8015612870576000600b555b505092915050565b600060038211156128bb575080600160028204015b818110156128b5578091506002818285816128a457fe5b0401816128ad57fe5b04905061288d565b506128c5565b81156128c5575060015b919050565b6000546128dd908263ffffffff612abc16565b600090815573ffffffffffffffffffffffffffffffffffffffff8316815260016020526040902054612915908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000818310612989578161298b565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020546129c8908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081209190915554612a02908263ffffffff61226e16565b600090815560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff841681612ab457fe5b049392505050565b80820182811015610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158207dca18479e58487606bf70c79e44d8dee62353c9ee6d01f9a9d70885b8765f2264736f6c63430005100032
// File: contracts/interfaces/IUniswapV2Pair.sol pragma solidity >=0.5.0; interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; } // File: contracts/interfaces/IUniswapV2ERC20.sol pragma solidity >=0.5.0; interface IUniswapV2ERC20 { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; } // File: contracts/libraries/SafeMath.sol pragma solidity =0.5.16; // a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math) library SafeMath { function add(uint x, uint y) internal pure returns (uint z) { require((z = x + y) >= x, 'ds-math-add-overflow'); } function sub(uint x, uint y) internal pure returns (uint z) { require((z = x - y) <= x, 'ds-math-sub-underflow'); } function mul(uint x, uint y) internal pure returns (uint z) { require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow'); } } // File: contracts/UniswapV2ERC20.sol pragma solidity =0.5.16; contract UniswapV2ERC20 is IUniswapV2ERC20 { using SafeMath for uint; string public constant name = 'Uniswap V2'; string public constant symbol = 'UNI-V2'; uint8 public constant decimals = 18; uint public totalSupply; mapping(address => uint) public balanceOf; mapping(address => mapping(address => uint)) public allowance; bytes32 public DOMAIN_SEPARATOR; // keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9; mapping(address => uint) public nonces; event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); constructor() public { uint chainId; assembly { chainId := chainid } DOMAIN_SEPARATOR = keccak256( abi.encode( keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'), keccak256(bytes(name)), keccak256(bytes('1')), chainId, address(this) ) ); } function _mint(address to, uint value) internal { totalSupply = totalSupply.add(value); balanceOf[to] = balanceOf[to].add(value); emit Transfer(address(0), to, value); } function _burn(address from, uint value) internal { balanceOf[from] = balanceOf[from].sub(value); totalSupply = totalSupply.sub(value); emit Transfer(from, address(0), value); } function _approve(address owner, address spender, uint value) private { allowance[owner][spender] = value; emit Approval(owner, spender, value); } function _transfer(address from, address to, uint value) private { balanceOf[from] = balanceOf[from].sub(value); balanceOf[to] = balanceOf[to].add(value); emit Transfer(from, to, value); } function approve(address spender, uint value) external returns (bool) { _approve(msg.sender, spender, value); return true; } function transfer(address to, uint value) external returns (bool) { _transfer(msg.sender, to, value); return true; } function transferFrom(address from, address to, uint value) external returns (bool) { if (allowance[from][msg.sender] != uint(-1)) { allowance[from][msg.sender] = allowance[from][msg.sender].sub(value); } _transfer(from, to, value); return true; } function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external { require(deadline >= block.timestamp, 'UniswapV2: EXPIRED'); bytes32 digest = keccak256( abi.encodePacked( '\x19\x01', DOMAIN_SEPARATOR, keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline)) ) ); address recoveredAddress = ecrecover(digest, v, r, s); require(recoveredAddress != address(0) && recoveredAddress == owner, 'UniswapV2: INVALID_SIGNATURE'); _approve(owner, spender, value); } } // File: contracts/libraries/Math.sol pragma solidity =0.5.16; // a library for performing various math operations library Math { function min(uint x, uint y) internal pure returns (uint z) { z = x < y ? x : y; } // babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method) function sqrt(uint y) internal pure returns (uint z) { if (y > 3) { z = y; uint x = y / 2 + 1; while (x < z) { z = x; x = (y / x + x) / 2; } } else if (y != 0) { z = 1; } } } // File: contracts/libraries/UQ112x112.sol pragma solidity =0.5.16; // a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format)) // range: [0, 2**112 - 1] // resolution: 1 / 2**112 library UQ112x112 { uint224 constant Q112 = 2**112; // encode a uint112 as a UQ112x112 function encode(uint112 y) internal pure returns (uint224 z) { z = uint224(y) * Q112; // never overflows } // divide a UQ112x112 by a uint112, returning a UQ112x112 function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) { z = x / uint224(y); } } // File: contracts/interfaces/IERC20.sol pragma solidity >=0.5.0; interface IERC20 { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); } // File: contracts/interfaces/IUniswapV2Factory.sol pragma solidity >=0.5.0; interface IUniswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint) external view returns (address pair); function allPairsLength() external view returns (uint); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; } // File: contracts/interfaces/IUniswapV2Callee.sol pragma solidity >=0.5.0; interface IUniswapV2Callee { function uniswapV2Call(address sender, uint amount0, uint amount1, bytes calldata data) external; } // File: contracts/UniswapV2Pair.sol pragma solidity =0.5.16; contract UniswapV2Pair is IUniswapV2Pair, UniswapV2ERC20 { using SafeMath for uint; using UQ112x112 for uint224; uint public constant MINIMUM_LIQUIDITY = 10**3; bytes4 private constant SELECTOR = bytes4(keccak256(bytes('transfer(address,uint256)'))); address public factory; address public token0; address public token1; uint112 private reserve0; // uses single storage slot, accessible via getReserves uint112 private reserve1; // uses single storage slot, accessible via getReserves uint32 private blockTimestampLast; // uses single storage slot, accessible via getReserves uint public price0CumulativeLast; uint public price1CumulativeLast; uint public kLast; // reserve0 * reserve1, as of immediately after the most recent liquidity event uint private unlocked = 1; modifier lock() { require(unlocked == 1, 'UniswapV2: LOCKED'); unlocked = 0; _; unlocked = 1; } function getReserves() public view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast) { _reserve0 = reserve0; _reserve1 = reserve1; _blockTimestampLast = blockTimestampLast; } function _safeTransfer(address token, address to, uint value) private { (bool success, bytes memory data) = token.call(abi.encodeWithSelector(SELECTOR, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'UniswapV2: TRANSFER_FAILED'); } event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); constructor() public { factory = msg.sender; } // called once by the factory at time of deployment function initialize(address _token0, address _token1) external { require(msg.sender == factory, 'UniswapV2: FORBIDDEN'); // sufficient check token0 = _token0; token1 = _token1; } // update reserves and, on the first call per block, price accumulators function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private { require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'UniswapV2: OVERFLOW'); uint32 blockTimestamp = uint32(block.timestamp % 2**32); uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) { // * never overflows, and + overflow is desired price0CumulativeLast += uint(UQ112x112.encode(_reserve1).uqdiv(_reserve0)) * timeElapsed; price1CumulativeLast += uint(UQ112x112.encode(_reserve0).uqdiv(_reserve1)) * timeElapsed; } reserve0 = uint112(balance0); reserve1 = uint112(balance1); blockTimestampLast = blockTimestamp; emit Sync(reserve0, reserve1); } // if fee is on, mint liquidity equivalent to 1/6th of the growth in sqrt(k) function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) { address feeTo = IUniswapV2Factory(factory).feeTo(); feeOn = feeTo != address(0); uint _kLast = kLast; // gas savings if (feeOn) { if (_kLast != 0) { uint rootK = Math.sqrt(uint(_reserve0).mul(_reserve1)); uint rootKLast = Math.sqrt(_kLast); if (rootK > rootKLast) { uint numerator = totalSupply.mul(rootK.sub(rootKLast)); uint denominator = rootK.mul(5).add(rootKLast); uint liquidity = numerator / denominator; if (liquidity > 0) _mint(feeTo, liquidity); } } } else if (_kLast != 0) { kLast = 0; } } // this low-level function should be called from a contract which performs important safety checks function mint(address to) external lock returns (uint liquidity) { (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings uint balance0 = IERC20(token0).balanceOf(address(this)); uint balance1 = IERC20(token1).balanceOf(address(this)); uint amount0 = balance0.sub(_reserve0); uint amount1 = balance1.sub(_reserve1); bool feeOn = _mintFee(_reserve0, _reserve1); uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee if (_totalSupply == 0) { liquidity = Math.sqrt(amount0.mul(amount1)).sub(MINIMUM_LIQUIDITY); _mint(address(0), MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens } else { liquidity = Math.min(amount0.mul(_totalSupply) / _reserve0, amount1.mul(_totalSupply) / _reserve1); } require(liquidity > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED'); _mint(to, liquidity); _update(balance0, balance1, _reserve0, _reserve1); if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date emit Mint(msg.sender, amount0, amount1); } // this low-level function should be called from a contract which performs important safety checks function burn(address to) external lock returns (uint amount0, uint amount1) { (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings address _token0 = token0; // gas savings address _token1 = token1; // gas savings uint balance0 = IERC20(_token0).balanceOf(address(this)); uint balance1 = IERC20(_token1).balanceOf(address(this)); uint liquidity = balanceOf[address(this)]; bool feeOn = _mintFee(_reserve0, _reserve1); uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee amount0 = liquidity.mul(balance0) / _totalSupply; // using balances ensures pro-rata distribution amount1 = liquidity.mul(balance1) / _totalSupply; // using balances ensures pro-rata distribution require(amount0 > 0 && amount1 > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED'); _burn(address(this), liquidity); _safeTransfer(_token0, to, amount0); _safeTransfer(_token1, to, amount1); balance0 = IERC20(_token0).balanceOf(address(this)); balance1 = IERC20(_token1).balanceOf(address(this)); _update(balance0, balance1, _reserve0, _reserve1); if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date emit Burn(msg.sender, amount0, amount1, to); } // this low-level function should be called from a contract which performs important safety checks function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external lock { require(amount0Out > 0 || amount1Out > 0, 'UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT'); (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings require(amount0Out < _reserve0 && amount1Out < _reserve1, 'UniswapV2: INSUFFICIENT_LIQUIDITY'); uint balance0; uint balance1; { // scope for _token{0,1}, avoids stack too deep errors address _token0 = token0; address _token1 = token1; require(to != _token0 && to != _token1, 'UniswapV2: INVALID_TO'); if (amount0Out > 0) _safeTransfer(_token0, to, amount0Out); // optimistically transfer tokens if (amount1Out > 0) _safeTransfer(_token1, to, amount1Out); // optimistically transfer tokens if (data.length > 0) IUniswapV2Callee(to).uniswapV2Call(msg.sender, amount0Out, amount1Out, data); balance0 = IERC20(_token0).balanceOf(address(this)); balance1 = IERC20(_token1).balanceOf(address(this)); } uint amount0In = balance0 > _reserve0 - amount0Out ? balance0 - (_reserve0 - amount0Out) : 0; uint amount1In = balance1 > _reserve1 - amount1Out ? balance1 - (_reserve1 - amount1Out) : 0; require(amount0In > 0 || amount1In > 0, 'UniswapV2: INSUFFICIENT_INPUT_AMOUNT'); { // scope for reserve{0,1}Adjusted, avoids stack too deep errors uint balance0Adjusted = balance0.mul(1000).sub(amount0In.mul(3)); uint balance1Adjusted = balance1.mul(1000).sub(amount1In.mul(3)); require(balance0Adjusted.mul(balance1Adjusted) >= uint(_reserve0).mul(_reserve1).mul(1000**2), 'UniswapV2: K'); } _update(balance0, balance1, _reserve0, _reserve1); emit Swap(msg.sender, amount0In, amount1In, amount0Out, amount1Out, to); } // force balances to match reserves function skim(address to) external lock { address _token0 = token0; // gas savings address _token1 = token1; // gas savings _safeTransfer(_token0, to, IERC20(_token0).balanceOf(address(this)).sub(reserve0)); _safeTransfer(_token1, to, IERC20(_token1).balanceOf(address(this)).sub(reserve1)); } // force reserves to match balances function sync() external lock { _update(IERC20(token0).balanceOf(address(this)), IERC20(token1).balanceOf(address(this)), reserve0, reserve1); } }
1
20,290,552
f82973be428fa57009b7139e93516d5cc8205ee4d85183c9e938442241d96812
ac9d39e7b1de66056f80b5d51a6d7be1189b1bc897afaca8ce6e51629b80bcc2
024326bf8d2db920fa20e56a89bc102aecced4ec
024326bf8d2db920fa20e56a89bc102aecced4ec
42116c7ff880031dddfe797fbb99e296ee3ad49c
608060405234801562000010575f80fd5b50604051620021f9380380620021f9833981810160405281019062000036919062000285565b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603620000a7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200009e906200033c565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160362000118576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200010f90620003aa565b60405180910390fd5b8160035f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550805f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055503360015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508260025f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050620003ca565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6200024f8262000224565b9050919050565b620002618162000243565b81146200026c575f80fd5b50565b5f815190506200027f8162000256565b92915050565b5f805f606084860312156200029f576200029e62000220565b5b5f620002ae868287016200026f565b9350506020620002c1868287016200026f565b9250506040620002d4868287016200026f565b9150509250925092565b5f82825260208201905092915050565b7f6d7573742073657420746f6b656e2061646472657373000000000000000000005f82015250565b5f62000324601683620002de565b91506200033182620002ee565b602082019050919050565b5f6020820190508181035f830152620003558162000316565b9050919050565b7f6d75737420736574206f7261636c6520616464726573730000000000000000005f82015250565b5f62000392601783620002de565b91506200039f826200035c565b602082019050919050565b5f6020820190508181035f830152620003c38162000384565b9050919050565b611e2180620003d85f395ff3fe608060405234801561000f575f80fd5b50600436106100cd575f3560e01c8063b07f84961161008a578063cdc1842411610064578063cdc18424146101bf578063ed516cc0146101dd578063f2fde38b146101f9578063fc0c546a14610215576100cd565b8063b07f84961461017d578063bed9d86114610199578063cb82cc8f146101a3576100cd565b806349a79036146100d157806376ee4c0f146100ed5780637dc0d1d0146101095780638929f4c6146101275780638da5cb5b146101435780639e281a9814610161575b5f80fd5b6100eb60048036038101906100e691906112dc565b610233565b005b610107600480360381019061010291906113ce565b610372565b005b610111610696565b60405161011e91906114e0565b60405180910390f35b610141600480360381019061013c91906114f9565b6106b9565b005b61014b6107d0565b6040516101589190611533565b60405180910390f35b61017b6004803603810190610176919061154c565b6107f5565b005b610197600480360381019061019291906113ce565b610a3e565b005b6101a1610ce6565b005b6101bd60048036038101906101b891906114f9565b610df1565b005b6101c7610fb0565b6040516101d49190611533565b60405180910390f35b6101f760048036038101906101f291906112dc565b610fd5565b005b610213600480360381019061020e91906112dc565b611115565b005b61021d611255565b60405161022a91906115aa565b60405180910390f35b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146102c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102b99061161d565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610330576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161032790611685565b60405180910390fd5b805f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610401576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103f8906116ed565b60405180910390fd5b5f61012c5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166396426d976040518163ffffffff1660e01b8152600401602060405180830381865afa15801561046d573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610491919061171f565b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636fd4f2296040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104f9573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061051d919061171f565b426105289190611777565b61053291906117aa565b61053c9190611818565b905081811015610581576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161057890611892565b60405180910390fd5b60035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b67f8cbd6040518163ffffffff1660e01b81526004015f604051808303815f87803b1580156105e7575f80fd5b505af11580156105f9573d5f803e3d5ffd5b505050505f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635eaa9ced8989898989896040518763ffffffff1660e01b815260040161065f96959493929190611928565b5f604051808303815f87803b158015610676575f80fd5b505af1158015610688573d5f803e3d5ffd5b505050505050505050505050565b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610748576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161073f906119c7565b60405180910390fd5b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638929f4c6826040518263ffffffff1660e01b81526004016107a091906119e5565b5f604051808303815f87803b1580156107b7575f80fd5b505af11580156107c9573d5f803e3d5ffd5b5050505050565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60025f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610884576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161087b90611a6e565b60405180910390fd5b8060035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016108df9190611533565b602060405180830381865afa1580156108fa573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061091e919061171f565b101561095f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161095690611ad6565b60405180910390fd5b60035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b81526004016109bb929190611af4565b6020604051808303815f875af11580156109d7573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109fb9190611b50565b610a3a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3190611bc5565b60405180910390fd5b5050565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610acd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ac4906116ed565b60405180910390fd5b5f61012c5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166396426d976040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b39573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b5d919061171f565b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636fd4f2296040518163ffffffff1660e01b8152600401602060405180830381865afa158015610bc5573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610be9919061171f565b42610bf49190611777565b610bfe91906117aa565b610c089190611818565b905081811015610c4d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c4490611892565b60405180910390fd5b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635eaa9ced8989898989896040518763ffffffff1660e01b8152600401610caf96959493929190611928565b5f604051808303815f87803b158015610cc6575f80fd5b505af1158015610cd8573d5f803e3d5ffd5b505050505050505050505050565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610d75576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d6c90611c2d565b60405180910390fd5b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bed9d8616040518163ffffffff1660e01b81526004015f604051808303815f87803b158015610dd9575f80fd5b505af1158015610deb573d5f803e3d5ffd5b50505050565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7790611c95565b60405180910390fd5b60035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b35f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff1660e01b8152600401610efb929190611af4565b5f604051808303815f87803b158015610f12575f80fd5b505af1158015610f24573d5f803e3d5ffd5b505050505f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663cb82cc8f826040518263ffffffff1660e01b8152600401610f8091906119e5565b5f604051808303815f87803b158015610f97575f80fd5b505af1158015610fa9573d5f803e3d5ffd5b5050505050565b60025f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611064576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161105b9061161d565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036110d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110c990611cfd565b60405180910390fd5b8060035f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60025f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146111a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119b90611d65565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611212576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161120990611dcd565b60405180910390fd5b8060015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f80fd5b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6112ab82611282565b9050919050565b6112bb816112a1565b81146112c5575f80fd5b50565b5f813590506112d6816112b2565b92915050565b5f602082840312156112f1576112f061127a565b5b5f6112fe848285016112c8565b91505092915050565b5f819050919050565b61131981611307565b8114611323575f80fd5b50565b5f8135905061133481611310565b92915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f84011261135b5761135a61133a565b5b8235905067ffffffffffffffff8111156113785761137761133e565b5b60208301915083600182028301111561139457611393611342565b5b9250929050565b5f819050919050565b6113ad8161139b565b81146113b7575f80fd5b50565b5f813590506113c8816113a4565b92915050565b5f805f805f805f60a0888a0312156113e9576113e861127a565b5b5f6113f68a828b01611326565b975050602088013567ffffffffffffffff8111156114175761141661127e565b5b6114238a828b01611346565b965096505060406114368a828b016113ba565b945050606088013567ffffffffffffffff8111156114575761145661127e565b5b6114638a828b01611346565b935093505060806114768a828b016113ba565b91505092959891949750929550565b5f819050919050565b5f6114a86114a361149e84611282565b611485565b611282565b9050919050565b5f6114b98261148e565b9050919050565b5f6114ca826114af565b9050919050565b6114da816114c0565b82525050565b5f6020820190506114f35f8301846114d1565b92915050565b5f6020828403121561150e5761150d61127a565b5b5f61151b848285016113ba565b91505092915050565b61152d816112a1565b82525050565b5f6020820190506115465f830184611524565b92915050565b5f80604083850312156115625761156161127a565b5b5f61156f858286016112c8565b9250506020611580858286016113ba565b9150509250929050565b5f611594826114af565b9050919050565b6115a48161158a565b82525050565b5f6020820190506115bd5f83018461159b565b92915050565b5f82825260208201905092915050565b7f6f6e6c79206f776e65722063616e2072657365742061646472657373000000005f82015250565b5f611607601c836115c3565b9150611612826115d3565b602082019050919050565b5f6020820190508181035f830152611634816115fb565b9050919050565b7f6d75737420736574206f7261636c6520616464726573730000000000000000005f82015250565b5f61166f6017836115c3565b915061167a8261163b565b602082019050919050565b5f6020820190508181035f83015261169c81611663565b9050919050565b7f6f6e6c79206f776e65722063616e207375626d69742076616c756500000000005f82015250565b5f6116d7601b836115c3565b91506116e2826116a3565b602082019050919050565b5f6020820190508181035f830152611704816116cb565b9050919050565b5f81519050611719816113a4565b92915050565b5f602082840312156117345761173361127a565b5b5f6117418482850161170b565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6117818261139b565b915061178c8361139b565b92508282039050818111156117a4576117a361174a565b5b92915050565b5f6117b48261139b565b91506117bf8361139b565b92508282026117cd8161139b565b915082820484148315176117e4576117e361174a565b5b5092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f6118228261139b565b915061182d8361139b565b92508261183d5761183c6117eb565b5b828204905092915050565b7f6e6f7420656e6f75676820726577617264206f722062616c616e6365000000005f82015250565b5f61187c601c836115c3565b915061188782611848565b602082019050919050565b5f6020820190508181035f8301526118a981611870565b9050919050565b6118b981611307565b82525050565b5f82825260208201905092915050565b828183375f83830152505050565b5f601f19601f8301169050919050565b5f6118f883856118bf565b93506119058385846118cf565b61190e836118dd565b840190509392505050565b6119228161139b565b82525050565b5f60808201905061193b5f8301896118b0565b818103602083015261194e8187896118ed565b905061195d6040830186611919565b81810360608301526119708184866118ed565b9050979650505050505050565b7f6f6e6c79206f776e65722063616e2072657175657374207769746864726177005f82015250565b5f6119b1601f836115c3565b91506119bc8261197d565b602082019050919050565b5f6020820190508181035f8301526119de816119a5565b9050919050565b5f6020820190506119f85f830184611919565b92915050565b7f6f6e6c7920776974686472617765722063616e20776974686472617720746f6b5f8201527f656e000000000000000000000000000000000000000000000000000000000000602082015250565b5f611a586022836115c3565b9150611a63826119fe565b604082019050919050565b5f6020820190508181035f830152611a8581611a4c565b9050919050565b7f496e73756666696369656e742062616c616e63650000000000000000000000005f82015250565b5f611ac06014836115c3565b9150611acb82611a8c565b602082019050919050565b5f6020820190508181035f830152611aed81611ab4565b9050919050565b5f604082019050611b075f830185611524565b611b146020830184611919565b9392505050565b5f8115159050919050565b611b2f81611b1b565b8114611b39575f80fd5b50565b5f81519050611b4a81611b26565b92915050565b5f60208284031215611b6557611b6461127a565b5b5f611b7284828501611b3c565b91505092915050565b7f5472616e73666572206661696c656400000000000000000000000000000000005f82015250565b5f611baf600f836115c3565b9150611bba82611b7b565b602082019050919050565b5f6020820190508181035f830152611bdc81611ba3565b9050919050565b7f6f6e6c79206f776e65722063616e207769746864726177207374616b650000005f82015250565b5f611c17601d836115c3565b9150611c2282611be3565b602082019050919050565b5f6020820190508181035f830152611c4481611c0b565b9050919050565b7f6f6e6c79206f776e65722063616e206465706f736974000000000000000000005f82015250565b5f611c7f6016836115c3565b9150611c8a82611c4b565b602082019050919050565b5f6020820190508181035f830152611cac81611c73565b9050919050565b7f6d7573742073657420746f6b656e2061646472657373000000000000000000005f82015250565b5f611ce76016836115c3565b9150611cf282611cb3565b602082019050919050565b5f6020820190508181035f830152611d1481611cdb565b9050919050565b7f6f6e6c79206f776e65722063616e207265736574206f776e65727368697000005f82015250565b5f611d4f601e836115c3565b9150611d5a82611d1b565b602082019050919050565b5f6020820190508181035f830152611d7c81611d43565b9050919050565b7f496e76616c6964206164647265737300000000000000000000000000000000005f82015250565b5f611db7600f836115c3565b9150611dc282611d83565b602082019050919050565b5f6020820190508181035f830152611de481611dab565b905091905056fea2646970667358221220d42998d21b24b178ae7afb9d2e1c0e95425fd0be5b07a1a586d07ab3bc83403064736f6c63430008180033000000000000000000000000024326bf8d2db920fa20e56a89bc102aecced4ec00000000000000000000000088df592f8eb5d7bd38bfef7deb0fbc02cf3778a00000000000000000000000008cfc184c877154a8f9ffe0fe75649dbe5e2dbebf
608060405234801561000f575f80fd5b50600436106100cd575f3560e01c8063b07f84961161008a578063cdc1842411610064578063cdc18424146101bf578063ed516cc0146101dd578063f2fde38b146101f9578063fc0c546a14610215576100cd565b8063b07f84961461017d578063bed9d86114610199578063cb82cc8f146101a3576100cd565b806349a79036146100d157806376ee4c0f146100ed5780637dc0d1d0146101095780638929f4c6146101275780638da5cb5b146101435780639e281a9814610161575b5f80fd5b6100eb60048036038101906100e691906112dc565b610233565b005b610107600480360381019061010291906113ce565b610372565b005b610111610696565b60405161011e91906114e0565b60405180910390f35b610141600480360381019061013c91906114f9565b6106b9565b005b61014b6107d0565b6040516101589190611533565b60405180910390f35b61017b6004803603810190610176919061154c565b6107f5565b005b610197600480360381019061019291906113ce565b610a3e565b005b6101a1610ce6565b005b6101bd60048036038101906101b891906114f9565b610df1565b005b6101c7610fb0565b6040516101d49190611533565b60405180910390f35b6101f760048036038101906101f291906112dc565b610fd5565b005b610213600480360381019061020e91906112dc565b611115565b005b61021d611255565b60405161022a91906115aa565b60405180910390f35b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146102c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102b99061161d565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610330576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161032790611685565b60405180910390fd5b805f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610401576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103f8906116ed565b60405180910390fd5b5f61012c5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166396426d976040518163ffffffff1660e01b8152600401602060405180830381865afa15801561046d573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610491919061171f565b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636fd4f2296040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104f9573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061051d919061171f565b426105289190611777565b61053291906117aa565b61053c9190611818565b905081811015610581576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161057890611892565b60405180910390fd5b60035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b67f8cbd6040518163ffffffff1660e01b81526004015f604051808303815f87803b1580156105e7575f80fd5b505af11580156105f9573d5f803e3d5ffd5b505050505f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635eaa9ced8989898989896040518763ffffffff1660e01b815260040161065f96959493929190611928565b5f604051808303815f87803b158015610676575f80fd5b505af1158015610688573d5f803e3d5ffd5b505050505050505050505050565b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610748576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161073f906119c7565b60405180910390fd5b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638929f4c6826040518263ffffffff1660e01b81526004016107a091906119e5565b5f604051808303815f87803b1580156107b7575f80fd5b505af11580156107c9573d5f803e3d5ffd5b5050505050565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60025f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610884576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161087b90611a6e565b60405180910390fd5b8060035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016108df9190611533565b602060405180830381865afa1580156108fa573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061091e919061171f565b101561095f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161095690611ad6565b60405180910390fd5b60035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b81526004016109bb929190611af4565b6020604051808303815f875af11580156109d7573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109fb9190611b50565b610a3a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3190611bc5565b60405180910390fd5b5050565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610acd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ac4906116ed565b60405180910390fd5b5f61012c5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166396426d976040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b39573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b5d919061171f565b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636fd4f2296040518163ffffffff1660e01b8152600401602060405180830381865afa158015610bc5573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610be9919061171f565b42610bf49190611777565b610bfe91906117aa565b610c089190611818565b905081811015610c4d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c4490611892565b60405180910390fd5b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635eaa9ced8989898989896040518763ffffffff1660e01b8152600401610caf96959493929190611928565b5f604051808303815f87803b158015610cc6575f80fd5b505af1158015610cd8573d5f803e3d5ffd5b505050505050505050505050565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610d75576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d6c90611c2d565b60405180910390fd5b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bed9d8616040518163ffffffff1660e01b81526004015f604051808303815f87803b158015610dd9575f80fd5b505af1158015610deb573d5f803e3d5ffd5b50505050565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7790611c95565b60405180910390fd5b60035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b35f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff1660e01b8152600401610efb929190611af4565b5f604051808303815f87803b158015610f12575f80fd5b505af1158015610f24573d5f803e3d5ffd5b505050505f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663cb82cc8f826040518263ffffffff1660e01b8152600401610f8091906119e5565b5f604051808303815f87803b158015610f97575f80fd5b505af1158015610fa9573d5f803e3d5ffd5b5050505050565b60025f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611064576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161105b9061161d565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036110d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110c990611cfd565b60405180910390fd5b8060035f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60025f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146111a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119b90611d65565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611212576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161120990611dcd565b60405180910390fd5b8060015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f80fd5b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6112ab82611282565b9050919050565b6112bb816112a1565b81146112c5575f80fd5b50565b5f813590506112d6816112b2565b92915050565b5f602082840312156112f1576112f061127a565b5b5f6112fe848285016112c8565b91505092915050565b5f819050919050565b61131981611307565b8114611323575f80fd5b50565b5f8135905061133481611310565b92915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f84011261135b5761135a61133a565b5b8235905067ffffffffffffffff8111156113785761137761133e565b5b60208301915083600182028301111561139457611393611342565b5b9250929050565b5f819050919050565b6113ad8161139b565b81146113b7575f80fd5b50565b5f813590506113c8816113a4565b92915050565b5f805f805f805f60a0888a0312156113e9576113e861127a565b5b5f6113f68a828b01611326565b975050602088013567ffffffffffffffff8111156114175761141661127e565b5b6114238a828b01611346565b965096505060406114368a828b016113ba565b945050606088013567ffffffffffffffff8111156114575761145661127e565b5b6114638a828b01611346565b935093505060806114768a828b016113ba565b91505092959891949750929550565b5f819050919050565b5f6114a86114a361149e84611282565b611485565b611282565b9050919050565b5f6114b98261148e565b9050919050565b5f6114ca826114af565b9050919050565b6114da816114c0565b82525050565b5f6020820190506114f35f8301846114d1565b92915050565b5f6020828403121561150e5761150d61127a565b5b5f61151b848285016113ba565b91505092915050565b61152d816112a1565b82525050565b5f6020820190506115465f830184611524565b92915050565b5f80604083850312156115625761156161127a565b5b5f61156f858286016112c8565b9250506020611580858286016113ba565b9150509250929050565b5f611594826114af565b9050919050565b6115a48161158a565b82525050565b5f6020820190506115bd5f83018461159b565b92915050565b5f82825260208201905092915050565b7f6f6e6c79206f776e65722063616e2072657365742061646472657373000000005f82015250565b5f611607601c836115c3565b9150611612826115d3565b602082019050919050565b5f6020820190508181035f830152611634816115fb565b9050919050565b7f6d75737420736574206f7261636c6520616464726573730000000000000000005f82015250565b5f61166f6017836115c3565b915061167a8261163b565b602082019050919050565b5f6020820190508181035f83015261169c81611663565b9050919050565b7f6f6e6c79206f776e65722063616e207375626d69742076616c756500000000005f82015250565b5f6116d7601b836115c3565b91506116e2826116a3565b602082019050919050565b5f6020820190508181035f830152611704816116cb565b9050919050565b5f81519050611719816113a4565b92915050565b5f602082840312156117345761173361127a565b5b5f6117418482850161170b565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6117818261139b565b915061178c8361139b565b92508282039050818111156117a4576117a361174a565b5b92915050565b5f6117b48261139b565b91506117bf8361139b565b92508282026117cd8161139b565b915082820484148315176117e4576117e361174a565b5b5092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f6118228261139b565b915061182d8361139b565b92508261183d5761183c6117eb565b5b828204905092915050565b7f6e6f7420656e6f75676820726577617264206f722062616c616e6365000000005f82015250565b5f61187c601c836115c3565b915061188782611848565b602082019050919050565b5f6020820190508181035f8301526118a981611870565b9050919050565b6118b981611307565b82525050565b5f82825260208201905092915050565b828183375f83830152505050565b5f601f19601f8301169050919050565b5f6118f883856118bf565b93506119058385846118cf565b61190e836118dd565b840190509392505050565b6119228161139b565b82525050565b5f60808201905061193b5f8301896118b0565b818103602083015261194e8187896118ed565b905061195d6040830186611919565b81810360608301526119708184866118ed565b9050979650505050505050565b7f6f6e6c79206f776e65722063616e2072657175657374207769746864726177005f82015250565b5f6119b1601f836115c3565b91506119bc8261197d565b602082019050919050565b5f6020820190508181035f8301526119de816119a5565b9050919050565b5f6020820190506119f85f830184611919565b92915050565b7f6f6e6c7920776974686472617765722063616e20776974686472617720746f6b5f8201527f656e000000000000000000000000000000000000000000000000000000000000602082015250565b5f611a586022836115c3565b9150611a63826119fe565b604082019050919050565b5f6020820190508181035f830152611a8581611a4c565b9050919050565b7f496e73756666696369656e742062616c616e63650000000000000000000000005f82015250565b5f611ac06014836115c3565b9150611acb82611a8c565b602082019050919050565b5f6020820190508181035f830152611aed81611ab4565b9050919050565b5f604082019050611b075f830185611524565b611b146020830184611919565b9392505050565b5f8115159050919050565b611b2f81611b1b565b8114611b39575f80fd5b50565b5f81519050611b4a81611b26565b92915050565b5f60208284031215611b6557611b6461127a565b5b5f611b7284828501611b3c565b91505092915050565b7f5472616e73666572206661696c656400000000000000000000000000000000005f82015250565b5f611baf600f836115c3565b9150611bba82611b7b565b602082019050919050565b5f6020820190508181035f830152611bdc81611ba3565b9050919050565b7f6f6e6c79206f776e65722063616e207769746864726177207374616b650000005f82015250565b5f611c17601d836115c3565b9150611c2282611be3565b602082019050919050565b5f6020820190508181035f830152611c4481611c0b565b9050919050565b7f6f6e6c79206f776e65722063616e206465706f736974000000000000000000005f82015250565b5f611c7f6016836115c3565b9150611c8a82611c4b565b602082019050919050565b5f6020820190508181035f830152611cac81611c73565b9050919050565b7f6d7573742073657420746f6b656e2061646472657373000000000000000000005f82015250565b5f611ce76016836115c3565b9150611cf282611cb3565b602082019050919050565b5f6020820190508181035f830152611d1481611cdb565b9050919050565b7f6f6e6c79206f776e65722063616e207265736574206f776e65727368697000005f82015250565b5f611d4f601e836115c3565b9150611d5a82611d1b565b602082019050919050565b5f6020820190508181035f830152611d7c81611d43565b9050919050565b7f496e76616c6964206164647265737300000000000000000000000000000000005f82015250565b5f611db7600f836115c3565b9150611dc282611d83565b602082019050919050565b5f6020820190508181035f830152611de481611dab565b905091905056fea2646970667358221220d42998d21b24b178ae7afb9d2e1c0e95425fd0be5b07a1a586d07ab3bc83403064736f6c63430008180033
1
20,290,555
4bc58a39012d3aebb0fa6ce988dc800a25fcfeb9f402a596dc0d31949d8fb3a5
ee981c47c5129276974edeee2a5c23efcd89b1f1d975d193f533a3846f23c40c
aaeff290d5117dac60ad8e6939385c48918a991c
00b19a5200a100e5fc4c9800772f4d002f218400
e750e1cbc6c1b5b89e40040596eee32646577e88
3d602d80600a3d3981f3363d3d373d3d3d363d739f36ee33fd56c7d9a78facd3249c580b1ca464a25af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d739f36ee33fd56c7d9a78facd3249c580b1ca464a25af43d82803e903d91602b57fd5bf3
{{ "language": "Solidity", "sources": { "src/clones/ERC1155SeaDropCloneable.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {\n ERC1155SeaDropContractOffererCloneable\n} from \"./ERC1155SeaDropContractOffererCloneable.sol\";\n\n/**\n * @title ERC1155SeaDropCloneable\n * @author James Wenzel (emo.eth)\n * @author Ryan Ghods (ralxz.eth)\n * @author Stephan Min (stephanm.eth)\n * @author Michael Cohen (notmichael.eth)\n * @custom:contributor Limit Break (@limitbreak)\n * @notice A cloneable ERC1155 token contract that can mint as a\n * Seaport contract offerer.\n * Implements Limit Break's Creator Token Standards transfer\n * validation for royalty enforcement.\n */\ncontract ERC1155SeaDropCloneable is ERC1155SeaDropContractOffererCloneable {\n /**\n * @notice Initialize the token contract.\n *\n * @param allowedConfigurer The address of the contract allowed to\n * implementation code. Also contains SeaDrop\n * implementation code.\n * @param allowedSeaport The address of the Seaport contract allowed to\n * interact.\n * @param name_ The name of the token.\n * @param symbol_ The symbol of the token.\n */\n function initialize(\n address allowedConfigurer,\n address allowedSeaport,\n string memory name_,\n string memory symbol_,\n address initialOwner\n ) public initializer {\n // Initialize ownership.\n _initializeOwner(initialOwner);\n\n // Initialize ERC1155SeaDropContractOffererCloneable.\n __ERC1155SeaDropContractOffererCloneable_init(\n allowedConfigurer,\n allowedSeaport,\n name_,\n symbol_\n );\n }\n\n /**\n * @notice Burns a token, restricted to the owner or approved operator,\n * and must have sufficient balance.\n *\n * @param from The address to burn from.\n * @param id The token id to burn.\n * @param amount The amount to burn.\n */\n function burn(address from, uint256 id, uint256 amount) external {\n // Burn the token.\n _burn(msg.sender, from, id, amount);\n }\n\n /**\n * @notice Burns a batch of tokens, restricted to the owner or\n * approved operator, and must have sufficient balance.\n *\n * @param from The address to burn from.\n * @param ids The token ids to burn.\n * @param amounts The amounts to burn per token id.\n */\n function batchBurn(\n address from,\n uint256[] calldata ids,\n uint256[] calldata amounts\n ) external {\n // Burn the tokens.\n _batchBurn(msg.sender, from, ids, amounts);\n }\n}\n" }, "src/clones/ERC1155SeaDropContractOffererCloneable.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { IERC1155SeaDrop } from \"../interfaces/IERC1155SeaDrop.sol\";\n\nimport { ISeaDropToken } from \"../interfaces/ISeaDropToken.sol\";\n\nimport {\n ERC1155ContractMetadataCloneable\n} from \"./ERC1155ContractMetadataCloneable.sol\";\n\nimport {\n ERC1155SeaDropContractOffererStorage\n} from \"../lib/ERC1155SeaDropContractOffererStorage.sol\";\n\nimport {\n ERC1155SeaDropErrorsAndEvents\n} from \"../lib/ERC1155SeaDropErrorsAndEvents.sol\";\n\nimport { PublicDrop } from \"../lib//ERC1155SeaDropStructs.sol\";\n\nimport { AllowListData } from \"../lib/SeaDropStructs.sol\";\n\nimport {\n ERC1155ConduitPreapproved\n} from \"../lib/ERC1155ConduitPreapproved.sol\";\n\nimport { ERC1155 } from \"solady/src/tokens/ERC1155.sol\";\n\nimport { SpentItem } from \"seaport-types/src/lib/ConsiderationStructs.sol\";\n\nimport {\n ContractOffererInterface\n} from \"seaport-types/src/interfaces/ContractOffererInterface.sol\";\n\nimport {\n IERC165\n} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\n/**\n * @title ERC1155SeaDropContractOffererCloneable\n * @author James Wenzel (emo.eth)\n * @author Ryan Ghods (ralxz.eth)\n * @author Stephan Min (stephanm.eth)\n * @author Michael Cohen (notmichael.eth)\n * @notice A cloneable ERC1155 token contract that can mint as a\n * Seaport contract offerer.\n */\ncontract ERC1155SeaDropContractOffererCloneable is\n ERC1155ContractMetadataCloneable,\n ERC1155SeaDropErrorsAndEvents\n{\n using ERC1155SeaDropContractOffererStorage for ERC1155SeaDropContractOffererStorage.Layout;\n\n /**\n * @notice Initialize the token contract.\n *\n * @param allowedConfigurer The address of the contract allowed to\n * configure parameters. Also contains SeaDrop\n * implementation code.\n * @param allowedSeaport The address of the Seaport contract allowed to\n * interact.\n * @param name_ The name of the token.\n * @param symbol_ The symbol of the token.\n */\n function __ERC1155SeaDropContractOffererCloneable_init(\n address allowedConfigurer,\n address allowedSeaport,\n string memory name_,\n string memory symbol_\n ) internal onlyInitializing {\n // Set the allowed Seaport to interact with this contract.\n if (allowedSeaport == address(0)) {\n revert AllowedSeaportCannotBeZeroAddress();\n }\n ERC1155SeaDropContractOffererStorage.layout()._allowedSeaport[\n allowedSeaport\n ] = true;\n\n // Set the allowed Seaport enumeration.\n address[] memory enumeratedAllowedSeaport = new address[](1);\n enumeratedAllowedSeaport[0] = allowedSeaport;\n ERC1155SeaDropContractOffererStorage\n .layout()\n ._enumeratedAllowedSeaport = enumeratedAllowedSeaport;\n\n // Emit an event noting the contract deployment.\n emit SeaDropTokenDeployed(SEADROP_TOKEN_TYPE.ERC1155_CLONE);\n\n // Initialize ERC1155ContractMetadataCloneable.\n __ERC1155ContractMetadataCloneable_init(\n allowedConfigurer,\n name_,\n symbol_\n );\n }\n\n /**\n * @notice The fallback function is used as a dispatcher for SeaDrop\n * methods.\n */\n fallback(bytes calldata) external returns (bytes memory output) {\n // Get the function selector.\n bytes4 selector = msg.sig;\n\n // Get the rest of the msg data after the selector.\n bytes calldata data = msg.data[4:];\n\n // Determine if we should forward the call to the implementation\n // contract with SeaDrop logic.\n bool callSeaDropImplementation = selector ==\n ISeaDropToken.updateAllowedSeaport.selector ||\n selector == ISeaDropToken.updateDropURI.selector ||\n selector == ISeaDropToken.updateAllowList.selector ||\n selector == ISeaDropToken.updateCreatorPayouts.selector ||\n selector == ISeaDropToken.updatePayer.selector ||\n selector == ISeaDropToken.updateAllowedFeeRecipient.selector ||\n selector == ISeaDropToken.updateSigner.selector ||\n selector == IERC1155SeaDrop.updatePublicDrop.selector ||\n selector == ContractOffererInterface.previewOrder.selector ||\n selector == ContractOffererInterface.generateOrder.selector ||\n selector == ContractOffererInterface.getSeaportMetadata.selector ||\n selector == IERC1155SeaDrop.getPublicDrop.selector ||\n selector == IERC1155SeaDrop.getPublicDropIndexes.selector ||\n selector == ISeaDropToken.getAllowedSeaport.selector ||\n selector == ISeaDropToken.getCreatorPayouts.selector ||\n selector == ISeaDropToken.getAllowListMerkleRoot.selector ||\n selector == ISeaDropToken.getAllowedFeeRecipients.selector ||\n selector == ISeaDropToken.getSigners.selector ||\n selector == ISeaDropToken.getDigestIsUsed.selector ||\n selector == ISeaDropToken.getPayers.selector;\n\n // Determine if we should require only the owner or configurer calling.\n bool requireOnlyOwnerOrConfigurer = selector ==\n ISeaDropToken.updateAllowedSeaport.selector ||\n selector == ISeaDropToken.updateDropURI.selector ||\n selector == ISeaDropToken.updateAllowList.selector ||\n selector == ISeaDropToken.updateCreatorPayouts.selector ||\n selector == ISeaDropToken.updatePayer.selector ||\n selector == ISeaDropToken.updateAllowedFeeRecipient.selector ||\n selector == IERC1155SeaDrop.updatePublicDrop.selector;\n\n if (callSeaDropImplementation) {\n // For update calls, ensure the sender is only the owner\n // or configurer contract.\n if (requireOnlyOwnerOrConfigurer) {\n _onlyOwnerOrConfigurer();\n } else if (selector == ISeaDropToken.updateSigner.selector) {\n // For updateSigner, a signer can disallow themselves.\n // Get the signer parameter.\n address signer = address(bytes20(data[12:32]));\n // If the signer is not allowed, ensure sender is only owner\n // or configurer.\n if (\n msg.sender != signer ||\n (msg.sender == signer &&\n !ERC1155SeaDropContractOffererStorage\n .layout()\n ._allowedSigners[signer])\n ) {\n _onlyOwnerOrConfigurer();\n }\n }\n\n // Forward the call to the implementation contract.\n (bool success, bytes memory returnedData) = _CONFIGURER\n .delegatecall(msg.data);\n\n // Require that the call was successful.\n if (!success) {\n // Bubble up the revert reason.\n assembly {\n revert(add(32, returnedData), mload(returnedData))\n }\n }\n\n // If the call was to generateOrder, mint the tokens.\n if (selector == ContractOffererInterface.generateOrder.selector) {\n _mintOrder(data);\n }\n\n // Return the data from the delegate call.\n return returnedData;\n } else if (selector == IERC1155SeaDrop.getMintStats.selector) {\n // Get the minter and token id.\n (address minter, uint256 tokenId) = abi.decode(\n data,\n (address, uint256)\n );\n\n // Get the mint stats.\n (\n uint256 minterNumMinted,\n uint256 minterNumMintedForTokenId,\n uint256 totalMintedForTokenId,\n uint256 maxSupply\n ) = _getMintStats(minter, tokenId);\n\n // Encode the return data.\n return\n abi.encode(\n minterNumMinted,\n minterNumMintedForTokenId,\n totalMintedForTokenId,\n maxSupply\n );\n } else if (selector == ContractOffererInterface.ratifyOrder.selector) {\n // This function is a no-op, nothing additional needs to happen here.\n // Utilize assembly to efficiently return the ratifyOrder magic value.\n assembly {\n mstore(0, 0xf4dd92ce)\n return(0x1c, 32)\n }\n } else if (selector == ISeaDropToken.configurer.selector) {\n // Return the configurer contract.\n return abi.encode(_CONFIGURER);\n } else if (selector == IERC1155SeaDrop.multiConfigureMint.selector) {\n // Ensure only the owner or configurer can call this function.\n _onlyOwnerOrConfigurer();\n\n // Mint the tokens.\n _multiConfigureMint(data);\n } else {\n // Revert if the function selector is not supported.\n revert UnsupportedFunctionSelector(selector);\n }\n }\n\n /**\n * @notice Returns a set of mint stats for the address.\n * This assists in enforcing maxSupply, maxTotalMintableByWallet,\n * and maxTokenSupplyForStage checks.\n *\n * @dev NOTE: Implementing contracts should always update these numbers\n * before transferring any tokens with _safeMint() to mitigate\n * consequences of malicious onERC1155Received() hooks.\n *\n * @param minter The minter address.\n * @param tokenId The token id to return the stats for.\n */\n function _getMintStats(\n address minter,\n uint256 tokenId\n )\n internal\n view\n returns (\n uint256 minterNumMinted,\n uint256 minterNumMintedForTokenId,\n uint256 totalMintedForTokenId,\n uint256 maxSupply\n )\n {\n // Put the token supply on the stack.\n TokenSupply storage tokenSupply = _tokenSupply[tokenId];\n\n // Assign the return values.\n totalMintedForTokenId = tokenSupply.totalMinted;\n maxSupply = tokenSupply.maxSupply;\n minterNumMinted = _totalMintedByUser[minter];\n minterNumMintedForTokenId = _totalMintedByUserPerToken[minter][tokenId];\n }\n\n /**\n * @dev Handle ERC-1155 safeTransferFrom. If \"from\" is this contract,\n * the sender can only be Seaport or the conduit.\n *\n * @param from The address to transfer from.\n * @param to The address to transfer to.\n * @param id The token id to transfer.\n * @param amount The amount of tokens to transfer.\n * @param data The data to pass to the onERC1155Received hook.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) public virtual override {\n if (from == address(this)) {\n // Only Seaport or the conduit can use this function\n // when \"from\" is this contract.\n if (\n msg.sender != _CONDUIT &&\n !ERC1155SeaDropContractOffererStorage.layout()._allowedSeaport[\n msg.sender\n ]\n ) {\n revert InvalidCallerOnlyAllowedSeaport(msg.sender);\n }\n return;\n }\n\n ERC1155._safeTransfer(_by(), from, to, id, amount, data);\n }\n\n /**\n * @notice Returns whether the interface is supported.\n *\n * @param interfaceId The interface id to check against.\n */\n function supportsInterface(\n bytes4 interfaceId\n )\n public\n view\n virtual\n override(ERC1155ContractMetadataCloneable)\n returns (bool)\n {\n return\n interfaceId == type(IERC1155SeaDrop).interfaceId ||\n interfaceId == type(ContractOffererInterface).interfaceId ||\n interfaceId == 0x2e778efc || // SIP-5 (getSeaportMetadata)\n // ERC1155ContractMetadata returns supportsInterface true for\n // IERC1155ContractMetadata, ERC-4906, ERC-2981\n // ERC1155A returns supportsInterface true for\n // ERC165, ERC1155, ERC1155MetadataURI\n ERC1155ContractMetadataCloneable.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Internal function to mint tokens during a generateOrder call\n * from Seaport.\n *\n * @param data The original transaction calldata, without the selector.\n */\n function _mintOrder(bytes calldata data) internal {\n // Decode fulfiller, minimumReceived, and context from calldata.\n (\n address fulfiller,\n SpentItem[] memory minimumReceived,\n ,\n bytes memory context\n ) = abi.decode(data, (address, SpentItem[], SpentItem[], bytes));\n\n // Assign the minter from context[22:42]. We validate context has the\n // correct minimum length in the implementation's `_decodeOrder`.\n address minter;\n assembly {\n minter := shr(96, mload(add(add(context, 0x20), 22)))\n }\n\n // If the minter is the zero address, set it to the fulfiller.\n if (minter == address(0)) {\n minter = fulfiller;\n }\n\n // Set the token ids and quantities.\n uint256 minimumReceivedLength = minimumReceived.length;\n uint256[] memory tokenIds = new uint256[](minimumReceivedLength);\n uint256[] memory quantities = new uint256[](minimumReceivedLength);\n for (uint256 i = 0; i < minimumReceivedLength; ) {\n tokenIds[i] = minimumReceived[i].identifier;\n quantities[i] = minimumReceived[i].amount;\n unchecked {\n ++i;\n }\n }\n\n // Mint the tokens.\n _batchMint(minter, tokenIds, quantities, \"\");\n }\n\n /**\n * @dev Internal function to mint tokens during a multiConfigureMint call\n * from the configurer contract.\n *\n * @param data The original transaction calldata, without the selector.\n */\n function _multiConfigureMint(bytes calldata data) internal {\n // Decode the calldata.\n (\n address recipient,\n uint256[] memory tokenIds,\n uint256[] memory amounts\n ) = abi.decode(data, (address, uint256[], uint256[]));\n\n _batchMint(recipient, tokenIds, amounts, \"\");\n }\n}\n" }, "src/interfaces/IERC1155SeaDrop.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { ISeaDropToken } from \"./ISeaDropToken.sol\";\n\nimport { PublicDrop } from \"../lib/ERC1155SeaDropStructs.sol\";\n\n/**\n * @dev A helper interface to get and set parameters for ERC1155SeaDrop.\n * The token does not expose these methods as part of its external\n * interface to optimize contract size, but does implement them.\n */\ninterface IERC1155SeaDrop is ISeaDropToken {\n /**\n * @notice Update the SeaDrop public drop parameters at a given index.\n *\n * @param publicDrop The new public drop parameters.\n * @param index The public drop index.\n */\n function updatePublicDrop(\n PublicDrop calldata publicDrop,\n uint256 index\n ) external;\n\n /**\n * @notice Returns the public drop stage parameters at a given index.\n *\n * @param index The index of the public drop stage.\n */\n function getPublicDrop(\n uint256 index\n ) external view returns (PublicDrop memory);\n\n /**\n * @notice Returns the public drop indexes.\n */\n function getPublicDropIndexes() external view returns (uint256[] memory);\n\n /**\n * @notice Returns a set of mint stats for the address.\n * This assists SeaDrop in enforcing maxSupply,\n * maxTotalMintableByWallet, maxTotalMintableByWalletPerToken,\n * and maxTokenSupplyForStage checks.\n *\n * @dev NOTE: Implementing contracts should always update these numbers\n * before transferring any tokens with _safeMint() to mitigate\n * consequences of malicious onERC1155Received() hooks.\n *\n * @param minter The minter address.\n * @param tokenId The token id to return stats for.\n */\n function getMintStats(\n address minter,\n uint256 tokenId\n )\n external\n view\n returns (\n uint256 minterNumMinted,\n uint256 minterNumMintedForTokenId,\n uint256 totalMintedForTokenId,\n uint256 maxSupply\n );\n\n /**\n * @notice This function is only allowed to be called by the configurer\n * contract as a way to batch mints and configuration in one tx.\n *\n * @param recipient The address to receive the mints.\n * @param tokenIds The tokenIds to mint.\n * @param amounts The amounts to mint.\n */\n function multiConfigureMint(\n address recipient,\n uint256[] calldata tokenIds,\n uint256[] calldata amounts\n ) external;\n}\n" }, "src/interfaces/ISeaDropToken.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {\n ISeaDropTokenContractMetadata\n} from \"./ISeaDropTokenContractMetadata.sol\";\n\nimport { AllowListData, CreatorPayout } from \"../lib/SeaDropStructs.sol\";\n\n/**\n * @dev A helper base interface for IERC721SeaDrop and IERC1155SeaDrop.\n * The token does not expose these methods as part of its external\n * interface to optimize contract size, but does implement them.\n */\ninterface ISeaDropToken is ISeaDropTokenContractMetadata {\n /**\n * @notice Update the SeaDrop allowed Seaport contracts privileged to mint.\n * Only the owner can use this function.\n *\n * @param allowedSeaport The allowed Seaport addresses.\n */\n function updateAllowedSeaport(address[] calldata allowedSeaport) external;\n\n /**\n * @notice Update the SeaDrop allowed fee recipient.\n * Only the owner can use this function.\n *\n * @param feeRecipient The new fee recipient.\n * @param allowed Whether the fee recipient is allowed.\n */\n function updateAllowedFeeRecipient(\n address feeRecipient,\n bool allowed\n ) external;\n\n /**\n * @notice Update the SeaDrop creator payout addresses.\n * The total basis points must add up to exactly 10_000.\n * Only the owner can use this function.\n *\n * @param creatorPayouts The new creator payouts.\n */\n function updateCreatorPayouts(\n CreatorPayout[] calldata creatorPayouts\n ) external;\n\n /**\n * @notice Update the SeaDrop drop URI.\n * Only the owner can use this function.\n *\n * @param dropURI The new drop URI.\n */\n function updateDropURI(string calldata dropURI) external;\n\n /**\n * @notice Update the SeaDrop allow list data.\n * Only the owner can use this function.\n *\n * @param allowListData The new allow list data.\n */\n function updateAllowList(AllowListData calldata allowListData) external;\n\n /**\n * @notice Update the SeaDrop allowed payers.\n * Only the owner can use this function.\n *\n * @param payer The payer to update.\n * @param allowed Whether the payer is allowed.\n */\n function updatePayer(address payer, bool allowed) external;\n\n /**\n * @notice Update the SeaDrop allowed signer.\n * Only the owner can use this function.\n * An allowed signer can also disallow themselves.\n *\n * @param signer The signer to update.\n * @param allowed Whether the signer is allowed.\n */\n function updateSigner(address signer, bool allowed) external;\n\n /**\n * @notice Get the SeaDrop allowed Seaport contracts privileged to mint.\n */\n function getAllowedSeaport() external view returns (address[] memory);\n\n /**\n * @notice Returns the SeaDrop creator payouts.\n */\n function getCreatorPayouts() external view returns (CreatorPayout[] memory);\n\n /**\n * @notice Returns the SeaDrop allow list merkle root.\n */\n function getAllowListMerkleRoot() external view returns (bytes32);\n\n /**\n * @notice Returns the SeaDrop allowed fee recipients.\n */\n function getAllowedFeeRecipients() external view returns (address[] memory);\n\n /**\n * @notice Returns the SeaDrop allowed signers.\n */\n function getSigners() external view returns (address[] memory);\n\n /**\n * @notice Returns if the signed digest has been used.\n *\n * @param digest The digest hash.\n */\n function getDigestIsUsed(bytes32 digest) external view returns (bool);\n\n /**\n * @notice Returns the SeaDrop allowed payers.\n */\n function getPayers() external view returns (address[] memory);\n\n /**\n * @notice Returns the configurer contract.\n */\n function configurer() external view returns (address);\n}\n" }, "src/clones/ERC1155ContractMetadataCloneable.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {\n IERC1155ContractMetadata\n} from \"../interfaces/IERC1155ContractMetadata.sol\";\n\nimport {\n ERC1155ConduitPreapproved\n} from \"../lib/ERC1155ConduitPreapproved.sol\";\n\nimport {\n ICreatorToken,\n ILegacyCreatorToken\n} from \"../interfaces/ICreatorToken.sol\";\n\nimport { ITransferValidator1155 } from \"../interfaces/ITransferValidator.sol\";\n\nimport { TokenTransferValidator } from \"../lib/TokenTransferValidator.sol\";\n\nimport { ERC1155 } from \"solady/src/tokens/ERC1155.sol\";\n\nimport { ERC2981 } from \"solady/src/tokens/ERC2981.sol\";\n\nimport { Ownable } from \"solady/src/auth/Ownable.sol\";\n\nimport {\n Initializable\n} from \"@openzeppelin-upgradeable/contracts/proxy/utils/Initializable.sol\";\n\n/**\n * @title ERC1155ContractMetadataCloneable\n * @author James Wenzel (emo.eth)\n * @author Ryan Ghods (ralxz.eth)\n * @author Stephan Min (stephanm.eth)\n * @author Michael Cohen (notmichael.eth)\n * @notice A cloneable token contract that extends ERC-1155\n * with additional metadata and ownership capabilities.\n */\ncontract ERC1155ContractMetadataCloneable is\n ERC1155ConduitPreapproved,\n TokenTransferValidator,\n ERC2981,\n Ownable,\n IERC1155ContractMetadata,\n Initializable\n{\n /// @notice A struct containing the token supply info per token id.\n mapping(uint256 => TokenSupply) _tokenSupply;\n\n /// @notice The total number of tokens minted by address.\n mapping(address => uint256) _totalMintedByUser;\n\n /// @notice The total number of tokens minted per token id by address.\n mapping(address => mapping(uint256 => uint256)) _totalMintedByUserPerToken;\n\n /// @notice The name of the token.\n string internal _name;\n\n /// @notice The symbol of the token.\n string internal _symbol;\n\n /// @notice The base URI for token metadata.\n string internal _baseURI;\n\n /// @notice The contract URI for contract metadata.\n string internal _contractURI;\n\n /// @notice The provenance hash for guaranteeing metadata order\n /// for random reveals.\n bytes32 internal _provenanceHash;\n\n /// @notice The allowed contract that can configure SeaDrop parameters.\n address internal _CONFIGURER;\n\n /**\n * @dev Reverts if the sender is not the owner or the allowed\n * configurer contract.\n *\n * This is used as a function instead of a modifier\n * to save contract space when used multiple times.\n */\n function _onlyOwnerOrConfigurer() internal view {\n if (msg.sender != _CONFIGURER && msg.sender != owner()) {\n revert Unauthorized();\n }\n }\n\n /**\n * @notice Deploy the token contract.\n *\n * @param allowedConfigurer The address of the contract allowed to\n * configure parameters. Also contains SeaDrop\n * implementation code.\n * @param name_ The name of the token.\n * @param symbol_ The symbol of the token.\n */\n function __ERC1155ContractMetadataCloneable_init(\n address allowedConfigurer,\n string memory name_,\n string memory symbol_\n ) internal onlyInitializing {\n // Set the name of the token.\n _name = name_;\n\n // Set the symbol of the token.\n _symbol = symbol_;\n\n // Set the allowed configurer contract to interact with this contract.\n _CONFIGURER = allowedConfigurer;\n }\n\n /**\n * @notice Sets the base URI for the token metadata and emits an event.\n *\n * @param newBaseURI The new base URI to set.\n */\n function setBaseURI(string calldata newBaseURI) external override {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Set the new base URI.\n _baseURI = newBaseURI;\n\n // Emit an event with the update.\n emit BatchMetadataUpdate(0, type(uint256).max);\n }\n\n /**\n * @notice Sets the contract URI for contract metadata.\n *\n * @param newContractURI The new contract URI.\n */\n function setContractURI(string calldata newContractURI) external override {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Set the new contract URI.\n _contractURI = newContractURI;\n\n // Emit an event with the update.\n emit ContractURIUpdated(newContractURI);\n }\n\n /**\n * @notice Emit an event notifying metadata updates for\n * a range of token ids, according to EIP-4906.\n *\n * @param fromTokenId The start token id.\n * @param toTokenId The end token id.\n */\n function emitBatchMetadataUpdate(\n uint256 fromTokenId,\n uint256 toTokenId\n ) external {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Emit an event with the update.\n if (fromTokenId == toTokenId) {\n // If only one token is being updated, use the event\n // in the 1155 spec.\n emit URI(uri(fromTokenId), fromTokenId);\n } else {\n emit BatchMetadataUpdate(fromTokenId, toTokenId);\n }\n }\n\n /**\n * @notice Sets the max token supply and emits an event.\n *\n * @param tokenId The token id to set the max supply for.\n * @param newMaxSupply The new max supply to set.\n */\n function setMaxSupply(uint256 tokenId, uint256 newMaxSupply) external {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Ensure the max supply does not exceed the maximum value of uint64,\n // a limit due to the storage of bit-packed variables in TokenSupply,\n if (newMaxSupply > 2 ** 64 - 1) {\n revert CannotExceedMaxSupplyOfUint64(newMaxSupply);\n }\n\n // Set the new max supply.\n _tokenSupply[tokenId].maxSupply = uint64(newMaxSupply);\n\n // Emit an event with the update.\n emit MaxSupplyUpdated(tokenId, newMaxSupply);\n }\n\n /**\n * @notice Sets the provenance hash and emits an event.\n *\n * The provenance hash is used for random reveals, which\n * is a hash of the ordered metadata to show it has not been\n * modified after mint started.\n *\n * This function will revert if the provenance hash has already\n * been set, so be sure to carefully set it only once.\n *\n * @param newProvenanceHash The new provenance hash to set.\n */\n function setProvenanceHash(bytes32 newProvenanceHash) external {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Keep track of the old provenance hash for emitting with the event.\n bytes32 oldProvenanceHash = _provenanceHash;\n\n // Revert if the provenance hash has already been set.\n if (oldProvenanceHash != bytes32(0)) {\n revert ProvenanceHashCannotBeSetAfterAlreadyBeingSet();\n }\n\n // Set the new provenance hash.\n _provenanceHash = newProvenanceHash;\n\n // Emit an event with the update.\n emit ProvenanceHashUpdated(oldProvenanceHash, newProvenanceHash);\n }\n\n /**\n * @notice Sets the default royalty information.\n *\n * Requirements:\n *\n * - `receiver` cannot be the zero address.\n * - `feeNumerator` cannot be greater than the fee denominator of 10_000 basis points.\n */\n function setDefaultRoyalty(address receiver, uint96 feeNumerator) external {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Set the default royalty.\n // ERC2981 implementation ensures feeNumerator <= feeDenominator\n // and receiver != address(0).\n _setDefaultRoyalty(receiver, feeNumerator);\n\n // Emit an event with the updated params.\n emit RoyaltyInfoUpdated(receiver, feeNumerator);\n }\n\n /**\n * @notice Returns the name of the token.\n */\n function name() external view returns (string memory) {\n return _name;\n }\n\n /**\n * @notice Returns the symbol of the token.\n */\n function symbol() external view returns (string memory) {\n return _symbol;\n }\n\n /**\n * @notice Returns the base URI for token metadata.\n */\n function baseURI() external view override returns (string memory) {\n return _baseURI;\n }\n\n /**\n * @notice Returns the contract URI for contract metadata.\n */\n function contractURI() external view override returns (string memory) {\n return _contractURI;\n }\n\n /**\n * @notice Returns the max token supply for a token id.\n */\n function maxSupply(uint256 tokenId) external view returns (uint256) {\n return _tokenSupply[tokenId].maxSupply;\n }\n\n /**\n * @notice Returns the total supply for a token id.\n */\n function totalSupply(uint256 tokenId) external view returns (uint256) {\n return _tokenSupply[tokenId].totalSupply;\n }\n\n /**\n * @notice Returns the total minted for a token id.\n */\n function totalMinted(uint256 tokenId) external view returns (uint256) {\n return _tokenSupply[tokenId].totalMinted;\n }\n\n /**\n * @notice Returns the provenance hash.\n * The provenance hash is used for random reveals, which\n * is a hash of the ordered metadata to show it is unmodified\n * after mint has started.\n */\n function provenanceHash() external view override returns (bytes32) {\n return _provenanceHash;\n }\n\n /**\n * @notice Returns the URI for token metadata.\n *\n * This implementation returns the same URI for *all* token types.\n * It relies on the token type ID substitution mechanism defined\n * in the EIP to replace {id} with the token id.\n *\n * @custom:param tokenId The token id to get the URI for.\n */\n function uri(\n uint256 /* tokenId */\n ) public view virtual override returns (string memory) {\n // Return the base URI.\n return _baseURI;\n }\n\n /**\n * @notice Returns the transfer validation function used.\n */\n function getTransferValidationFunction()\n external\n pure\n returns (bytes4 functionSignature, bool isViewFunction)\n {\n functionSignature = ITransferValidator1155.validateTransfer.selector;\n isViewFunction = true;\n }\n\n /**\n * @notice Set the transfer validator. Only callable by the token owner.\n */\n function setTransferValidator(address newValidator) external onlyOwner {\n // Set the new transfer validator.\n _setTransferValidator(newValidator);\n }\n\n /// @dev Override this function to return true if `_beforeTokenTransfer` is used.\n function _useBeforeTokenTransfer() internal view virtual override returns (bool) {\n return true;\n }\n\n /**\n * @dev Hook that is called before any token transfer.\n * This includes minting and burning.\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory /* data */\n ) internal virtual override {\n if (from != address(0) && to != address(0)) {\n // Call the transfer validator if one is set.\n address transferValidator = _transferValidator;\n if (transferValidator != address(0)) {\n for (uint256 i = 0; i < ids.length; i++) {\n ITransferValidator1155(transferValidator).validateTransfer(\n msg.sender,\n from,\n to,\n ids[i],\n amounts[i]\n );\n }\n }\n }\n }\n\n /**\n * @notice Returns whether the interface is supported.\n *\n * @param interfaceId The interface id to check against.\n */\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC1155, ERC2981) returns (bool) {\n return\n interfaceId == type(IERC1155ContractMetadata).interfaceId ||\n interfaceId == type(ICreatorToken).interfaceId ||\n interfaceId == type(ILegacyCreatorToken).interfaceId ||\n interfaceId == 0x49064906 || // ERC-4906 (MetadataUpdate)\n ERC2981.supportsInterface(interfaceId) ||\n // ERC1155 returns supportsInterface true for\n // ERC165, ERC1155, ERC1155MetadataURI\n ERC1155.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Adds to the internal counters for a mint.\n *\n * @param to The address to mint to.\n * @param id The token id to mint.\n * @param amount The quantity to mint.\n * @param data The data to pass if receiver is a contract.\n */\n function _mint(\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal virtual override {\n // Increment mint counts.\n _incrementMintCounts(to, id, amount);\n\n ERC1155._mint(to, id, amount, data);\n }\n\n /**\n * @dev Adds to the internal counters for a batch mint.\n *\n * @param to The address to mint to.\n * @param ids The token ids to mint.\n * @param amounts The quantities to mint.\n * @param data The data to pass if receiver is a contract.\n */\n function _batchMint(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual override {\n // Put ids length on the stack to save MLOADs.\n uint256 idsLength = ids.length;\n\n for (uint256 i = 0; i < idsLength; ) {\n // Increment mint counts.\n _incrementMintCounts(to, ids[i], amounts[i]);\n\n unchecked {\n ++i;\n }\n }\n\n ERC1155._batchMint(to, ids, amounts, data);\n }\n\n /**\n * @dev Subtracts from the internal counters for a burn.\n *\n * @param by The address calling the burn.\n * @param from The address to burn from.\n * @param id The token id to burn.\n * @param amount The amount to burn.\n */\n function _burn(\n address by,\n address from,\n uint256 id,\n uint256 amount\n ) internal virtual override {\n // Reduce the supply.\n _reduceSupplyOnBurn(id, amount);\n\n ERC1155._burn(by, from, id, amount);\n }\n\n /**\n * @dev Subtracts from the internal counters for a batch burn.\n *\n * @param by The address calling the burn.\n * @param from The address to burn from.\n * @param ids The token ids to burn.\n * @param amounts The amounts to burn.\n */\n function _batchBurn(\n address by,\n address from,\n uint256[] memory ids,\n uint256[] memory amounts\n ) internal virtual override {\n // Put ids length on the stack to save MLOADs.\n uint256 idsLength = ids.length;\n\n for (uint256 i = 0; i < idsLength; ) {\n // Reduce the supply.\n _reduceSupplyOnBurn(ids[i], amounts[i]);\n\n unchecked {\n ++i;\n }\n }\n\n ERC1155._batchBurn(by, from, ids, amounts);\n }\n\n function _reduceSupplyOnBurn(uint256 id, uint256 amount) internal {\n // Get the current token supply.\n TokenSupply storage tokenSupply = _tokenSupply[id];\n\n // Reduce the totalSupply.\n unchecked {\n tokenSupply.totalSupply -= uint64(amount);\n }\n }\n\n /**\n * @dev Internal function to increment mint counts.\n *\n * Note that this function does not check if the mint exceeds\n * maxSupply, which should be validated before this function is called.\n *\n * @param to The address to mint to.\n * @param id The token id to mint.\n * @param amount The quantity to mint.\n */\n function _incrementMintCounts(\n address to,\n uint256 id,\n uint256 amount\n ) internal {\n // Get the current token supply.\n TokenSupply storage tokenSupply = _tokenSupply[id];\n\n if (tokenSupply.totalMinted + amount > tokenSupply.maxSupply) {\n revert MintExceedsMaxSupply(\n tokenSupply.totalMinted + amount,\n tokenSupply.maxSupply\n );\n }\n\n // Increment supply and number minted.\n // Can be unchecked because maxSupply cannot be set to exceed uint64.\n unchecked {\n tokenSupply.totalSupply += uint64(amount);\n tokenSupply.totalMinted += uint64(amount);\n\n // Increment total minted by user.\n _totalMintedByUser[to] += amount;\n\n // Increment total minted by user per token.\n _totalMintedByUserPerToken[to][id] += amount;\n }\n }\n}\n" }, "src/lib/ERC1155SeaDropContractOffererStorage.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { PublicDrop } from \"./ERC1155SeaDropStructs.sol\";\n\nimport { CreatorPayout } from \"./SeaDropStructs.sol\";\n\nlibrary ERC1155SeaDropContractOffererStorage {\n struct Layout {\n /// @notice The allowed Seaport addresses that can mint.\n mapping(address => bool) _allowedSeaport;\n /// @notice The enumerated allowed Seaport addresses.\n address[] _enumeratedAllowedSeaport;\n /// @notice The public drop data.\n mapping(uint256 => PublicDrop) _publicDrops;\n /// @notice The enumerated public drop indexes.\n uint256[] _enumeratedPublicDropIndexes;\n /// @notice The creator payout addresses and basis points.\n CreatorPayout[] _creatorPayouts;\n /// @notice The allow list merkle root.\n bytes32 _allowListMerkleRoot;\n /// @notice The allowed fee recipients.\n mapping(address => bool) _allowedFeeRecipients;\n /// @notice The enumerated allowed fee recipients.\n address[] _enumeratedFeeRecipients;\n /// @notice The allowed server-side signers.\n mapping(address => bool) _allowedSigners;\n /// @notice The enumerated allowed signers.\n address[] _enumeratedSigners;\n /// @notice The used signature digests.\n mapping(bytes32 => bool) _usedDigests;\n /// @notice The allowed payers.\n mapping(address => bool) _allowedPayers;\n /// @notice The enumerated allowed payers.\n address[] _enumeratedPayers;\n }\n\n bytes32 internal constant STORAGE_SLOT =\n bytes32(\n uint256(\n keccak256(\"contracts.storage.ERC1155SeaDropContractOfferer\")\n ) - 1\n );\n\n function layout() internal pure returns (Layout storage l) {\n bytes32 slot = STORAGE_SLOT;\n assembly {\n l.slot := slot\n }\n }\n}\n" }, "src/lib/ERC1155SeaDropErrorsAndEvents.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { PublicDrop } from \"./ERC1155SeaDropStructs.sol\";\n\nimport { SeaDropErrorsAndEvents } from \"./SeaDropErrorsAndEvents.sol\";\n\ninterface ERC1155SeaDropErrorsAndEvents is SeaDropErrorsAndEvents {\n /**\n * @dev Revert with an error if an empty PublicDrop is provided\n * for an already-empty public drop.\n */\n error PublicDropStageNotPresent();\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the\n * max minted per wallet for a certain token id.\n */\n error MintQuantityExceedsMaxMintedPerWalletForTokenId(\n uint256 tokenId,\n uint256 total,\n uint256 allowed\n );\n\n /**\n * @dev Revert with an error if the target token id to mint is not within\n * the drop stage range.\n */\n error TokenIdNotWithinDropStageRange(\n uint256 tokenId,\n uint256 startTokenId,\n uint256 endTokenId\n );\n\n /**\n * @notice Revert with an error if the number of maxSupplyAmounts doesn't\n * match the number of maxSupplyTokenIds.\n */\n error MaxSupplyMismatch();\n\n /**\n * @notice Revert with an error if the number of mint tokenIds doesn't\n * match the number of mint amounts.\n */\n error MintAmountsMismatch();\n\n /**\n * @notice Revert with an error if the mint order offer contains\n * a duplicate tokenId.\n */\n error OfferContainsDuplicateTokenId(uint256 tokenId);\n\n /**\n * @dev Revert if the fromTokenId is greater than the toTokenId.\n */\n error InvalidFromAndToTokenId(uint256 fromTokenId, uint256 toTokenId);\n\n /**\n * @notice Revert with an error if the number of publicDropIndexes doesn't\n * match the number of publicDrops.\n */\n error PublicDropsMismatch();\n\n /**\n * @dev An event with updated public drop data.\n */\n event PublicDropUpdated(PublicDrop publicDrop, uint256 index);\n}\n" }, "src/lib/ERC1155SeaDropStructs.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { AllowListData, CreatorPayout } from \"./SeaDropStructs.sol\";\n\n/**\n * @notice A struct defining public drop data.\n * Designed to fit efficiently in two storage slots.\n *\n * @param startPrice The start price per token. (Up to 1.2m\n * of native token, e.g. ETH, MATIC)\n * @param endPrice The end price per token. If this differs\n * from startPrice, the current price will\n * be calculated based on the current time.\n * @param startTime The start time, ensure this is not zero.\n * @param endTime The end time, ensure this is not zero.\n * @param restrictFeeRecipients If false, allow any fee recipient;\n * if true, check fee recipient is allowed.\n * @param paymentToken The payment token address. Null for\n * native token.\n * @param fromTokenId The start token id for the stage.\n * @param toTokenId The end token id for the stage.\n * @param maxTotalMintableByWallet Maximum total number of mints a user is\n * allowed. (The limit for this field is\n * 2^16 - 1)\n * @param maxTotalMintableByWalletPerToken Maximum total number of mints a user\n * is allowed for the token id. (The limit for\n * this field is 2^16 - 1)\n * @param feeBps Fee out of 10_000 basis points to be\n * collected.\n */\nstruct PublicDrop {\n // slot 1\n uint80 startPrice; // 80/512 bits\n uint80 endPrice; // 160/512 bits\n uint40 startTime; // 200/512 bits\n uint40 endTime; // 240/512 bits\n bool restrictFeeRecipients; // 248/512 bits\n // uint8 unused;\n\n // slot 2\n address paymentToken; // 408/512 bits\n uint24 fromTokenId; // 432/512 bits\n uint24 toTokenId; // 456/512 bits\n uint16 maxTotalMintableByWallet; // 472/512 bits\n uint16 maxTotalMintableByWalletPerToken; // 488/512 bits\n uint16 feeBps; // 504/512 bits\n}\n\n/**\n * @notice A struct defining mint params for an allow list.\n * An allow list leaf will be composed of `msg.sender` and\n * the following params.\n *\n * Note: Since feeBps is encoded in the leaf, backend should ensure\n * that feeBps is acceptable before generating a proof.\n *\n * @param startPrice The start price per token. (Up to 1.2m\n * of native token, e.g. ETH, MATIC)\n * @param endPrice The end price per token. If this differs\n * from startPrice, the current price will\n * be calculated based on the current time.\n * @param startTime The start time, ensure this is not zero.\n * @param endTime The end time, ensure this is not zero.\n * @param paymentToken The payment token for the mint. Null for\n * native token.\n * @param fromTokenId The start token id for the stage.\n * @param toTokenId The end token id for the stage.\n * @param maxTotalMintableByWallet Maximum total number of mints a user is\n * allowed.\n * @param maxTotalMintableByWalletPerToken Maximum total number of mints a user\n * is allowed for the token id.\n * @param maxTokenSupplyForStage The limit of token supply this stage can\n * mint within.\n * @param dropStageIndex The drop stage index to emit with the event\n * for analytical purposes. This should be\n * non-zero since the public mint emits with\n * index zero.\n * @param feeBps Fee out of 10_000 basis points to be\n * collected.\n * @param restrictFeeRecipients If false, allow any fee recipient;\n * if true, check fee recipient is allowed.\n */\nstruct MintParams {\n uint256 startPrice;\n uint256 endPrice;\n uint256 startTime;\n uint256 endTime;\n address paymentToken;\n uint256 fromTokenId;\n uint256 toTokenId;\n uint256 maxTotalMintableByWallet;\n uint256 maxTotalMintableByWalletPerToken;\n uint256 maxTokenSupplyForStage;\n uint256 dropStageIndex; // non-zero\n uint256 feeBps;\n bool restrictFeeRecipients;\n}\n\n/**\n * @dev Struct containing internal SeaDrop implementation logic\n * mint details to avoid stack too deep.\n *\n * @param feeRecipient The fee recipient.\n * @param payer The payer of the mint.\n * @param minter The mint recipient.\n * @param tokenIds The tokenIds to mint.\n * @param quantities The number of tokens to mint per tokenId.\n * @param withEffects Whether to apply state changes of the mint.\n */\nstruct MintDetails {\n address feeRecipient;\n address payer;\n address minter;\n uint256[] tokenIds;\n uint256[] quantities;\n bool withEffects;\n}\n\n/**\n * @notice A struct to configure multiple contract options in one transaction.\n */\nstruct MultiConfigureStruct {\n uint256[] maxSupplyTokenIds;\n uint256[] maxSupplyAmounts;\n string baseURI;\n string contractURI;\n PublicDrop[] publicDrops;\n uint256[] publicDropsIndexes;\n string dropURI;\n AllowListData allowListData;\n CreatorPayout[] creatorPayouts;\n bytes32 provenanceHash;\n address[] allowedFeeRecipients;\n address[] disallowedFeeRecipients;\n address[] allowedPayers;\n address[] disallowedPayers;\n // Server-signed\n address[] allowedSigners;\n address[] disallowedSigners;\n // ERC-2981\n address royaltyReceiver;\n uint96 royaltyBps;\n // Mint\n address mintRecipient;\n uint256[] mintTokenIds;\n uint256[] mintAmounts;\n}\n" }, "src/lib/SeaDropStructs.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\n/**\n * @notice A struct defining a creator payout address and basis points.\n *\n * @param payoutAddress The payout address.\n * @param basisPoints The basis points to pay out to the creator.\n * The total creator payouts must equal 10_000 bps.\n */\nstruct CreatorPayout {\n address payoutAddress;\n uint16 basisPoints;\n}\n\n/**\n * @notice A struct defining allow list data (for minting an allow list).\n *\n * @param merkleRoot The merkle root for the allow list.\n * @param publicKeyURIs If the allowListURI is encrypted, a list of URIs\n * pointing to the public keys. Empty if unencrypted.\n * @param allowListURI The URI for the allow list.\n */\nstruct AllowListData {\n bytes32 merkleRoot;\n string[] publicKeyURIs;\n string allowListURI;\n}\n" }, "src/lib/ERC1155ConduitPreapproved.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { ERC1155 } from \"solady/src/tokens/ERC1155.sol\";\n\n/**\n * @title ERC1155ConduitPreapproved\n * @notice Solady's ERC1155 with the OpenSea conduit preapproved.\n */\nabstract contract ERC1155ConduitPreapproved is ERC1155 {\n /// @dev The canonical OpenSea conduit.\n address internal constant _CONDUIT =\n 0x1E0049783F008A0085193E00003D00cd54003c71;\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) public virtual override {\n _safeTransfer(_by(), from, to, id, amount, data);\n }\n\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) public virtual override {\n _safeBatchTransfer(_by(), from, to, ids, amounts, data);\n }\n\n function isApprovedForAll(\n address owner,\n address operator\n ) public view virtual override returns (bool) {\n if (operator == _CONDUIT) return true;\n return ERC1155.isApprovedForAll(owner, operator);\n }\n\n function _by() internal view virtual returns (address result) {\n assembly {\n // `msg.sender == _CONDUIT ? address(0) : msg.sender`.\n result := mul(iszero(eq(caller(), _CONDUIT)), caller())\n }\n }\n}\n" }, "lib/solady/src/tokens/ERC1155.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/// @notice Simple ERC1155 implementation.\n/// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC1155.sol)\n/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC1155.sol)\n/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/tree/master/contracts/token/ERC1155/ERC1155.sol)\n///\n/// @dev Note:\n/// The ERC1155 standard allows for self-approvals.\n/// For performance, this implementation WILL NOT revert for such actions.\n/// Please add any checks with overrides if desired.\nabstract contract ERC1155 {\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* CUSTOM ERRORS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The lengths of the input arrays are not the same.\n error ArrayLengthsMismatch();\n\n /// @dev Cannot mint or transfer to the zero address.\n error TransferToZeroAddress();\n\n /// @dev The recipient's balance has overflowed.\n error AccountBalanceOverflow();\n\n /// @dev Insufficient balance.\n error InsufficientBalance();\n\n /// @dev Only the token owner or an approved account can manage the tokens.\n error NotOwnerNorApproved();\n\n /// @dev Cannot safely transfer to a contract that does not implement\n /// the ERC1155Receiver interface.\n error TransferToNonERC1155ReceiverImplementer();\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* EVENTS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Emitted when `amount` of token `id` is transferred\n /// from `from` to `to` by `operator`.\n event TransferSingle(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256 id,\n uint256 amount\n );\n\n /// @dev Emitted when `amounts` of token `ids` are transferred\n /// from `from` to `to` by `operator`.\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] amounts\n );\n\n /// @dev Emitted when `owner` enables or disables `operator` to manage all of their tokens.\n event ApprovalForAll(address indexed owner, address indexed operator, bool isApproved);\n\n /// @dev Emitted when the Uniform Resource Identifier (URI) for token `id`\n /// is updated to `value`. This event is not used in the base contract.\n /// You may need to emit this event depending on your URI logic.\n ///\n /// See: https://eips.ethereum.org/EIPS/eip-1155#metadata\n event URI(string value, uint256 indexed id);\n\n /// @dev `keccak256(bytes(\"TransferSingle(address,address,address,uint256,uint256)\"))`.\n uint256 private constant _TRANSFER_SINGLE_EVENT_SIGNATURE =\n 0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62;\n\n /// @dev `keccak256(bytes(\"TransferBatch(address,address,address,uint256[],uint256[])\"))`.\n uint256 private constant _TRANSFER_BATCH_EVENT_SIGNATURE =\n 0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb;\n\n /// @dev `keccak256(bytes(\"ApprovalForAll(address,address,bool)\"))`.\n uint256 private constant _APPROVAL_FOR_ALL_EVENT_SIGNATURE =\n 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* STORAGE */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The `ownerSlotSeed` of a given owner is given by.\n /// ```\n /// let ownerSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, owner))\n /// ```\n ///\n /// The balance slot of `owner` is given by.\n /// ```\n /// mstore(0x20, ownerSlotSeed)\n /// mstore(0x00, id)\n /// let balanceSlot := keccak256(0x00, 0x40)\n /// ```\n ///\n /// The operator approval slot of `owner` is given by.\n /// ```\n /// mstore(0x20, ownerSlotSeed)\n /// mstore(0x00, operator)\n /// let operatorApprovalSlot := keccak256(0x0c, 0x34)\n /// ```\n uint256 private constant _ERC1155_MASTER_SLOT_SEED = 0x9a31110384e0b0c9;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* ERC1155 METADATA */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Returns the URI for token `id`.\n ///\n /// You can either return the same templated URI for all token IDs,\n /// (e.g. \"https://example.com/api/{id}.json\"),\n /// or return a unique URI for each `id`.\n ///\n /// See: https://eips.ethereum.org/EIPS/eip-1155#metadata\n function uri(uint256 id) public view virtual returns (string memory);\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* ERC1155 */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Returns the amount of `id` owned by `owner`.\n function balanceOf(address owner, uint256 id) public view virtual returns (uint256 result) {\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, owner)\n mstore(0x00, id)\n result := sload(keccak256(0x00, 0x40))\n }\n }\n\n /// @dev Returns whether `operator` is approved to manage the tokens of `owner`.\n function isApprovedForAll(address owner, address operator)\n public\n view\n virtual\n returns (bool result)\n {\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, owner)\n mstore(0x00, operator)\n result := sload(keccak256(0x0c, 0x34))\n }\n }\n\n /// @dev Sets whether `operator` is approved to manage the tokens of the caller.\n ///\n /// Emits a {ApprovalForAll} event.\n function setApprovalForAll(address operator, bool isApproved) public virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // Convert to 0 or 1.\n isApproved := iszero(iszero(isApproved))\n // Update the `isApproved` for (`msg.sender`, `operator`).\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, caller())\n mstore(0x00, operator)\n sstore(keccak256(0x0c, 0x34), isApproved)\n // Emit the {ApprovalForAll} event.\n mstore(0x00, isApproved)\n // forgefmt: disable-next-line\n log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, caller(), shr(96, shl(96, operator)))\n }\n }\n\n /// @dev Transfers `amount` of `id` from `from` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `from` must have at least `amount` of `id`.\n /// - If the caller is not `from`,\n /// it must be approved to manage the tokens of `from`.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155Reveived}, which is called upon a batch transfer.\n ///\n /// Emits a {Transfer} event.\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) public virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, to, _single(id), _single(amount), data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, from))\n let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, to))\n mstore(0x20, fromSlotSeed)\n // Clear the upper 96 bits.\n from := shr(96, fromSlotSeed)\n to := shr(96, toSlotSeed)\n // Revert if `to` is the zero address.\n if iszero(to) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n // If the caller is not `from`, do the authorization check.\n if iszero(eq(caller(), from)) {\n mstore(0x00, caller())\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Subtract and store the updated balance of `from`.\n {\n mstore(0x00, id)\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, toSlotSeed)\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n // Emit a {TransferSingle} event.\n mstore(0x20, amount)\n log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), from, to)\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, to, _single(id), _single(amount), data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n // Do the {onERC1155Received} check if `to` is a smart contract.\n if extcodesize(to) {\n // Prepare the calldata.\n let m := mload(0x40)\n // `onERC1155Received(address,address,uint256,uint256,bytes)`.\n mstore(m, 0xf23a6e61)\n mstore(add(m, 0x20), caller())\n mstore(add(m, 0x40), from)\n mstore(add(m, 0x60), id)\n mstore(add(m, 0x80), amount)\n mstore(add(m, 0xa0), 0xa0)\n calldatacopy(add(m, 0xc0), sub(data.offset, 0x20), add(0x20, data.length))\n // Revert if the call reverts.\n if iszero(call(gas(), to, 0, add(m, 0x1c), add(0xc4, data.length), m, 0x20)) {\n if returndatasize() {\n // Bubble up the revert if the call reverts.\n returndatacopy(0x00, 0x00, returndatasize())\n revert(0x00, returndatasize())\n }\n mstore(m, 0)\n }\n // Load the returndata and compare it with the function selector.\n if iszero(eq(mload(m), shl(224, 0xf23a6e61))) {\n mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.\n revert(0x1c, 0x04)\n }\n }\n }\n }\n\n /// @dev Transfers `amounts` of `ids` from `from` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `from` must have at least `amount` of `id`.\n /// - `ids` and `amounts` must have the same length.\n /// - If the caller is not `from`,\n /// it must be approved to manage the tokens of `from`.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155BatchReveived}, which is called upon a batch transfer.\n ///\n /// Emits a {TransferBatch} event.\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) public virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, to, ids, amounts, data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(ids.length, amounts.length)) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, from))\n let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, to))\n mstore(0x20, fromSlotSeed)\n // Clear the upper 96 bits.\n from := shr(96, fromSlotSeed)\n to := shr(96, toSlotSeed)\n // Revert if `to` is the zero address.\n if iszero(to) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n // If the caller is not `from`, do the authorization check.\n if iszero(eq(caller(), from)) {\n mstore(0x00, caller())\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Loop through all the `ids` and update the balances.\n {\n let end := shl(5, ids.length)\n for { let i := 0 } iszero(eq(i, end)) { i := add(i, 0x20) } {\n let amount := calldataload(add(amounts.offset, i))\n // Subtract and store the updated balance of `from`.\n {\n mstore(0x20, fromSlotSeed)\n mstore(0x00, calldataload(add(ids.offset, i)))\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, toSlotSeed)\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n }\n }\n // Emit a {TransferBatch} event.\n {\n let m := mload(0x40)\n // Copy the `ids`.\n mstore(m, 0x40)\n let n := add(0x20, shl(5, ids.length))\n let o := add(m, 0x40)\n calldatacopy(o, sub(ids.offset, 0x20), n)\n // Copy the `amounts`.\n mstore(add(m, 0x20), add(0x40, n))\n o := add(o, n)\n n := add(0x20, shl(5, amounts.length))\n calldatacopy(o, sub(amounts.offset, 0x20), n)\n n := sub(add(o, n), m)\n // Do the emit.\n log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), from, to)\n }\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransferCalldata(from, to, ids, amounts, data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n // Do the {onERC1155BatchReceived} check if `to` is a smart contract.\n if extcodesize(to) {\n let m := mload(0x40)\n // Prepare the calldata.\n // `onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)`.\n mstore(m, 0xbc197c81)\n mstore(add(m, 0x20), caller())\n mstore(add(m, 0x40), from)\n // Copy the `ids`.\n mstore(add(m, 0x60), 0xa0)\n let n := add(0x20, shl(5, ids.length))\n let o := add(m, 0xc0)\n calldatacopy(o, sub(ids.offset, 0x20), n)\n // Copy the `amounts`.\n let s := add(0xa0, n)\n mstore(add(m, 0x80), s)\n o := add(o, n)\n n := add(0x20, shl(5, amounts.length))\n calldatacopy(o, sub(amounts.offset, 0x20), n)\n // Copy the `data`.\n mstore(add(m, 0xa0), add(s, n))\n o := add(o, n)\n n := add(0x20, data.length)\n calldatacopy(o, sub(data.offset, 0x20), n)\n n := sub(add(o, n), add(m, 0x1c))\n // Revert if the call reverts.\n if iszero(call(gas(), to, 0, add(m, 0x1c), n, m, 0x20)) {\n if returndatasize() {\n // Bubble up the revert if the call reverts.\n returndatacopy(0x00, 0x00, returndatasize())\n revert(0x00, returndatasize())\n }\n mstore(m, 0)\n }\n // Load the returndata and compare it with the function selector.\n if iszero(eq(mload(m), shl(224, 0xbc197c81))) {\n mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.\n revert(0x1c, 0x04)\n }\n }\n }\n }\n\n /// @dev Returns the amounts of `ids` for `owners.\n ///\n /// Requirements:\n /// - `owners` and `ids` must have the same length.\n function balanceOfBatch(address[] calldata owners, uint256[] calldata ids)\n public\n view\n virtual\n returns (uint256[] memory balances)\n {\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(ids.length, owners.length)) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n balances := mload(0x40)\n mstore(balances, ids.length)\n let o := add(balances, 0x20)\n let end := shl(5, ids.length)\n mstore(0x40, add(end, o))\n // Loop through all the `ids` and load the balances.\n for { let i := 0 } iszero(eq(i, end)) { i := add(i, 0x20) } {\n let owner := calldataload(add(owners.offset, i))\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, shl(96, owner)))\n mstore(0x00, calldataload(add(ids.offset, i)))\n mstore(add(o, i), sload(keccak256(0x00, 0x40)))\n }\n }\n }\n\n /// @dev Returns true if this contract implements the interface defined by `interfaceId`.\n /// See: https://eips.ethereum.org/EIPS/eip-165\n /// This function call must use less than 30000 gas.\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) {\n /// @solidity memory-safe-assembly\n assembly {\n let s := shr(224, interfaceId)\n // ERC165: 0x01ffc9a7, ERC1155: 0xd9b67a26, ERC1155MetadataURI: 0x0e89341c.\n result := or(or(eq(s, 0x01ffc9a7), eq(s, 0xd9b67a26)), eq(s, 0x0e89341c))\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL MINT FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Mints `amount` of `id` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155Reveived}, which is called upon a batch transfer.\n ///\n /// Emits a {Transfer} event.\n function _mint(address to, uint256 id, uint256 amount, bytes memory data) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(address(0), to, _single(id), _single(amount), data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n let to_ := shl(96, to)\n // Revert if `to` is the zero address.\n if iszero(to_) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, to)\n mstore(0x00, id)\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n // Emit a {TransferSingle} event.\n mstore(0x00, id)\n mstore(0x20, amount)\n log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), 0, shr(96, to_))\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(address(0), to, _single(id), _single(amount), data);\n }\n if (_hasCode(to)) _checkOnERC1155Received(address(0), to, id, amount, data);\n }\n\n /// @dev Mints `amounts` of `ids` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `ids` and `amounts` must have the same length.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155BatchReveived}, which is called upon a batch transfer.\n ///\n /// Emits a {TransferBatch} event.\n function _batchMint(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(address(0), to, ids, amounts, data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(mload(ids), mload(amounts))) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n let to_ := shl(96, to)\n // Revert if `to` is the zero address.\n if iszero(to_) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n // Loop through all the `ids` and update the balances.\n {\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, to_))\n let end := shl(5, mload(ids))\n for { let i := 0 } iszero(eq(i, end)) {} {\n i := add(i, 0x20)\n let amount := mload(add(amounts, i))\n // Increase and store the updated balance of `to`.\n {\n mstore(0x00, mload(add(ids, i)))\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n }\n }\n // Emit a {TransferBatch} event.\n {\n let m := mload(0x40)\n // Copy the `ids`.\n mstore(m, 0x40)\n let n := add(0x20, shl(5, mload(ids)))\n let o := add(m, 0x40)\n pop(staticcall(gas(), 4, ids, n, o, n))\n // Copy the `amounts`.\n mstore(add(m, 0x20), add(0x40, returndatasize()))\n o := add(o, returndatasize())\n n := add(0x20, shl(5, mload(amounts)))\n pop(staticcall(gas(), 4, amounts, n, o, n))\n n := sub(add(o, returndatasize()), m)\n // Do the emit.\n log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), 0, shr(96, to_))\n }\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(address(0), to, ids, amounts, data);\n }\n if (_hasCode(to)) _checkOnERC1155BatchReceived(address(0), to, ids, amounts, data);\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL BURN FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Equivalent to `_burn(address(0), from, id, amount)`.\n function _burn(address from, uint256 id, uint256 amount) internal virtual {\n _burn(address(0), from, id, amount);\n }\n\n /// @dev Destroys `amount` of `id` from `from`.\n ///\n /// Requirements:\n /// - `from` must have at least `amount` of `id`.\n /// - If `by` is not the zero address, it must be either `from`,\n /// or approved to manage the tokens of `from`.\n ///\n /// Emits a {Transfer} event.\n function _burn(address by, address from, uint256 id, uint256 amount) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, address(0), _single(id), _single(amount), \"\");\n }\n /// @solidity memory-safe-assembly\n assembly {\n let from_ := shl(96, from)\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, from_))\n // If `by` is not the zero address, and not equal to `from`,\n // check if it is approved to manage all the tokens of `from`.\n if iszero(or(iszero(shl(96, by)), eq(shl(96, by), from_))) {\n mstore(0x00, by)\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Decrease and store the updated balance of `from`.\n {\n mstore(0x00, id)\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Emit a {TransferSingle} event.\n mstore(0x00, id)\n mstore(0x20, amount)\n log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), shr(96, from_), 0)\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, address(0), _single(id), _single(amount), \"\");\n }\n }\n\n /// @dev Equivalent to `_batchBurn(address(0), from, ids, amounts)`.\n function _batchBurn(address from, uint256[] memory ids, uint256[] memory amounts)\n internal\n virtual\n {\n _batchBurn(address(0), from, ids, amounts);\n }\n\n /// @dev Destroys `amounts` of `ids` from `from`.\n ///\n /// Requirements:\n /// - `ids` and `amounts` must have the same length.\n /// - `from` must have at least `amounts` of `ids`.\n /// - If `by` is not the zero address, it must be either `from`,\n /// or approved to manage the tokens of `from`.\n ///\n /// Emits a {TransferBatch} event.\n function _batchBurn(address by, address from, uint256[] memory ids, uint256[] memory amounts)\n internal\n virtual\n {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, address(0), ids, amounts, \"\");\n }\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(mload(ids), mload(amounts))) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n let from_ := shl(96, from)\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, from_))\n // If `by` is not the zero address, and not equal to `from`,\n // check if it is approved to manage all the tokens of `from`.\n let by_ := shl(96, by)\n if iszero(or(iszero(by_), eq(by_, from_))) {\n mstore(0x00, by)\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Loop through all the `ids` and update the balances.\n {\n let end := shl(5, mload(ids))\n for { let i := 0 } iszero(eq(i, end)) {} {\n i := add(i, 0x20)\n let amount := mload(add(amounts, i))\n // Decrease and store the updated balance of `to`.\n {\n mstore(0x00, mload(add(ids, i)))\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n }\n }\n // Emit a {TransferBatch} event.\n {\n let m := mload(0x40)\n // Copy the `ids`.\n mstore(m, 0x40)\n let n := add(0x20, shl(5, mload(ids)))\n let o := add(m, 0x40)\n pop(staticcall(gas(), 4, ids, n, o, n))\n // Copy the `amounts`.\n mstore(add(m, 0x20), add(0x40, returndatasize()))\n o := add(o, returndatasize())\n n := add(0x20, shl(5, mload(amounts)))\n pop(staticcall(gas(), 4, amounts, n, o, n))\n n := sub(add(o, returndatasize()), m)\n // Do the emit.\n log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), shr(96, from_), 0)\n }\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, address(0), ids, amounts, \"\");\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL APPROVAL FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Approve or remove the `operator` as an operator for `by`,\n /// without authorization checks.\n ///\n /// Emits a {ApprovalForAll} event.\n function _setApprovalForAll(address by, address operator, bool isApproved) internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // Convert to 0 or 1.\n isApproved := iszero(iszero(isApproved))\n // Update the `isApproved` for (`by`, `operator`).\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, by)\n mstore(0x00, operator)\n sstore(keccak256(0x0c, 0x34), isApproved)\n // Emit the {ApprovalForAll} event.\n mstore(0x00, isApproved)\n let m := shr(96, not(0))\n log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, and(m, by), and(m, operator))\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL TRANSFER FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Equivalent to `_safeTransfer(address(0), from, to, id, amount, data)`.\n function _safeTransfer(address from, address to, uint256 id, uint256 amount, bytes memory data)\n internal\n virtual\n {\n _safeTransfer(address(0), from, to, id, amount, data);\n }\n\n /// @dev Transfers `amount` of `id` from `from` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `from` must have at least `amount` of `id`.\n /// - If `by` is not the zero address, it must be either `from`,\n /// or approved to manage the tokens of `from`.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155Reveived}, which is called upon a batch transfer.\n ///\n /// Emits a {Transfer} event.\n function _safeTransfer(\n address by,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, to, _single(id), _single(amount), data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n let from_ := shl(96, from)\n let to_ := shl(96, to)\n // Revert if `to` is the zero address.\n if iszero(to_) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, from_))\n // If `by` is not the zero address, and not equal to `from`,\n // check if it is approved to manage all the tokens of `from`.\n let by_ := shl(96, by)\n if iszero(or(iszero(by_), eq(by_, from_))) {\n mstore(0x00, by)\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Subtract and store the updated balance of `from`.\n {\n mstore(0x00, id)\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, to_))\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n // Emit a {TransferSingle} event.\n mstore(0x20, amount)\n // forgefmt: disable-next-line\n log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), shr(96, from_), shr(96, to_))\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, to, _single(id), _single(amount), data);\n }\n if (_hasCode(to)) _checkOnERC1155Received(from, to, id, amount, data);\n }\n\n /// @dev Equivalent to `_safeBatchTransfer(address(0), from, to, ids, amounts, data)`.\n function _safeBatchTransfer(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n _safeBatchTransfer(address(0), from, to, ids, amounts, data);\n }\n\n /// @dev Transfers `amounts` of `ids` from `from` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `ids` and `amounts` must have the same length.\n /// - `from` must have at least `amounts` of `ids`.\n /// - If `by` is not the zero address, it must be either `from`,\n /// or approved to manage the tokens of `from`.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155BatchReveived}, which is called upon a batch transfer.\n ///\n /// Emits a {TransferBatch} event.\n function _safeBatchTransfer(\n address by,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, to, ids, amounts, data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(mload(ids), mload(amounts))) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n let from_ := shl(96, from)\n let to_ := shl(96, to)\n // Revert if `to` is the zero address.\n if iszero(to_) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, from_)\n let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, to_)\n mstore(0x20, fromSlotSeed)\n // If `by` is not the zero address, and not equal to `from`,\n // check if it is approved to manage all the tokens of `from`.\n let by_ := shl(96, by)\n if iszero(or(iszero(by_), eq(by_, from_))) {\n mstore(0x00, by)\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Loop through all the `ids` and update the balances.\n {\n let end := shl(5, mload(ids))\n for { let i := 0 } iszero(eq(i, end)) {} {\n i := add(i, 0x20)\n let amount := mload(add(amounts, i))\n // Subtract and store the updated balance of `from`.\n {\n mstore(0x20, fromSlotSeed)\n mstore(0x00, mload(add(ids, i)))\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, toSlotSeed)\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n }\n }\n // Emit a {TransferBatch} event.\n {\n let m := mload(0x40)\n // Copy the `ids`.\n mstore(m, 0x40)\n let n := add(0x20, shl(5, mload(ids)))\n let o := add(m, 0x40)\n pop(staticcall(gas(), 4, ids, n, o, n))\n // Copy the `amounts`.\n mstore(add(m, 0x20), add(0x40, returndatasize()))\n o := add(o, returndatasize())\n n := add(0x20, shl(5, mload(amounts)))\n pop(staticcall(gas(), 4, amounts, n, o, n))\n n := sub(add(o, returndatasize()), m)\n // Do the emit.\n log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), shr(96, from_), shr(96, to_))\n }\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, to, ids, amounts, data);\n }\n if (_hasCode(to)) _checkOnERC1155BatchReceived(from, to, ids, amounts, data);\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* HOOKS FOR OVERRIDING */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Override this function to return true if `_beforeTokenTransfer` is used.\n /// The is to help the compiler avoid producing dead bytecode.\n function _useBeforeTokenTransfer() internal view virtual returns (bool) {\n return false;\n }\n\n /// @dev Hook that is called before any token transfer.\n /// This includes minting and burning, as well as batched variants.\n ///\n /// The same hook is called on both single and batched variants.\n /// For single transfers, the length of the `id` and `amount` arrays are 1.\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {}\n\n /// @dev Override this function to return true if `_afterTokenTransfer` is used.\n /// The is to help the compiler avoid producing dead bytecode.\n function _useAfterTokenTransfer() internal view virtual returns (bool) {\n return false;\n }\n\n /// @dev Hook that is called after any token transfer.\n /// This includes minting and burning, as well as batched variants.\n ///\n /// The same hook is called on both single and batched variants.\n /// For single transfers, the length of the `id` and `amount` arrays are 1.\n function _afterTokenTransfer(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {}\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* PRIVATE HELPERS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Helper for calling the `_afterTokenTransfer` hook.\n /// The is to help the compiler avoid producing dead bytecode.\n function _afterTokenTransferCalldata(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) private {\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, to, ids, amounts, data);\n }\n }\n\n /// @dev Returns if `a` has bytecode of non-zero length.\n function _hasCode(address a) private view returns (bool result) {\n /// @solidity memory-safe-assembly\n assembly {\n result := extcodesize(a) // Can handle dirty upper bits.\n }\n }\n\n /// @dev Perform a call to invoke {IERC1155Receiver-onERC1155Received} on `to`.\n /// Reverts if the target does not support the function correctly.\n function _checkOnERC1155Received(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n /// @solidity memory-safe-assembly\n assembly {\n // Prepare the calldata.\n let m := mload(0x40)\n // `onERC1155Received(address,address,uint256,uint256,bytes)`.\n mstore(m, 0xf23a6e61)\n mstore(add(m, 0x20), caller())\n mstore(add(m, 0x40), shr(96, shl(96, from)))\n mstore(add(m, 0x60), id)\n mstore(add(m, 0x80), amount)\n mstore(add(m, 0xa0), 0xa0)\n let n := mload(data)\n mstore(add(m, 0xc0), n)\n if n { pop(staticcall(gas(), 4, add(data, 0x20), n, add(m, 0xe0), n)) }\n // Revert if the call reverts.\n if iszero(call(gas(), to, 0, add(m, 0x1c), add(0xc4, n), m, 0x20)) {\n if returndatasize() {\n // Bubble up the revert if the call reverts.\n returndatacopy(0x00, 0x00, returndatasize())\n revert(0x00, returndatasize())\n }\n mstore(m, 0)\n }\n // Load the returndata and compare it with the function selector.\n if iszero(eq(mload(m), shl(224, 0xf23a6e61))) {\n mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.\n revert(0x1c, 0x04)\n }\n }\n }\n\n /// @dev Perform a call to invoke {IERC1155Receiver-onERC1155BatchReceived} on `to`.\n /// Reverts if the target does not support the function correctly.\n function _checkOnERC1155BatchReceived(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n /// @solidity memory-safe-assembly\n assembly {\n // Prepare the calldata.\n let m := mload(0x40)\n // `onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)`.\n mstore(m, 0xbc197c81)\n mstore(add(m, 0x20), caller())\n mstore(add(m, 0x40), shr(96, shl(96, from)))\n // Copy the `ids`.\n mstore(add(m, 0x60), 0xa0)\n let n := add(0x20, shl(5, mload(ids)))\n let o := add(m, 0xc0)\n pop(staticcall(gas(), 4, ids, n, o, n))\n // Copy the `amounts`.\n let s := add(0xa0, returndatasize())\n mstore(add(m, 0x80), s)\n o := add(o, returndatasize())\n n := add(0x20, shl(5, mload(amounts)))\n pop(staticcall(gas(), 4, amounts, n, o, n))\n // Copy the `data`.\n mstore(add(m, 0xa0), add(s, returndatasize()))\n o := add(o, returndatasize())\n n := add(0x20, mload(data))\n pop(staticcall(gas(), 4, data, n, o, n))\n n := sub(add(o, returndatasize()), add(m, 0x1c))\n // Revert if the call reverts.\n if iszero(call(gas(), to, 0, add(m, 0x1c), n, m, 0x20)) {\n if returndatasize() {\n // Bubble up the revert if the call reverts.\n returndatacopy(0x00, 0x00, returndatasize())\n revert(0x00, returndatasize())\n }\n mstore(m, 0)\n }\n // Load the returndata and compare it with the function selector.\n if iszero(eq(mload(m), shl(224, 0xbc197c81))) {\n mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.\n revert(0x1c, 0x04)\n }\n }\n }\n\n /// @dev Returns `x` in an array with a single element.\n function _single(uint256 x) private pure returns (uint256[] memory result) {\n assembly {\n result := mload(0x40)\n mstore(0x40, add(result, 0x40))\n mstore(result, 1)\n mstore(add(result, 0x20), x)\n }\n }\n}\n" }, "lib/seaport/lib/seaport-types/src/lib/ConsiderationStructs.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {\n BasicOrderType,\n ItemType,\n OrderType,\n Side\n} from \"./ConsiderationEnums.sol\";\n\nimport {\n CalldataPointer,\n MemoryPointer\n} from \"../helpers/PointerLibraries.sol\";\n\n/**\n * @dev An order contains eleven components: an offerer, a zone (or account that\n * can cancel the order or restrict who can fulfill the order depending on\n * the type), the order type (specifying partial fill support as well as\n * restricted order status), the start and end time, a hash that will be\n * provided to the zone when validating restricted orders, a salt, a key\n * corresponding to a given conduit, a counter, and an arbitrary number of\n * offer items that can be spent along with consideration items that must\n * be received by their respective recipient.\n */\nstruct OrderComponents {\n address offerer;\n address zone;\n OfferItem[] offer;\n ConsiderationItem[] consideration;\n OrderType orderType;\n uint256 startTime;\n uint256 endTime;\n bytes32 zoneHash;\n uint256 salt;\n bytes32 conduitKey;\n uint256 counter;\n}\n\n/**\n * @dev An offer item has five components: an item type (ETH or other native\n * tokens, ERC20, ERC721, and ERC1155, as well as criteria-based ERC721 and\n * ERC1155), a token address, a dual-purpose \"identifierOrCriteria\"\n * component that will either represent a tokenId or a merkle root\n * depending on the item type, and a start and end amount that support\n * increasing or decreasing amounts over the duration of the respective\n * order.\n */\nstruct OfferItem {\n ItemType itemType;\n address token;\n uint256 identifierOrCriteria;\n uint256 startAmount;\n uint256 endAmount;\n}\n\n/**\n * @dev A consideration item has the same five components as an offer item and\n * an additional sixth component designating the required recipient of the\n * item.\n */\nstruct ConsiderationItem {\n ItemType itemType;\n address token;\n uint256 identifierOrCriteria;\n uint256 startAmount;\n uint256 endAmount;\n address payable recipient;\n}\n\n/**\n * @dev A spent item is translated from a utilized offer item and has four\n * components: an item type (ETH or other native tokens, ERC20, ERC721, and\n * ERC1155), a token address, a tokenId, and an amount.\n */\nstruct SpentItem {\n ItemType itemType;\n address token;\n uint256 identifier;\n uint256 amount;\n}\n\n/**\n * @dev A received item is translated from a utilized consideration item and has\n * the same four components as a spent item, as well as an additional fifth\n * component designating the required recipient of the item.\n */\nstruct ReceivedItem {\n ItemType itemType;\n address token;\n uint256 identifier;\n uint256 amount;\n address payable recipient;\n}\n\n/**\n * @dev For basic orders involving ETH / native / ERC20 <=> ERC721 / ERC1155\n * matching, a group of six functions may be called that only requires a\n * subset of the usual order arguments. Note the use of a \"basicOrderType\"\n * enum; this represents both the usual order type as well as the \"route\"\n * of the basic order (a simple derivation function for the basic order\n * type is `basicOrderType = orderType + (4 * basicOrderRoute)`.)\n */\nstruct BasicOrderParameters {\n // calldata offset\n address considerationToken; // 0x24\n uint256 considerationIdentifier; // 0x44\n uint256 considerationAmount; // 0x64\n address payable offerer; // 0x84\n address zone; // 0xa4\n address offerToken; // 0xc4\n uint256 offerIdentifier; // 0xe4\n uint256 offerAmount; // 0x104\n BasicOrderType basicOrderType; // 0x124\n uint256 startTime; // 0x144\n uint256 endTime; // 0x164\n bytes32 zoneHash; // 0x184\n uint256 salt; // 0x1a4\n bytes32 offererConduitKey; // 0x1c4\n bytes32 fulfillerConduitKey; // 0x1e4\n uint256 totalOriginalAdditionalRecipients; // 0x204\n AdditionalRecipient[] additionalRecipients; // 0x224\n bytes signature; // 0x244\n // Total length, excluding dynamic array data: 0x264 (580)\n}\n\n/**\n * @dev Basic orders can supply any number of additional recipients, with the\n * implied assumption that they are supplied from the offered ETH (or other\n * native token) or ERC20 token for the order.\n */\nstruct AdditionalRecipient {\n uint256 amount;\n address payable recipient;\n}\n\n/**\n * @dev The full set of order components, with the exception of the counter,\n * must be supplied when fulfilling more sophisticated orders or groups of\n * orders. The total number of original consideration items must also be\n * supplied, as the caller may specify additional consideration items.\n */\nstruct OrderParameters {\n address offerer; // 0x00\n address zone; // 0x20\n OfferItem[] offer; // 0x40\n ConsiderationItem[] consideration; // 0x60\n OrderType orderType; // 0x80\n uint256 startTime; // 0xa0\n uint256 endTime; // 0xc0\n bytes32 zoneHash; // 0xe0\n uint256 salt; // 0x100\n bytes32 conduitKey; // 0x120\n uint256 totalOriginalConsiderationItems; // 0x140\n // offer.length // 0x160\n}\n\n/**\n * @dev Orders require a signature in addition to the other order parameters.\n */\nstruct Order {\n OrderParameters parameters;\n bytes signature;\n}\n\n/**\n * @dev Advanced orders include a numerator (i.e. a fraction to attempt to fill)\n * and a denominator (the total size of the order) in addition to the\n * signature and other order parameters. It also supports an optional field\n * for supplying extra data; this data will be provided to the zone if the\n * order type is restricted and the zone is not the caller, or will be\n * provided to the offerer as context for contract order types.\n */\nstruct AdvancedOrder {\n OrderParameters parameters;\n uint120 numerator;\n uint120 denominator;\n bytes signature;\n bytes extraData;\n}\n\n/**\n * @dev Orders can be validated (either explicitly via `validate`, or as a\n * consequence of a full or partial fill), specifically cancelled (they can\n * also be cancelled in bulk via incrementing a per-zone counter), and\n * partially or fully filled (with the fraction filled represented by a\n * numerator and denominator).\n */\nstruct OrderStatus {\n bool isValidated;\n bool isCancelled;\n uint120 numerator;\n uint120 denominator;\n}\n\n/**\n * @dev A criteria resolver specifies an order, side (offer vs. consideration),\n * and item index. It then provides a chosen identifier (i.e. tokenId)\n * alongside a merkle proof demonstrating the identifier meets the required\n * criteria.\n */\nstruct CriteriaResolver {\n uint256 orderIndex;\n Side side;\n uint256 index;\n uint256 identifier;\n bytes32[] criteriaProof;\n}\n\n/**\n * @dev A fulfillment is applied to a group of orders. It decrements a series of\n * offer and consideration items, then generates a single execution\n * element. A given fulfillment can be applied to as many offer and\n * consideration items as desired, but must contain at least one offer and\n * at least one consideration that match. The fulfillment must also remain\n * consistent on all key parameters across all offer items (same offerer,\n * token, type, tokenId, and conduit preference) as well as across all\n * consideration items (token, type, tokenId, and recipient).\n */\nstruct Fulfillment {\n FulfillmentComponent[] offerComponents;\n FulfillmentComponent[] considerationComponents;\n}\n\n/**\n * @dev Each fulfillment component contains one index referencing a specific\n * order and another referencing a specific offer or consideration item.\n */\nstruct FulfillmentComponent {\n uint256 orderIndex;\n uint256 itemIndex;\n}\n\n/**\n * @dev An execution is triggered once all consideration items have been zeroed\n * out. It sends the item in question from the offerer to the item's\n * recipient, optionally sourcing approvals from either this contract\n * directly or from the offerer's chosen conduit if one is specified. An\n * execution is not provided as an argument, but rather is derived via\n * orders, criteria resolvers, and fulfillments (where the total number of\n * executions will be less than or equal to the total number of indicated\n * fulfillments) and returned as part of `matchOrders`.\n */\nstruct Execution {\n ReceivedItem item;\n address offerer;\n bytes32 conduitKey;\n}\n\n/**\n * @dev Restricted orders are validated post-execution by calling validateOrder\n * on the zone. This struct provides context about the order fulfillment\n * and any supplied extraData, as well as all order hashes fulfilled in a\n * call to a match or fulfillAvailable method.\n */\nstruct ZoneParameters {\n bytes32 orderHash;\n address fulfiller;\n address offerer;\n SpentItem[] offer;\n ReceivedItem[] consideration;\n bytes extraData;\n bytes32[] orderHashes;\n uint256 startTime;\n uint256 endTime;\n bytes32 zoneHash;\n}\n\n/**\n * @dev Zones and contract offerers can communicate which schemas they implement\n * along with any associated metadata related to each schema.\n */\nstruct Schema {\n uint256 id;\n bytes metadata;\n}\n\nusing StructPointers for OrderComponents global;\nusing StructPointers for OfferItem global;\nusing StructPointers for ConsiderationItem global;\nusing StructPointers for SpentItem global;\nusing StructPointers for ReceivedItem global;\nusing StructPointers for BasicOrderParameters global;\nusing StructPointers for AdditionalRecipient global;\nusing StructPointers for OrderParameters global;\nusing StructPointers for Order global;\nusing StructPointers for AdvancedOrder global;\nusing StructPointers for OrderStatus global;\nusing StructPointers for CriteriaResolver global;\nusing StructPointers for Fulfillment global;\nusing StructPointers for FulfillmentComponent global;\nusing StructPointers for Execution global;\nusing StructPointers for ZoneParameters global;\n\n/**\n * @dev This library provides a set of functions for converting structs to\n * pointers.\n */\nlibrary StructPointers {\n /**\n * @dev Get a MemoryPointer from OrderComponents.\n *\n * @param obj The OrderComponents object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n OrderComponents memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from OrderComponents.\n *\n * @param obj The OrderComponents object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n OrderComponents calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from OfferItem.\n *\n * @param obj The OfferItem object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n OfferItem memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from OfferItem.\n *\n * @param obj The OfferItem object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n OfferItem calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from ConsiderationItem.\n *\n * @param obj The ConsiderationItem object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n ConsiderationItem memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from ConsiderationItem.\n *\n * @param obj The ConsiderationItem object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n ConsiderationItem calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from SpentItem.\n *\n * @param obj The SpentItem object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n SpentItem memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from SpentItem.\n *\n * @param obj The SpentItem object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n SpentItem calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from ReceivedItem.\n *\n * @param obj The ReceivedItem object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n ReceivedItem memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from ReceivedItem.\n *\n * @param obj The ReceivedItem object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n ReceivedItem calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from BasicOrderParameters.\n *\n * @param obj The BasicOrderParameters object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n BasicOrderParameters memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from BasicOrderParameters.\n *\n * @param obj The BasicOrderParameters object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n BasicOrderParameters calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from AdditionalRecipient.\n *\n * @param obj The AdditionalRecipient object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n AdditionalRecipient memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from AdditionalRecipient.\n *\n * @param obj The AdditionalRecipient object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n AdditionalRecipient calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from OrderParameters.\n *\n * @param obj The OrderParameters object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n OrderParameters memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from OrderParameters.\n *\n * @param obj The OrderParameters object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n OrderParameters calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from Order.\n *\n * @param obj The Order object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n Order memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from Order.\n *\n * @param obj The Order object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n Order calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from AdvancedOrder.\n *\n * @param obj The AdvancedOrder object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n AdvancedOrder memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from AdvancedOrder.\n *\n * @param obj The AdvancedOrder object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n AdvancedOrder calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from OrderStatus.\n *\n * @param obj The OrderStatus object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n OrderStatus memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from OrderStatus.\n *\n * @param obj The OrderStatus object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n OrderStatus calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from CriteriaResolver.\n *\n * @param obj The CriteriaResolver object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n CriteriaResolver memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from CriteriaResolver.\n *\n * @param obj The CriteriaResolver object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n CriteriaResolver calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from Fulfillment.\n *\n * @param obj The Fulfillment object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n Fulfillment memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from Fulfillment.\n *\n * @param obj The Fulfillment object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n Fulfillment calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from FulfillmentComponent.\n *\n * @param obj The FulfillmentComponent object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n FulfillmentComponent memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from FulfillmentComponent.\n *\n * @param obj The FulfillmentComponent object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n FulfillmentComponent calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from Execution.\n *\n * @param obj The Execution object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n Execution memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from Execution.\n *\n * @param obj The Execution object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n Execution calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from ZoneParameters.\n *\n * @param obj The ZoneParameters object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n ZoneParameters memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from ZoneParameters.\n *\n * @param obj The ZoneParameters object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n ZoneParameters calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n}\n" }, "lib/seaport/lib/seaport-types/src/interfaces/ContractOffererInterface.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {ReceivedItem, Schema, SpentItem} from \"../lib/ConsiderationStructs.sol\";\nimport {IERC165} from \"../interfaces/IERC165.sol\";\n\n/**\n * @title ContractOffererInterface\n * @notice Contains the minimum interfaces needed to interact with a contract\n * offerer.\n */\ninterface ContractOffererInterface is IERC165 {\n /**\n * @dev Generates an order with the specified minimum and maximum spent\n * items, and optional context (supplied as extraData).\n *\n * @param fulfiller The address of the fulfiller.\n * @param minimumReceived The minimum items that the caller is willing to\n * receive.\n * @param maximumSpent The maximum items the caller is willing to spend.\n * @param context Additional context of the order.\n *\n * @return offer A tuple containing the offer items.\n * @return consideration A tuple containing the consideration items.\n */\n function generateOrder(\n address fulfiller,\n SpentItem[] calldata minimumReceived,\n SpentItem[] calldata maximumSpent,\n bytes calldata context // encoded based on the schemaID\n ) external returns (SpentItem[] memory offer, ReceivedItem[] memory consideration);\n\n /**\n * @dev Ratifies an order with the specified offer, consideration, and\n * optional context (supplied as extraData).\n *\n * @param offer The offer items.\n * @param consideration The consideration items.\n * @param context Additional context of the order.\n * @param orderHashes The hashes to ratify.\n * @param contractNonce The nonce of the contract.\n *\n * @return ratifyOrderMagicValue The magic value returned by the contract\n * offerer.\n */\n function ratifyOrder(\n SpentItem[] calldata offer,\n ReceivedItem[] calldata consideration,\n bytes calldata context, // encoded based on the schemaID\n bytes32[] calldata orderHashes,\n uint256 contractNonce\n ) external returns (bytes4 ratifyOrderMagicValue);\n\n /**\n * @dev View function to preview an order generated in response to a minimum\n * set of received items, maximum set of spent items, and context\n * (supplied as extraData).\n *\n * @param caller The address of the caller (e.g. Seaport).\n * @param fulfiller The address of the fulfiller (e.g. the account\n * calling Seaport).\n * @param minimumReceived The minimum items that the caller is willing to\n * receive.\n * @param maximumSpent The maximum items the caller is willing to spend.\n * @param context Additional context of the order.\n *\n * @return offer A tuple containing the offer items.\n * @return consideration A tuple containing the consideration items.\n */\n function previewOrder(\n address caller,\n address fulfiller,\n SpentItem[] calldata minimumReceived,\n SpentItem[] calldata maximumSpent,\n bytes calldata context // encoded based on the schemaID\n ) external view returns (SpentItem[] memory offer, ReceivedItem[] memory consideration);\n\n /**\n * @dev Gets the metadata for this contract offerer.\n *\n * @return name The name of the contract offerer.\n * @return schemas The schemas supported by the contract offerer.\n */\n function getSeaportMetadata() external view returns (string memory name, Schema[] memory schemas); // map to Seaport Improvement Proposal IDs\n\n function supportsInterface(bytes4 interfaceId) external view override returns (bool);\n\n // Additional functions and/or events based on implemented schemaIDs\n}\n" }, "lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.19;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" }, "src/interfaces/ISeaDropTokenContractMetadata.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\ninterface ISeaDropTokenContractMetadata {\n /**\n * @dev Emit an event for token metadata reveals/updates,\n * according to EIP-4906.\n *\n * @param _fromTokenId The start token id.\n * @param _toTokenId The end token id.\n */\n event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId);\n\n /**\n * @dev Emit an event when the URI for the collection-level metadata\n * is updated.\n */\n event ContractURIUpdated(string newContractURI);\n\n /**\n * @dev Emit an event with the previous and new provenance hash after\n * being updated.\n */\n event ProvenanceHashUpdated(bytes32 previousHash, bytes32 newHash);\n\n /**\n * @dev Emit an event when the EIP-2981 royalty info is updated.\n */\n event RoyaltyInfoUpdated(address receiver, uint256 basisPoints);\n\n /**\n * @notice Throw if the max supply exceeds uint64, a limit\n * due to the storage of bit-packed variables.\n */\n error CannotExceedMaxSupplyOfUint64(uint256 got);\n\n /**\n * @dev Revert with an error when attempting to set the provenance\n * hash after the mint has started.\n */\n error ProvenanceHashCannotBeSetAfterMintStarted();\n\n /**\n * @dev Revert with an error when attempting to set the provenance\n * hash after it has already been set.\n */\n error ProvenanceHashCannotBeSetAfterAlreadyBeingSet();\n\n /**\n * @notice Sets the base URI for the token metadata and emits an event.\n *\n * @param tokenURI The new base URI to set.\n */\n function setBaseURI(string calldata tokenURI) external;\n\n /**\n * @notice Sets the contract URI for contract metadata.\n *\n * @param newContractURI The new contract URI.\n */\n function setContractURI(string calldata newContractURI) external;\n\n /**\n * @notice Sets the provenance hash and emits an event.\n *\n * The provenance hash is used for random reveals, which\n * is a hash of the ordered metadata to show it has not been\n * modified after mint started.\n *\n * This function will revert after the first item has been minted.\n *\n * @param newProvenanceHash The new provenance hash to set.\n */\n function setProvenanceHash(bytes32 newProvenanceHash) external;\n\n /**\n * @notice Sets the default royalty information.\n *\n * Requirements:\n *\n * - `receiver` cannot be the zero address.\n * - `feeNumerator` cannot be greater than the fee denominator of\n * 10_000 basis points.\n */\n function setDefaultRoyalty(address receiver, uint96 feeNumerator) external;\n\n /**\n * @notice Returns the base URI for token metadata.\n */\n function baseURI() external view returns (string memory);\n\n /**\n * @notice Returns the contract URI.\n */\n function contractURI() external view returns (string memory);\n\n /**\n * @notice Returns the provenance hash.\n * The provenance hash is used for random reveals, which\n * is a hash of the ordered metadata to show it is unmodified\n * after mint has started.\n */\n function provenanceHash() external view returns (bytes32);\n}\n" }, "src/interfaces/IERC1155ContractMetadata.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {\n ISeaDropTokenContractMetadata\n} from \"./ISeaDropTokenContractMetadata.sol\";\n\ninterface IERC1155ContractMetadata is ISeaDropTokenContractMetadata {\n /**\n * @dev A struct representing the supply info for a token id,\n * packed into one storage slot.\n *\n * @param maxSupply The max supply for the token id.\n * @param totalSupply The total token supply for the token id.\n * Subtracted when an item is burned.\n * @param totalMinted The total number of tokens minted for the token id.\n */\n struct TokenSupply {\n uint64 maxSupply; // 64/256 bits\n uint64 totalSupply; // 128/256 bits\n uint64 totalMinted; // 192/256 bits\n }\n\n /**\n * @dev Emit an event when the max token supply for a token id is updated.\n */\n event MaxSupplyUpdated(uint256 tokenId, uint256 newMaxSupply);\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the max token\n * supply.\n */\n error MintExceedsMaxSupply(uint256 total, uint256 maxSupply);\n\n /**\n * @notice Sets the max supply for a token id and emits an event.\n *\n * @param tokenId The token id to set the max supply for.\n * @param newMaxSupply The new max supply to set.\n */\n function setMaxSupply(uint256 tokenId, uint256 newMaxSupply) external;\n\n /**\n * @notice Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @notice Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @notice Returns the max token supply for a token id.\n */\n function maxSupply(uint256 tokenId) external view returns (uint256);\n\n /**\n * @notice Returns the total supply for a token id.\n */\n function totalSupply(uint256 tokenId) external view returns (uint256);\n\n /**\n * @notice Returns the total minted for a token id.\n */\n function totalMinted(uint256 tokenId) external view returns (uint256);\n}\n" }, "src/interfaces/ICreatorToken.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\ninterface ICreatorToken {\n event TransferValidatorUpdated(address oldValidator, address newValidator);\n\n function getTransferValidator() external view returns (address validator);\n\n function getTransferValidationFunction()\n external\n view\n returns (bytes4 functionSignature, bool isViewFunction);\n\n function setTransferValidator(address validator) external;\n}\n\ninterface ILegacyCreatorToken {\n event TransferValidatorUpdated(address oldValidator, address newValidator);\n\n function getTransferValidator() external view returns (address validator);\n\n function setTransferValidator(address validator) external;\n}\n" }, "src/interfaces/ITransferValidator.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\ninterface ITransferValidator721 {\n /// @notice Ensure that a transfer has been authorized for a specific tokenId\n function validateTransfer(\n address caller,\n address from,\n address to,\n uint256 tokenId\n ) external view;\n}\n\ninterface ITransferValidator1155 {\n /// @notice Ensure that a transfer has been authorized for a specific amount of a specific tokenId, and reduce the transferable amount remaining\n function validateTransfer(\n address caller,\n address from,\n address to,\n uint256 tokenId,\n uint256 amount\n ) external;\n}\n" }, "src/lib/TokenTransferValidator.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\nimport { ICreatorToken } from \"../interfaces/ICreatorToken.sol\";\n\n/**\n * @title TokenTransferValidator\n * @notice Functionality to use a transfer validator.\n */\nabstract contract TokenTransferValidator is ICreatorToken {\n /// @dev Store the transfer validator. The null address means no transfer validator is set.\n address internal _transferValidator;\n\n /// @notice Revert with an error if the transfer validator is being set to the same address.\n error SameTransferValidator();\n\n /// @notice Returns the currently active transfer validator.\n /// The null address means no transfer validator is set.\n function getTransferValidator() external view returns (address) {\n return _transferValidator;\n }\n\n /// @notice Set the transfer validator.\n /// The external method that uses this must include access control.\n function _setTransferValidator(address newValidator) internal {\n address oldValidator = _transferValidator;\n if (oldValidator == newValidator) {\n revert SameTransferValidator();\n }\n _transferValidator = newValidator;\n emit TransferValidatorUpdated(oldValidator, newValidator);\n }\n}\n" }, "lib/solady/src/tokens/ERC2981.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/// @notice Simple ERC2981 NFT Royalty Standard implementation.\n/// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC2981.sol)\n/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/common/ERC2981.sol)\nabstract contract ERC2981 {\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* CUSTOM ERRORS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The royalty fee numerator exceeds the fee denominator.\n error RoyaltyOverflow();\n\n /// @dev The royalty receiver cannot be the zero address.\n error RoyaltyReceiverIsZeroAddress();\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* STORAGE */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The default royalty info is given by:\n /// ```\n /// let packed := sload(_ERC2981_MASTER_SLOT_SEED)\n /// let receiver := shr(96, packed)\n /// let royaltyFraction := xor(packed, shl(96, receiver))\n /// ```\n ///\n /// The per token royalty info is given by.\n /// ```\n /// mstore(0x00, tokenId)\n /// mstore(0x20, _ERC2981_MASTER_SLOT_SEED)\n /// let packed := sload(keccak256(0x00, 0x40))\n /// let receiver := shr(96, packed)\n /// let royaltyFraction := xor(packed, shl(96, receiver))\n /// ```\n uint256 private constant _ERC2981_MASTER_SLOT_SEED = 0xaa4ec00224afccfdb7;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* ERC2981 */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Checks that `_feeDenominator` is non-zero.\n constructor() {\n require(_feeDenominator() != 0, \"Fee denominator cannot be zero.\");\n }\n\n /// @dev Returns the denominator for the royalty amount.\n /// Defaults to 10000, which represents fees in basis points.\n /// Override this function to return a custom amount if needed.\n function _feeDenominator() internal pure virtual returns (uint96) {\n return 10000;\n }\n\n /// @dev Returns true if this contract implements the interface defined by `interfaceId`.\n /// See: https://eips.ethereum.org/EIPS/eip-165\n /// This function call must use less than 30000 gas.\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) {\n /// @solidity memory-safe-assembly\n assembly {\n let s := shr(224, interfaceId)\n // ERC165: 0x01ffc9a7, ERC2981: 0x2a55205a.\n result := or(eq(s, 0x01ffc9a7), eq(s, 0x2a55205a))\n }\n }\n\n /// @dev Returns the `receiver` and `royaltyAmount` for `tokenId` sold at `salePrice`.\n function royaltyInfo(uint256 tokenId, uint256 salePrice)\n public\n view\n virtual\n returns (address receiver, uint256 royaltyAmount)\n {\n uint256 feeDenominator = _feeDenominator();\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, tokenId)\n mstore(0x20, _ERC2981_MASTER_SLOT_SEED)\n let packed := sload(keccak256(0x00, 0x40))\n receiver := shr(96, packed)\n if iszero(receiver) {\n packed := sload(mload(0x20))\n receiver := shr(96, packed)\n }\n let x := salePrice\n let y := xor(packed, shl(96, receiver)) // `feeNumerator`.\n // Overflow check, equivalent to `require(y == 0 || x <= type(uint256).max / y)`.\n // Out-of-gas revert. Should not be triggered in practice, but included for safety.\n returndatacopy(returndatasize(), returndatasize(), mul(y, gt(x, div(not(0), y))))\n royaltyAmount := div(mul(x, y), feeDenominator)\n }\n }\n\n /// @dev Sets the default royalty `receiver` and `feeNumerator`.\n ///\n /// Requirements:\n /// - `receiver` must not be the zero address.\n /// - `feeNumerator` must not be greater than the fee denominator.\n function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {\n uint256 feeDenominator = _feeDenominator();\n /// @solidity memory-safe-assembly\n assembly {\n feeNumerator := shr(160, shl(160, feeNumerator))\n if gt(feeNumerator, feeDenominator) {\n mstore(0x00, 0x350a88b3) // `RoyaltyOverflow()`.\n revert(0x1c, 0x04)\n }\n let packed := shl(96, receiver)\n if iszero(packed) {\n mstore(0x00, 0xb4457eaa) // `RoyaltyReceiverIsZeroAddress()`.\n revert(0x1c, 0x04)\n }\n sstore(_ERC2981_MASTER_SLOT_SEED, or(packed, feeNumerator))\n }\n }\n\n /// @dev Sets the default royalty `receiver` and `feeNumerator` to zero.\n function _deleteDefaultRoyalty() internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n sstore(_ERC2981_MASTER_SLOT_SEED, 0)\n }\n }\n\n /// @dev Sets the royalty `receiver` and `feeNumerator` for `tokenId`.\n ///\n /// Requirements:\n /// - `receiver` must not be the zero address.\n /// - `feeNumerator` must not be greater than the fee denominator.\n function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator)\n internal\n virtual\n {\n uint256 feeDenominator = _feeDenominator();\n /// @solidity memory-safe-assembly\n assembly {\n feeNumerator := shr(160, shl(160, feeNumerator))\n if gt(feeNumerator, feeDenominator) {\n mstore(0x00, 0x350a88b3) // `RoyaltyOverflow()`.\n revert(0x1c, 0x04)\n }\n let packed := shl(96, receiver)\n if iszero(packed) {\n mstore(0x00, 0xb4457eaa) // `RoyaltyReceiverIsZeroAddress()`.\n revert(0x1c, 0x04)\n }\n mstore(0x00, tokenId)\n mstore(0x20, _ERC2981_MASTER_SLOT_SEED)\n sstore(keccak256(0x00, 0x40), or(packed, feeNumerator))\n }\n }\n\n /// @dev Sets the royalty `receiver` and `feeNumerator` for `tokenId` to zero.\n function _resetTokenRoyalty(uint256 tokenId) internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, tokenId)\n mstore(0x20, _ERC2981_MASTER_SLOT_SEED)\n sstore(keccak256(0x00, 0x40), 0)\n }\n }\n}\n" }, "lib/solady/src/auth/Ownable.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/// @notice Simple single owner authorization mixin.\n/// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol)\n/// @dev While the ownable portion follows\n/// [EIP-173](https://eips.ethereum.org/EIPS/eip-173) for compatibility,\n/// the nomenclature for the 2-step ownership handover may be unique to this codebase.\nabstract contract Ownable {\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* CUSTOM ERRORS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The caller is not authorized to call the function.\n error Unauthorized();\n\n /// @dev The `newOwner` cannot be the zero address.\n error NewOwnerIsZeroAddress();\n\n /// @dev The `pendingOwner` does not have a valid handover request.\n error NoHandoverRequest();\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* EVENTS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The ownership is transferred from `oldOwner` to `newOwner`.\n /// This event is intentionally kept the same as OpenZeppelin's Ownable to be\n /// compatible with indexers and [EIP-173](https://eips.ethereum.org/EIPS/eip-173),\n /// despite it not being as lightweight as a single argument event.\n event OwnershipTransferred(address indexed oldOwner, address indexed newOwner);\n\n /// @dev An ownership handover to `pendingOwner` has been requested.\n event OwnershipHandoverRequested(address indexed pendingOwner);\n\n /// @dev The ownership handover to `pendingOwner` has been canceled.\n event OwnershipHandoverCanceled(address indexed pendingOwner);\n\n /// @dev `keccak256(bytes(\"OwnershipTransferred(address,address)\"))`.\n uint256 private constant _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE =\n 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0;\n\n /// @dev `keccak256(bytes(\"OwnershipHandoverRequested(address)\"))`.\n uint256 private constant _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE =\n 0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d;\n\n /// @dev `keccak256(bytes(\"OwnershipHandoverCanceled(address)\"))`.\n uint256 private constant _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE =\n 0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* STORAGE */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The owner slot is given by: `not(_OWNER_SLOT_NOT)`.\n /// It is intentionally chosen to be a high value\n /// to avoid collision with lower slots.\n /// The choice of manual storage layout is to enable compatibility\n /// with both regular and upgradeable contracts.\n uint256 private constant _OWNER_SLOT_NOT = 0x8b78c6d8;\n\n /// The ownership handover slot of `newOwner` is given by:\n /// ```\n /// mstore(0x00, or(shl(96, user), _HANDOVER_SLOT_SEED))\n /// let handoverSlot := keccak256(0x00, 0x20)\n /// ```\n /// It stores the expiry timestamp of the two-step ownership handover.\n uint256 private constant _HANDOVER_SLOT_SEED = 0x389a75e1;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Initializes the owner directly without authorization guard.\n /// This function must be called upon initialization,\n /// regardless of whether the contract is upgradeable or not.\n /// This is to enable generalization to both regular and upgradeable contracts,\n /// and to save gas in case the initial owner is not the caller.\n /// For performance reasons, this function will not check if there\n /// is an existing owner.\n function _initializeOwner(address newOwner) internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // Clean the upper 96 bits.\n newOwner := shr(96, shl(96, newOwner))\n // Store the new value.\n sstore(not(_OWNER_SLOT_NOT), newOwner)\n // Emit the {OwnershipTransferred} event.\n log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner)\n }\n }\n\n /// @dev Sets the owner directly without authorization guard.\n function _setOwner(address newOwner) internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n let ownerSlot := not(_OWNER_SLOT_NOT)\n // Clean the upper 96 bits.\n newOwner := shr(96, shl(96, newOwner))\n // Emit the {OwnershipTransferred} event.\n log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner)\n // Store the new value.\n sstore(ownerSlot, newOwner)\n }\n }\n\n /// @dev Throws if the sender is not the owner.\n function _checkOwner() internal view virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // If the caller is not the stored owner, revert.\n if iszero(eq(caller(), sload(not(_OWNER_SLOT_NOT)))) {\n mstore(0x00, 0x82b42900) // `Unauthorized()`.\n revert(0x1c, 0x04)\n }\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* PUBLIC UPDATE FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Allows the owner to transfer the ownership to `newOwner`.\n function transferOwnership(address newOwner) public payable virtual onlyOwner {\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(shl(96, newOwner)) {\n mstore(0x00, 0x7448fbae) // `NewOwnerIsZeroAddress()`.\n revert(0x1c, 0x04)\n }\n }\n _setOwner(newOwner);\n }\n\n /// @dev Allows the owner to renounce their ownership.\n function renounceOwnership() public payable virtual onlyOwner {\n _setOwner(address(0));\n }\n\n /// @dev Request a two-step ownership handover to the caller.\n /// The request will automatically expire in 48 hours (172800 seconds) by default.\n function requestOwnershipHandover() public payable virtual {\n unchecked {\n uint256 expires = block.timestamp + ownershipHandoverValidFor();\n /// @solidity memory-safe-assembly\n assembly {\n // Compute and set the handover slot to `expires`.\n mstore(0x0c, _HANDOVER_SLOT_SEED)\n mstore(0x00, caller())\n sstore(keccak256(0x0c, 0x20), expires)\n // Emit the {OwnershipHandoverRequested} event.\n log2(0, 0, _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE, caller())\n }\n }\n }\n\n /// @dev Cancels the two-step ownership handover to the caller, if any.\n function cancelOwnershipHandover() public payable virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // Compute and set the handover slot to 0.\n mstore(0x0c, _HANDOVER_SLOT_SEED)\n mstore(0x00, caller())\n sstore(keccak256(0x0c, 0x20), 0)\n // Emit the {OwnershipHandoverCanceled} event.\n log2(0, 0, _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE, caller())\n }\n }\n\n /// @dev Allows the owner to complete the two-step ownership handover to `pendingOwner`.\n /// Reverts if there is no existing ownership handover requested by `pendingOwner`.\n function completeOwnershipHandover(address pendingOwner) public payable virtual onlyOwner {\n /// @solidity memory-safe-assembly\n assembly {\n // Compute and set the handover slot to 0.\n mstore(0x0c, _HANDOVER_SLOT_SEED)\n mstore(0x00, pendingOwner)\n let handoverSlot := keccak256(0x0c, 0x20)\n // If the handover does not exist, or has expired.\n if gt(timestamp(), sload(handoverSlot)) {\n mstore(0x00, 0x6f5e8818) // `NoHandoverRequest()`.\n revert(0x1c, 0x04)\n }\n // Set the handover slot to 0.\n sstore(handoverSlot, 0)\n }\n _setOwner(pendingOwner);\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* PUBLIC READ FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Returns the owner of the contract.\n function owner() public view virtual returns (address result) {\n /// @solidity memory-safe-assembly\n assembly {\n result := sload(not(_OWNER_SLOT_NOT))\n }\n }\n\n /// @dev Returns the expiry timestamp for the two-step ownership handover to `pendingOwner`.\n function ownershipHandoverExpiresAt(address pendingOwner)\n public\n view\n virtual\n returns (uint256 result)\n {\n /// @solidity memory-safe-assembly\n assembly {\n // Compute the handover slot.\n mstore(0x0c, _HANDOVER_SLOT_SEED)\n mstore(0x00, pendingOwner)\n // Load the handover slot.\n result := sload(keccak256(0x0c, 0x20))\n }\n }\n\n /// @dev Returns how long a two-step ownership handover is valid for in seconds.\n function ownershipHandoverValidFor() public view virtual returns (uint64) {\n return 48 * 3600;\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* MODIFIERS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Marks a function as only callable by the owner.\n modifier onlyOwner() virtual {\n _checkOwner();\n _;\n }\n}\n" }, "lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.19;\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 * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\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) || (address(this).code.length == 0 && _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" }, "src/lib/SeaDropErrorsAndEvents.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { CreatorPayout, PublicDrop } from \"./ERC721SeaDropStructs.sol\";\n\ninterface SeaDropErrorsAndEvents {\n /**\n * @notice The SeaDrop token types, emitted as part of\n * `event SeaDropTokenDeployed`.\n */\n enum SEADROP_TOKEN_TYPE {\n ERC721_STANDARD,\n ERC721_CLONE,\n ERC721_UPGRADEABLE,\n ERC1155_STANDARD,\n ERC1155_CLONE,\n ERC1155_UPGRADEABLE\n }\n\n /**\n * @notice An event to signify that a SeaDrop token contract was deployed.\n */\n event SeaDropTokenDeployed(SEADROP_TOKEN_TYPE tokenType);\n\n /**\n * @notice Revert with an error if the function selector is not supported.\n */\n error UnsupportedFunctionSelector(bytes4 selector);\n\n /**\n * @dev Revert with an error if the drop stage is not active.\n */\n error NotActive(\n uint256 currentTimestamp,\n uint256 startTimestamp,\n uint256 endTimestamp\n );\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the max allowed\n * to be minted per wallet.\n */\n error MintQuantityExceedsMaxMintedPerWallet(uint256 total, uint256 allowed);\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the max token\n * supply.\n */\n error MintQuantityExceedsMaxSupply(uint256 total, uint256 maxSupply);\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the max token\n * supply for the stage.\n * Note: The `maxTokenSupplyForStage` for public mint is\n * always `type(uint).max`.\n */\n error MintQuantityExceedsMaxTokenSupplyForStage(\n uint256 total,\n uint256 maxTokenSupplyForStage\n );\n\n /**\n * @dev Revert if the fee recipient is the zero address.\n */\n error FeeRecipientCannotBeZeroAddress();\n\n /**\n * @dev Revert if the fee recipient is not already included.\n */\n error FeeRecipientNotPresent();\n\n /**\n * @dev Revert if the fee basis points is greater than 10_000.\n */\n error InvalidFeeBps(uint256 feeBps);\n\n /**\n * @dev Revert if the fee recipient is already included.\n */\n error DuplicateFeeRecipient();\n\n /**\n * @dev Revert if the fee recipient is restricted and not allowed.\n */\n error FeeRecipientNotAllowed(address got);\n\n /**\n * @dev Revert if the creator payout address is the zero address.\n */\n error CreatorPayoutAddressCannotBeZeroAddress();\n\n /**\n * @dev Revert if the creator payouts are not set.\n */\n error CreatorPayoutsNotSet();\n\n /**\n * @dev Revert if the creator payout basis points are zero.\n */\n error CreatorPayoutBasisPointsCannotBeZero();\n\n /**\n * @dev Revert if the total basis points for the creator payouts\n * don't equal exactly 10_000.\n */\n error InvalidCreatorPayoutTotalBasisPoints(\n uint256 totalReceivedBasisPoints\n );\n\n /**\n * @dev Revert if the creator payout basis points don't add up to 10_000.\n */\n error InvalidCreatorPayoutBasisPoints(uint256 totalReceivedBasisPoints);\n\n /**\n * @dev Revert with an error if the allow list proof is invalid.\n */\n error InvalidProof();\n\n /**\n * @dev Revert if a supplied signer address is the zero address.\n */\n error SignerCannotBeZeroAddress();\n\n /**\n * @dev Revert with an error if a signer is not included in\n * the enumeration when removing.\n */\n error SignerNotPresent();\n\n /**\n * @dev Revert with an error if a payer is not included in\n * the enumeration when removing.\n */\n error PayerNotPresent();\n\n /**\n * @dev Revert with an error if a payer is already included in mapping\n * when adding.\n */\n error DuplicatePayer();\n\n /**\n * @dev Revert with an error if a signer is already included in mapping\n * when adding.\n */\n error DuplicateSigner();\n\n /**\n * @dev Revert with an error if the payer is not allowed. The minter must\n * pay for their own mint.\n */\n error PayerNotAllowed(address got);\n\n /**\n * @dev Revert if a supplied payer address is the zero address.\n */\n error PayerCannotBeZeroAddress();\n\n /**\n * @dev Revert if the start time is greater than the end time.\n */\n error InvalidStartAndEndTime(uint256 startTime, uint256 endTime);\n\n /**\n * @dev Revert with an error if the signer payment token is not the same.\n */\n error InvalidSignedPaymentToken(address got, address want);\n\n /**\n * @dev Revert with an error if supplied signed mint price is less than\n * the minimum specified.\n */\n error InvalidSignedMintPrice(\n address paymentToken,\n uint256 got,\n uint256 minimum\n );\n\n /**\n * @dev Revert with an error if supplied signed maxTotalMintableByWallet\n * is greater than the maximum specified.\n */\n error InvalidSignedMaxTotalMintableByWallet(uint256 got, uint256 maximum);\n\n /**\n * @dev Revert with an error if supplied signed\n * maxTotalMintableByWalletPerToken is greater than the maximum\n * specified.\n */\n error InvalidSignedMaxTotalMintableByWalletPerToken(\n uint256 got,\n uint256 maximum\n );\n\n /**\n * @dev Revert with an error if the fromTokenId is not within range.\n */\n error InvalidSignedFromTokenId(uint256 got, uint256 minimum);\n\n /**\n * @dev Revert with an error if the toTokenId is not within range.\n */\n error InvalidSignedToTokenId(uint256 got, uint256 maximum);\n\n /**\n * @dev Revert with an error if supplied signed start time is less than\n * the minimum specified.\n */\n error InvalidSignedStartTime(uint256 got, uint256 minimum);\n\n /**\n * @dev Revert with an error if supplied signed end time is greater than\n * the maximum specified.\n */\n error InvalidSignedEndTime(uint256 got, uint256 maximum);\n\n /**\n * @dev Revert with an error if supplied signed maxTokenSupplyForStage\n * is greater than the maximum specified.\n */\n error InvalidSignedMaxTokenSupplyForStage(uint256 got, uint256 maximum);\n\n /**\n * @dev Revert with an error if supplied signed feeBps is greater than\n * the maximum specified, or less than the minimum.\n */\n error InvalidSignedFeeBps(uint256 got, uint256 minimumOrMaximum);\n\n /**\n * @dev Revert with an error if signed mint did not specify to restrict\n * fee recipients.\n */\n error SignedMintsMustRestrictFeeRecipients();\n\n /**\n * @dev Revert with an error if a signature for a signed mint has already\n * been used.\n */\n error SignatureAlreadyUsed();\n\n /**\n * @dev Revert with an error if the contract has no balance to withdraw.\n */\n error NoBalanceToWithdraw();\n\n /**\n * @dev Revert with an error if the caller is not an allowed Seaport.\n */\n error InvalidCallerOnlyAllowedSeaport(address caller);\n\n /**\n * @dev Revert with an error if the order does not have the ERC1155 magic\n * consideration item to signify a consecutive mint.\n */\n error MustSpecifyERC1155ConsiderationItemForSeaDropMint();\n\n /**\n * @dev Revert with an error if the extra data version is not supported.\n */\n error UnsupportedExtraDataVersion(uint8 version);\n\n /**\n * @dev Revert with an error if the extra data encoding is not supported.\n */\n error InvalidExtraDataEncoding(uint8 version);\n\n /**\n * @dev Revert with an error if the provided substandard is not supported.\n */\n error InvalidSubstandard(uint8 substandard);\n\n /**\n * @dev Revert with an error if the implementation contract is called without\n * delegatecall.\n */\n error OnlyDelegateCalled();\n\n /**\n * @dev Revert with an error if the provided allowed Seaport is the\n * zero address.\n */\n error AllowedSeaportCannotBeZeroAddress();\n\n /**\n * @dev Emit an event when allowed Seaport contracts are updated.\n */\n event AllowedSeaportUpdated(address[] allowedSeaport);\n\n /**\n * @dev An event with details of a SeaDrop mint, for analytical purposes.\n *\n * @param payer The address who payed for the tx.\n * @param dropStageIndex The drop stage index. Items minted through\n * public mint have dropStageIndex of 0\n */\n event SeaDropMint(address payer, uint256 dropStageIndex);\n\n /**\n * @dev An event with updated allow list data.\n *\n * @param previousMerkleRoot The previous allow list merkle root.\n * @param newMerkleRoot The new allow list merkle root.\n * @param publicKeyURI If the allow list is encrypted, the public key\n * URIs that can decrypt the list.\n * Empty if unencrypted.\n * @param allowListURI The URI for the allow list.\n */\n event AllowListUpdated(\n bytes32 indexed previousMerkleRoot,\n bytes32 indexed newMerkleRoot,\n string[] publicKeyURI,\n string allowListURI\n );\n\n /**\n * @dev An event with updated drop URI.\n */\n event DropURIUpdated(string newDropURI);\n\n /**\n * @dev An event with the updated creator payout address.\n */\n event CreatorPayoutsUpdated(CreatorPayout[] creatorPayouts);\n\n /**\n * @dev An event with the updated allowed fee recipient.\n */\n event AllowedFeeRecipientUpdated(\n address indexed feeRecipient,\n bool indexed allowed\n );\n\n /**\n * @dev An event with the updated signer.\n */\n event SignerUpdated(address indexed signer, bool indexed allowed);\n\n /**\n * @dev An event with the updated payer.\n */\n event PayerUpdated(address indexed payer, bool indexed allowed);\n}\n" }, "lib/seaport/lib/seaport-types/src/lib/ConsiderationEnums.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nenum OrderType {\n // 0: no partial fills, anyone can execute\n FULL_OPEN,\n\n // 1: partial fills supported, anyone can execute\n PARTIAL_OPEN,\n\n // 2: no partial fills, only offerer or zone can execute\n FULL_RESTRICTED,\n\n // 3: partial fills supported, only offerer or zone can execute\n PARTIAL_RESTRICTED,\n\n // 4: contract order type\n CONTRACT\n}\n\nenum BasicOrderType {\n // 0: no partial fills, anyone can execute\n ETH_TO_ERC721_FULL_OPEN,\n\n // 1: partial fills supported, anyone can execute\n ETH_TO_ERC721_PARTIAL_OPEN,\n\n // 2: no partial fills, only offerer or zone can execute\n ETH_TO_ERC721_FULL_RESTRICTED,\n\n // 3: partial fills supported, only offerer or zone can execute\n ETH_TO_ERC721_PARTIAL_RESTRICTED,\n\n // 4: no partial fills, anyone can execute\n ETH_TO_ERC1155_FULL_OPEN,\n\n // 5: partial fills supported, anyone can execute\n ETH_TO_ERC1155_PARTIAL_OPEN,\n\n // 6: no partial fills, only offerer or zone can execute\n ETH_TO_ERC1155_FULL_RESTRICTED,\n\n // 7: partial fills supported, only offerer or zone can execute\n ETH_TO_ERC1155_PARTIAL_RESTRICTED,\n\n // 8: no partial fills, anyone can execute\n ERC20_TO_ERC721_FULL_OPEN,\n\n // 9: partial fills supported, anyone can execute\n ERC20_TO_ERC721_PARTIAL_OPEN,\n\n // 10: no partial fills, only offerer or zone can execute\n ERC20_TO_ERC721_FULL_RESTRICTED,\n\n // 11: partial fills supported, only offerer or zone can execute\n ERC20_TO_ERC721_PARTIAL_RESTRICTED,\n\n // 12: no partial fills, anyone can execute\n ERC20_TO_ERC1155_FULL_OPEN,\n\n // 13: partial fills supported, anyone can execute\n ERC20_TO_ERC1155_PARTIAL_OPEN,\n\n // 14: no partial fills, only offerer or zone can execute\n ERC20_TO_ERC1155_FULL_RESTRICTED,\n\n // 15: partial fills supported, only offerer or zone can execute\n ERC20_TO_ERC1155_PARTIAL_RESTRICTED,\n\n // 16: no partial fills, anyone can execute\n ERC721_TO_ERC20_FULL_OPEN,\n\n // 17: partial fills supported, anyone can execute\n ERC721_TO_ERC20_PARTIAL_OPEN,\n\n // 18: no partial fills, only offerer or zone can execute\n ERC721_TO_ERC20_FULL_RESTRICTED,\n\n // 19: partial fills supported, only offerer or zone can execute\n ERC721_TO_ERC20_PARTIAL_RESTRICTED,\n\n // 20: no partial fills, anyone can execute\n ERC1155_TO_ERC20_FULL_OPEN,\n\n // 21: partial fills supported, anyone can execute\n ERC1155_TO_ERC20_PARTIAL_OPEN,\n\n // 22: no partial fills, only offerer or zone can execute\n ERC1155_TO_ERC20_FULL_RESTRICTED,\n\n // 23: partial fills supported, only offerer or zone can execute\n ERC1155_TO_ERC20_PARTIAL_RESTRICTED\n}\n\nenum BasicOrderRouteType {\n // 0: provide Ether (or other native token) to receive offered ERC721 item.\n ETH_TO_ERC721,\n\n // 1: provide Ether (or other native token) to receive offered ERC1155 item.\n ETH_TO_ERC1155,\n\n // 2: provide ERC20 item to receive offered ERC721 item.\n ERC20_TO_ERC721,\n\n // 3: provide ERC20 item to receive offered ERC1155 item.\n ERC20_TO_ERC1155,\n\n // 4: provide ERC721 item to receive offered ERC20 item.\n ERC721_TO_ERC20,\n\n // 5: provide ERC1155 item to receive offered ERC20 item.\n ERC1155_TO_ERC20\n}\n\nenum ItemType {\n // 0: ETH on mainnet, MATIC on polygon, etc.\n NATIVE,\n\n // 1: ERC20 items (ERC777 and ERC20 analogues could also technically work)\n ERC20,\n\n // 2: ERC721 items\n ERC721,\n\n // 3: ERC1155 items\n ERC1155,\n\n // 4: ERC721 items where a number of tokenIds are supported\n ERC721_WITH_CRITERIA,\n\n // 5: ERC1155 items where a number of ids are supported\n ERC1155_WITH_CRITERIA\n}\n\nenum Side {\n // 0: Items that can be spent\n OFFER,\n\n // 1: Items that must be received\n CONSIDERATION\n}\n" }, "lib/seaport/lib/seaport-types/src/helpers/PointerLibraries.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\ntype CalldataPointer is uint256;\n\ntype ReturndataPointer is uint256;\n\ntype MemoryPointer is uint256;\n\nusing CalldataPointerLib for CalldataPointer global;\nusing MemoryPointerLib for MemoryPointer global;\nusing ReturndataPointerLib for ReturndataPointer global;\n\nusing CalldataReaders for CalldataPointer global;\nusing ReturndataReaders for ReturndataPointer global;\nusing MemoryReaders for MemoryPointer global;\nusing MemoryWriters for MemoryPointer global;\n\nCalldataPointer constant CalldataStart = CalldataPointer.wrap(0x04);\nMemoryPointer constant FreeMemoryPPtr = MemoryPointer.wrap(0x40);\nuint256 constant IdentityPrecompileAddress = 0x4;\nuint256 constant OffsetOrLengthMask = 0xffffffff;\nuint256 constant _OneWord = 0x20;\nuint256 constant _FreeMemoryPointerSlot = 0x40;\n\n/// @dev Allocates `size` bytes in memory by increasing the free memory pointer\n/// and returns the memory pointer to the first byte of the allocated region.\n// (Free functions cannot have visibility.)\n// solhint-disable-next-line func-visibility\nfunction malloc(uint256 size) pure returns (MemoryPointer mPtr) {\n assembly {\n mPtr := mload(_FreeMemoryPointerSlot)\n mstore(_FreeMemoryPointerSlot, add(mPtr, size))\n }\n}\n\n// (Free functions cannot have visibility.)\n// solhint-disable-next-line func-visibility\nfunction getFreeMemoryPointer() pure returns (MemoryPointer mPtr) {\n mPtr = FreeMemoryPPtr.readMemoryPointer();\n}\n\n// (Free functions cannot have visibility.)\n// solhint-disable-next-line func-visibility\nfunction setFreeMemoryPointer(MemoryPointer mPtr) pure {\n FreeMemoryPPtr.write(mPtr);\n}\n\nlibrary CalldataPointerLib {\n function lt(\n CalldataPointer a,\n CalldataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := lt(a, b)\n }\n }\n\n function gt(\n CalldataPointer a,\n CalldataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := gt(a, b)\n }\n }\n\n function eq(\n CalldataPointer a,\n CalldataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := eq(a, b)\n }\n }\n\n function isNull(CalldataPointer a) internal pure returns (bool b) {\n assembly {\n b := iszero(a)\n }\n }\n\n /// @dev Resolves an offset stored at `cdPtr + headOffset` to a calldata.\n /// pointer `cdPtr` must point to some parent object with a dynamic\n /// type's head stored at `cdPtr + headOffset`.\n function pptr(\n CalldataPointer cdPtr,\n uint256 headOffset\n ) internal pure returns (CalldataPointer cdPtrChild) {\n cdPtrChild = cdPtr.offset(\n cdPtr.offset(headOffset).readUint256() & OffsetOrLengthMask\n );\n }\n\n /// @dev Resolves an offset stored at `cdPtr` to a calldata pointer.\n /// `cdPtr` must point to some parent object with a dynamic type as its\n /// first member, e.g. `struct { bytes data; }`\n function pptr(\n CalldataPointer cdPtr\n ) internal pure returns (CalldataPointer cdPtrChild) {\n cdPtrChild = cdPtr.offset(cdPtr.readUint256() & OffsetOrLengthMask);\n }\n\n /// @dev Returns the calldata pointer one word after `cdPtr`.\n function next(\n CalldataPointer cdPtr\n ) internal pure returns (CalldataPointer cdPtrNext) {\n assembly {\n cdPtrNext := add(cdPtr, _OneWord)\n }\n }\n\n /// @dev Returns the calldata pointer `_offset` bytes after `cdPtr`.\n function offset(\n CalldataPointer cdPtr,\n uint256 _offset\n ) internal pure returns (CalldataPointer cdPtrNext) {\n assembly {\n cdPtrNext := add(cdPtr, _offset)\n }\n }\n\n /// @dev Copies `size` bytes from calldata starting at `src` to memory at\n /// `dst`.\n function copy(\n CalldataPointer src,\n MemoryPointer dst,\n uint256 size\n ) internal pure {\n assembly {\n calldatacopy(dst, src, size)\n }\n }\n}\n\nlibrary ReturndataPointerLib {\n function lt(\n ReturndataPointer a,\n ReturndataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := lt(a, b)\n }\n }\n\n function gt(\n ReturndataPointer a,\n ReturndataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := gt(a, b)\n }\n }\n\n function eq(\n ReturndataPointer a,\n ReturndataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := eq(a, b)\n }\n }\n\n function isNull(ReturndataPointer a) internal pure returns (bool b) {\n assembly {\n b := iszero(a)\n }\n }\n\n /// @dev Resolves an offset stored at `rdPtr + headOffset` to a returndata\n /// pointer. `rdPtr` must point to some parent object with a dynamic\n /// type's head stored at `rdPtr + headOffset`.\n function pptr(\n ReturndataPointer rdPtr,\n uint256 headOffset\n ) internal pure returns (ReturndataPointer rdPtrChild) {\n rdPtrChild = rdPtr.offset(\n rdPtr.offset(headOffset).readUint256() & OffsetOrLengthMask\n );\n }\n\n /// @dev Resolves an offset stored at `rdPtr` to a returndata pointer.\n /// `rdPtr` must point to some parent object with a dynamic type as its\n /// first member, e.g. `struct { bytes data; }`\n function pptr(\n ReturndataPointer rdPtr\n ) internal pure returns (ReturndataPointer rdPtrChild) {\n rdPtrChild = rdPtr.offset(rdPtr.readUint256() & OffsetOrLengthMask);\n }\n\n /// @dev Returns the returndata pointer one word after `cdPtr`.\n function next(\n ReturndataPointer rdPtr\n ) internal pure returns (ReturndataPointer rdPtrNext) {\n assembly {\n rdPtrNext := add(rdPtr, _OneWord)\n }\n }\n\n /// @dev Returns the returndata pointer `_offset` bytes after `cdPtr`.\n function offset(\n ReturndataPointer rdPtr,\n uint256 _offset\n ) internal pure returns (ReturndataPointer rdPtrNext) {\n assembly {\n rdPtrNext := add(rdPtr, _offset)\n }\n }\n\n /// @dev Copies `size` bytes from returndata starting at `src` to memory at\n /// `dst`.\n function copy(\n ReturndataPointer src,\n MemoryPointer dst,\n uint256 size\n ) internal pure {\n assembly {\n returndatacopy(dst, src, size)\n }\n }\n}\n\nlibrary MemoryPointerLib {\n function copy(\n MemoryPointer src,\n MemoryPointer dst,\n uint256 size\n ) internal view {\n assembly {\n let success := staticcall(\n gas(),\n IdentityPrecompileAddress,\n src,\n size,\n dst,\n size\n )\n if or(iszero(returndatasize()), iszero(success)) {\n revert(0, 0)\n }\n }\n }\n\n function lt(\n MemoryPointer a,\n MemoryPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := lt(a, b)\n }\n }\n\n function gt(\n MemoryPointer a,\n MemoryPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := gt(a, b)\n }\n }\n\n function eq(\n MemoryPointer a,\n MemoryPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := eq(a, b)\n }\n }\n\n function isNull(MemoryPointer a) internal pure returns (bool b) {\n assembly {\n b := iszero(a)\n }\n }\n\n function hash(\n MemoryPointer ptr,\n uint256 length\n ) internal pure returns (bytes32 _hash) {\n assembly {\n _hash := keccak256(ptr, length)\n }\n }\n\n /// @dev Returns the memory pointer one word after `mPtr`.\n function next(\n MemoryPointer mPtr\n ) internal pure returns (MemoryPointer mPtrNext) {\n assembly {\n mPtrNext := add(mPtr, _OneWord)\n }\n }\n\n /// @dev Returns the memory pointer `_offset` bytes after `mPtr`.\n function offset(\n MemoryPointer mPtr,\n uint256 _offset\n ) internal pure returns (MemoryPointer mPtrNext) {\n assembly {\n mPtrNext := add(mPtr, _offset)\n }\n }\n\n /// @dev Resolves a pointer at `mPtr + headOffset` to a memory\n /// pointer. `mPtr` must point to some parent object with a dynamic\n /// type's pointer stored at `mPtr + headOffset`.\n function pptr(\n MemoryPointer mPtr,\n uint256 headOffset\n ) internal pure returns (MemoryPointer mPtrChild) {\n mPtrChild = mPtr.offset(headOffset).readMemoryPointer();\n }\n\n /// @dev Resolves a pointer stored at `mPtr` to a memory pointer.\n /// `mPtr` must point to some parent object with a dynamic type as its\n /// first member, e.g. `struct { bytes data; }`\n function pptr(\n MemoryPointer mPtr\n ) internal pure returns (MemoryPointer mPtrChild) {\n mPtrChild = mPtr.readMemoryPointer();\n }\n}\n\nlibrary CalldataReaders {\n /// @dev Reads the value at `cdPtr` and applies a mask to return only the\n /// last 4 bytes.\n function readMaskedUint256(\n CalldataPointer cdPtr\n ) internal pure returns (uint256 value) {\n value = cdPtr.readUint256() & OffsetOrLengthMask;\n }\n\n /// @dev Reads the bool at `cdPtr` in calldata.\n function readBool(\n CalldataPointer cdPtr\n ) internal pure returns (bool value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the address at `cdPtr` in calldata.\n function readAddress(\n CalldataPointer cdPtr\n ) internal pure returns (address value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes1 at `cdPtr` in calldata.\n function readBytes1(\n CalldataPointer cdPtr\n ) internal pure returns (bytes1 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes2 at `cdPtr` in calldata.\n function readBytes2(\n CalldataPointer cdPtr\n ) internal pure returns (bytes2 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes3 at `cdPtr` in calldata.\n function readBytes3(\n CalldataPointer cdPtr\n ) internal pure returns (bytes3 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes4 at `cdPtr` in calldata.\n function readBytes4(\n CalldataPointer cdPtr\n ) internal pure returns (bytes4 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes5 at `cdPtr` in calldata.\n function readBytes5(\n CalldataPointer cdPtr\n ) internal pure returns (bytes5 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes6 at `cdPtr` in calldata.\n function readBytes6(\n CalldataPointer cdPtr\n ) internal pure returns (bytes6 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes7 at `cdPtr` in calldata.\n function readBytes7(\n CalldataPointer cdPtr\n ) internal pure returns (bytes7 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes8 at `cdPtr` in calldata.\n function readBytes8(\n CalldataPointer cdPtr\n ) internal pure returns (bytes8 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes9 at `cdPtr` in calldata.\n function readBytes9(\n CalldataPointer cdPtr\n ) internal pure returns (bytes9 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes10 at `cdPtr` in calldata.\n function readBytes10(\n CalldataPointer cdPtr\n ) internal pure returns (bytes10 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes11 at `cdPtr` in calldata.\n function readBytes11(\n CalldataPointer cdPtr\n ) internal pure returns (bytes11 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes12 at `cdPtr` in calldata.\n function readBytes12(\n CalldataPointer cdPtr\n ) internal pure returns (bytes12 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes13 at `cdPtr` in calldata.\n function readBytes13(\n CalldataPointer cdPtr\n ) internal pure returns (bytes13 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes14 at `cdPtr` in calldata.\n function readBytes14(\n CalldataPointer cdPtr\n ) internal pure returns (bytes14 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes15 at `cdPtr` in calldata.\n function readBytes15(\n CalldataPointer cdPtr\n ) internal pure returns (bytes15 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes16 at `cdPtr` in calldata.\n function readBytes16(\n CalldataPointer cdPtr\n ) internal pure returns (bytes16 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes17 at `cdPtr` in calldata.\n function readBytes17(\n CalldataPointer cdPtr\n ) internal pure returns (bytes17 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes18 at `cdPtr` in calldata.\n function readBytes18(\n CalldataPointer cdPtr\n ) internal pure returns (bytes18 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes19 at `cdPtr` in calldata.\n function readBytes19(\n CalldataPointer cdPtr\n ) internal pure returns (bytes19 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes20 at `cdPtr` in calldata.\n function readBytes20(\n CalldataPointer cdPtr\n ) internal pure returns (bytes20 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes21 at `cdPtr` in calldata.\n function readBytes21(\n CalldataPointer cdPtr\n ) internal pure returns (bytes21 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes22 at `cdPtr` in calldata.\n function readBytes22(\n CalldataPointer cdPtr\n ) internal pure returns (bytes22 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes23 at `cdPtr` in calldata.\n function readBytes23(\n CalldataPointer cdPtr\n ) internal pure returns (bytes23 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes24 at `cdPtr` in calldata.\n function readBytes24(\n CalldataPointer cdPtr\n ) internal pure returns (bytes24 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes25 at `cdPtr` in calldata.\n function readBytes25(\n CalldataPointer cdPtr\n ) internal pure returns (bytes25 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes26 at `cdPtr` in calldata.\n function readBytes26(\n CalldataPointer cdPtr\n ) internal pure returns (bytes26 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes27 at `cdPtr` in calldata.\n function readBytes27(\n CalldataPointer cdPtr\n ) internal pure returns (bytes27 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes28 at `cdPtr` in calldata.\n function readBytes28(\n CalldataPointer cdPtr\n ) internal pure returns (bytes28 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes29 at `cdPtr` in calldata.\n function readBytes29(\n CalldataPointer cdPtr\n ) internal pure returns (bytes29 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes30 at `cdPtr` in calldata.\n function readBytes30(\n CalldataPointer cdPtr\n ) internal pure returns (bytes30 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes31 at `cdPtr` in calldata.\n function readBytes31(\n CalldataPointer cdPtr\n ) internal pure returns (bytes31 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes32 at `cdPtr` in calldata.\n function readBytes32(\n CalldataPointer cdPtr\n ) internal pure returns (bytes32 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint8 at `cdPtr` in calldata.\n function readUint8(\n CalldataPointer cdPtr\n ) internal pure returns (uint8 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint16 at `cdPtr` in calldata.\n function readUint16(\n CalldataPointer cdPtr\n ) internal pure returns (uint16 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint24 at `cdPtr` in calldata.\n function readUint24(\n CalldataPointer cdPtr\n ) internal pure returns (uint24 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint32 at `cdPtr` in calldata.\n function readUint32(\n CalldataPointer cdPtr\n ) internal pure returns (uint32 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint40 at `cdPtr` in calldata.\n function readUint40(\n CalldataPointer cdPtr\n ) internal pure returns (uint40 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint48 at `cdPtr` in calldata.\n function readUint48(\n CalldataPointer cdPtr\n ) internal pure returns (uint48 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint56 at `cdPtr` in calldata.\n function readUint56(\n CalldataPointer cdPtr\n ) internal pure returns (uint56 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint64 at `cdPtr` in calldata.\n function readUint64(\n CalldataPointer cdPtr\n ) internal pure returns (uint64 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint72 at `cdPtr` in calldata.\n function readUint72(\n CalldataPointer cdPtr\n ) internal pure returns (uint72 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint80 at `cdPtr` in calldata.\n function readUint80(\n CalldataPointer cdPtr\n ) internal pure returns (uint80 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint88 at `cdPtr` in calldata.\n function readUint88(\n CalldataPointer cdPtr\n ) internal pure returns (uint88 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint96 at `cdPtr` in calldata.\n function readUint96(\n CalldataPointer cdPtr\n ) internal pure returns (uint96 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint104 at `cdPtr` in calldata.\n function readUint104(\n CalldataPointer cdPtr\n ) internal pure returns (uint104 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint112 at `cdPtr` in calldata.\n function readUint112(\n CalldataPointer cdPtr\n ) internal pure returns (uint112 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint120 at `cdPtr` in calldata.\n function readUint120(\n CalldataPointer cdPtr\n ) internal pure returns (uint120 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint128 at `cdPtr` in calldata.\n function readUint128(\n CalldataPointer cdPtr\n ) internal pure returns (uint128 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint136 at `cdPtr` in calldata.\n function readUint136(\n CalldataPointer cdPtr\n ) internal pure returns (uint136 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint144 at `cdPtr` in calldata.\n function readUint144(\n CalldataPointer cdPtr\n ) internal pure returns (uint144 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint152 at `cdPtr` in calldata.\n function readUint152(\n CalldataPointer cdPtr\n ) internal pure returns (uint152 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint160 at `cdPtr` in calldata.\n function readUint160(\n CalldataPointer cdPtr\n ) internal pure returns (uint160 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint168 at `cdPtr` in calldata.\n function readUint168(\n CalldataPointer cdPtr\n ) internal pure returns (uint168 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint176 at `cdPtr` in calldata.\n function readUint176(\n CalldataPointer cdPtr\n ) internal pure returns (uint176 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint184 at `cdPtr` in calldata.\n function readUint184(\n CalldataPointer cdPtr\n ) internal pure returns (uint184 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint192 at `cdPtr` in calldata.\n function readUint192(\n CalldataPointer cdPtr\n ) internal pure returns (uint192 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint200 at `cdPtr` in calldata.\n function readUint200(\n CalldataPointer cdPtr\n ) internal pure returns (uint200 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint208 at `cdPtr` in calldata.\n function readUint208(\n CalldataPointer cdPtr\n ) internal pure returns (uint208 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint216 at `cdPtr` in calldata.\n function readUint216(\n CalldataPointer cdPtr\n ) internal pure returns (uint216 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint224 at `cdPtr` in calldata.\n function readUint224(\n CalldataPointer cdPtr\n ) internal pure returns (uint224 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint232 at `cdPtr` in calldata.\n function readUint232(\n CalldataPointer cdPtr\n ) internal pure returns (uint232 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint240 at `cdPtr` in calldata.\n function readUint240(\n CalldataPointer cdPtr\n ) internal pure returns (uint240 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint248 at `cdPtr` in calldata.\n function readUint248(\n CalldataPointer cdPtr\n ) internal pure returns (uint248 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint256 at `cdPtr` in calldata.\n function readUint256(\n CalldataPointer cdPtr\n ) internal pure returns (uint256 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int8 at `cdPtr` in calldata.\n function readInt8(\n CalldataPointer cdPtr\n ) internal pure returns (int8 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int16 at `cdPtr` in calldata.\n function readInt16(\n CalldataPointer cdPtr\n ) internal pure returns (int16 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int24 at `cdPtr` in calldata.\n function readInt24(\n CalldataPointer cdPtr\n ) internal pure returns (int24 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int32 at `cdPtr` in calldata.\n function readInt32(\n CalldataPointer cdPtr\n ) internal pure returns (int32 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int40 at `cdPtr` in calldata.\n function readInt40(\n CalldataPointer cdPtr\n ) internal pure returns (int40 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int48 at `cdPtr` in calldata.\n function readInt48(\n CalldataPointer cdPtr\n ) internal pure returns (int48 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int56 at `cdPtr` in calldata.\n function readInt56(\n CalldataPointer cdPtr\n ) internal pure returns (int56 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int64 at `cdPtr` in calldata.\n function readInt64(\n CalldataPointer cdPtr\n ) internal pure returns (int64 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int72 at `cdPtr` in calldata.\n function readInt72(\n CalldataPointer cdPtr\n ) internal pure returns (int72 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int80 at `cdPtr` in calldata.\n function readInt80(\n CalldataPointer cdPtr\n ) internal pure returns (int80 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int88 at `cdPtr` in calldata.\n function readInt88(\n CalldataPointer cdPtr\n ) internal pure returns (int88 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int96 at `cdPtr` in calldata.\n function readInt96(\n CalldataPointer cdPtr\n ) internal pure returns (int96 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int104 at `cdPtr` in calldata.\n function readInt104(\n CalldataPointer cdPtr\n ) internal pure returns (int104 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int112 at `cdPtr` in calldata.\n function readInt112(\n CalldataPointer cdPtr\n ) internal pure returns (int112 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int120 at `cdPtr` in calldata.\n function readInt120(\n CalldataPointer cdPtr\n ) internal pure returns (int120 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int128 at `cdPtr` in calldata.\n function readInt128(\n CalldataPointer cdPtr\n ) internal pure returns (int128 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int136 at `cdPtr` in calldata.\n function readInt136(\n CalldataPointer cdPtr\n ) internal pure returns (int136 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int144 at `cdPtr` in calldata.\n function readInt144(\n CalldataPointer cdPtr\n ) internal pure returns (int144 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int152 at `cdPtr` in calldata.\n function readInt152(\n CalldataPointer cdPtr\n ) internal pure returns (int152 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int160 at `cdPtr` in calldata.\n function readInt160(\n CalldataPointer cdPtr\n ) internal pure returns (int160 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int168 at `cdPtr` in calldata.\n function readInt168(\n CalldataPointer cdPtr\n ) internal pure returns (int168 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int176 at `cdPtr` in calldata.\n function readInt176(\n CalldataPointer cdPtr\n ) internal pure returns (int176 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int184 at `cdPtr` in calldata.\n function readInt184(\n CalldataPointer cdPtr\n ) internal pure returns (int184 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int192 at `cdPtr` in calldata.\n function readInt192(\n CalldataPointer cdPtr\n ) internal pure returns (int192 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int200 at `cdPtr` in calldata.\n function readInt200(\n CalldataPointer cdPtr\n ) internal pure returns (int200 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int208 at `cdPtr` in calldata.\n function readInt208(\n CalldataPointer cdPtr\n ) internal pure returns (int208 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int216 at `cdPtr` in calldata.\n function readInt216(\n CalldataPointer cdPtr\n ) internal pure returns (int216 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int224 at `cdPtr` in calldata.\n function readInt224(\n CalldataPointer cdPtr\n ) internal pure returns (int224 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int232 at `cdPtr` in calldata.\n function readInt232(\n CalldataPointer cdPtr\n ) internal pure returns (int232 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int240 at `cdPtr` in calldata.\n function readInt240(\n CalldataPointer cdPtr\n ) internal pure returns (int240 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int248 at `cdPtr` in calldata.\n function readInt248(\n CalldataPointer cdPtr\n ) internal pure returns (int248 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int256 at `cdPtr` in calldata.\n function readInt256(\n CalldataPointer cdPtr\n ) internal pure returns (int256 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n}\n\nlibrary ReturndataReaders {\n /// @dev Reads value at `rdPtr` & applies a mask to return only last 4 bytes\n function readMaskedUint256(\n ReturndataPointer rdPtr\n ) internal pure returns (uint256 value) {\n value = rdPtr.readUint256() & OffsetOrLengthMask;\n }\n\n /// @dev Reads the bool at `rdPtr` in returndata.\n function readBool(\n ReturndataPointer rdPtr\n ) internal pure returns (bool value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the address at `rdPtr` in returndata.\n function readAddress(\n ReturndataPointer rdPtr\n ) internal pure returns (address value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes1 at `rdPtr` in returndata.\n function readBytes1(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes1 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes2 at `rdPtr` in returndata.\n function readBytes2(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes2 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes3 at `rdPtr` in returndata.\n function readBytes3(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes3 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes4 at `rdPtr` in returndata.\n function readBytes4(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes4 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes5 at `rdPtr` in returndata.\n function readBytes5(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes5 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes6 at `rdPtr` in returndata.\n function readBytes6(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes6 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes7 at `rdPtr` in returndata.\n function readBytes7(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes7 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes8 at `rdPtr` in returndata.\n function readBytes8(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes8 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes9 at `rdPtr` in returndata.\n function readBytes9(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes9 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes10 at `rdPtr` in returndata.\n function readBytes10(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes10 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes11 at `rdPtr` in returndata.\n function readBytes11(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes11 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes12 at `rdPtr` in returndata.\n function readBytes12(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes12 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes13 at `rdPtr` in returndata.\n function readBytes13(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes13 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes14 at `rdPtr` in returndata.\n function readBytes14(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes14 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes15 at `rdPtr` in returndata.\n function readBytes15(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes15 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes16 at `rdPtr` in returndata.\n function readBytes16(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes16 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes17 at `rdPtr` in returndata.\n function readBytes17(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes17 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes18 at `rdPtr` in returndata.\n function readBytes18(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes18 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes19 at `rdPtr` in returndata.\n function readBytes19(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes19 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes20 at `rdPtr` in returndata.\n function readBytes20(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes20 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes21 at `rdPtr` in returndata.\n function readBytes21(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes21 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes22 at `rdPtr` in returndata.\n function readBytes22(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes22 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes23 at `rdPtr` in returndata.\n function readBytes23(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes23 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes24 at `rdPtr` in returndata.\n function readBytes24(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes24 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes25 at `rdPtr` in returndata.\n function readBytes25(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes25 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes26 at `rdPtr` in returndata.\n function readBytes26(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes26 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes27 at `rdPtr` in returndata.\n function readBytes27(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes27 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes28 at `rdPtr` in returndata.\n function readBytes28(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes28 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes29 at `rdPtr` in returndata.\n function readBytes29(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes29 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes30 at `rdPtr` in returndata.\n function readBytes30(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes30 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes31 at `rdPtr` in returndata.\n function readBytes31(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes31 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes32 at `rdPtr` in returndata.\n function readBytes32(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes32 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint8 at `rdPtr` in returndata.\n function readUint8(\n ReturndataPointer rdPtr\n ) internal pure returns (uint8 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint16 at `rdPtr` in returndata.\n function readUint16(\n ReturndataPointer rdPtr\n ) internal pure returns (uint16 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint24 at `rdPtr` in returndata.\n function readUint24(\n ReturndataPointer rdPtr\n ) internal pure returns (uint24 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint32 at `rdPtr` in returndata.\n function readUint32(\n ReturndataPointer rdPtr\n ) internal pure returns (uint32 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint40 at `rdPtr` in returndata.\n function readUint40(\n ReturndataPointer rdPtr\n ) internal pure returns (uint40 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint48 at `rdPtr` in returndata.\n function readUint48(\n ReturndataPointer rdPtr\n ) internal pure returns (uint48 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint56 at `rdPtr` in returndata.\n function readUint56(\n ReturndataPointer rdPtr\n ) internal pure returns (uint56 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint64 at `rdPtr` in returndata.\n function readUint64(\n ReturndataPointer rdPtr\n ) internal pure returns (uint64 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint72 at `rdPtr` in returndata.\n function readUint72(\n ReturndataPointer rdPtr\n ) internal pure returns (uint72 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint80 at `rdPtr` in returndata.\n function readUint80(\n ReturndataPointer rdPtr\n ) internal pure returns (uint80 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint88 at `rdPtr` in returndata.\n function readUint88(\n ReturndataPointer rdPtr\n ) internal pure returns (uint88 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint96 at `rdPtr` in returndata.\n function readUint96(\n ReturndataPointer rdPtr\n ) internal pure returns (uint96 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint104 at `rdPtr` in returndata.\n function readUint104(\n ReturndataPointer rdPtr\n ) internal pure returns (uint104 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint112 at `rdPtr` in returndata.\n function readUint112(\n ReturndataPointer rdPtr\n ) internal pure returns (uint112 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint120 at `rdPtr` in returndata.\n function readUint120(\n ReturndataPointer rdPtr\n ) internal pure returns (uint120 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint128 at `rdPtr` in returndata.\n function readUint128(\n ReturndataPointer rdPtr\n ) internal pure returns (uint128 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint136 at `rdPtr` in returndata.\n function readUint136(\n ReturndataPointer rdPtr\n ) internal pure returns (uint136 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint144 at `rdPtr` in returndata.\n function readUint144(\n ReturndataPointer rdPtr\n ) internal pure returns (uint144 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint152 at `rdPtr` in returndata.\n function readUint152(\n ReturndataPointer rdPtr\n ) internal pure returns (uint152 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint160 at `rdPtr` in returndata.\n function readUint160(\n ReturndataPointer rdPtr\n ) internal pure returns (uint160 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint168 at `rdPtr` in returndata.\n function readUint168(\n ReturndataPointer rdPtr\n ) internal pure returns (uint168 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint176 at `rdPtr` in returndata.\n function readUint176(\n ReturndataPointer rdPtr\n ) internal pure returns (uint176 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint184 at `rdPtr` in returndata.\n function readUint184(\n ReturndataPointer rdPtr\n ) internal pure returns (uint184 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint192 at `rdPtr` in returndata.\n function readUint192(\n ReturndataPointer rdPtr\n ) internal pure returns (uint192 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint200 at `rdPtr` in returndata.\n function readUint200(\n ReturndataPointer rdPtr\n ) internal pure returns (uint200 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint208 at `rdPtr` in returndata.\n function readUint208(\n ReturndataPointer rdPtr\n ) internal pure returns (uint208 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint216 at `rdPtr` in returndata.\n function readUint216(\n ReturndataPointer rdPtr\n ) internal pure returns (uint216 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint224 at `rdPtr` in returndata.\n function readUint224(\n ReturndataPointer rdPtr\n ) internal pure returns (uint224 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint232 at `rdPtr` in returndata.\n function readUint232(\n ReturndataPointer rdPtr\n ) internal pure returns (uint232 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint240 at `rdPtr` in returndata.\n function readUint240(\n ReturndataPointer rdPtr\n ) internal pure returns (uint240 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint248 at `rdPtr` in returndata.\n function readUint248(\n ReturndataPointer rdPtr\n ) internal pure returns (uint248 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint256 at `rdPtr` in returndata.\n function readUint256(\n ReturndataPointer rdPtr\n ) internal pure returns (uint256 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int8 at `rdPtr` in returndata.\n function readInt8(\n ReturndataPointer rdPtr\n ) internal pure returns (int8 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int16 at `rdPtr` in returndata.\n function readInt16(\n ReturndataPointer rdPtr\n ) internal pure returns (int16 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int24 at `rdPtr` in returndata.\n function readInt24(\n ReturndataPointer rdPtr\n ) internal pure returns (int24 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int32 at `rdPtr` in returndata.\n function readInt32(\n ReturndataPointer rdPtr\n ) internal pure returns (int32 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int40 at `rdPtr` in returndata.\n function readInt40(\n ReturndataPointer rdPtr\n ) internal pure returns (int40 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int48 at `rdPtr` in returndata.\n function readInt48(\n ReturndataPointer rdPtr\n ) internal pure returns (int48 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int56 at `rdPtr` in returndata.\n function readInt56(\n ReturndataPointer rdPtr\n ) internal pure returns (int56 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int64 at `rdPtr` in returndata.\n function readInt64(\n ReturndataPointer rdPtr\n ) internal pure returns (int64 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int72 at `rdPtr` in returndata.\n function readInt72(\n ReturndataPointer rdPtr\n ) internal pure returns (int72 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int80 at `rdPtr` in returndata.\n function readInt80(\n ReturndataPointer rdPtr\n ) internal pure returns (int80 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int88 at `rdPtr` in returndata.\n function readInt88(\n ReturndataPointer rdPtr\n ) internal pure returns (int88 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int96 at `rdPtr` in returndata.\n function readInt96(\n ReturndataPointer rdPtr\n ) internal pure returns (int96 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int104 at `rdPtr` in returndata.\n function readInt104(\n ReturndataPointer rdPtr\n ) internal pure returns (int104 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int112 at `rdPtr` in returndata.\n function readInt112(\n ReturndataPointer rdPtr\n ) internal pure returns (int112 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int120 at `rdPtr` in returndata.\n function readInt120(\n ReturndataPointer rdPtr\n ) internal pure returns (int120 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int128 at `rdPtr` in returndata.\n function readInt128(\n ReturndataPointer rdPtr\n ) internal pure returns (int128 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int136 at `rdPtr` in returndata.\n function readInt136(\n ReturndataPointer rdPtr\n ) internal pure returns (int136 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int144 at `rdPtr` in returndata.\n function readInt144(\n ReturndataPointer rdPtr\n ) internal pure returns (int144 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int152 at `rdPtr` in returndata.\n function readInt152(\n ReturndataPointer rdPtr\n ) internal pure returns (int152 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int160 at `rdPtr` in returndata.\n function readInt160(\n ReturndataPointer rdPtr\n ) internal pure returns (int160 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int168 at `rdPtr` in returndata.\n function readInt168(\n ReturndataPointer rdPtr\n ) internal pure returns (int168 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int176 at `rdPtr` in returndata.\n function readInt176(\n ReturndataPointer rdPtr\n ) internal pure returns (int176 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int184 at `rdPtr` in returndata.\n function readInt184(\n ReturndataPointer rdPtr\n ) internal pure returns (int184 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int192 at `rdPtr` in returndata.\n function readInt192(\n ReturndataPointer rdPtr\n ) internal pure returns (int192 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int200 at `rdPtr` in returndata.\n function readInt200(\n ReturndataPointer rdPtr\n ) internal pure returns (int200 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int208 at `rdPtr` in returndata.\n function readInt208(\n ReturndataPointer rdPtr\n ) internal pure returns (int208 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int216 at `rdPtr` in returndata.\n function readInt216(\n ReturndataPointer rdPtr\n ) internal pure returns (int216 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int224 at `rdPtr` in returndata.\n function readInt224(\n ReturndataPointer rdPtr\n ) internal pure returns (int224 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int232 at `rdPtr` in returndata.\n function readInt232(\n ReturndataPointer rdPtr\n ) internal pure returns (int232 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int240 at `rdPtr` in returndata.\n function readInt240(\n ReturndataPointer rdPtr\n ) internal pure returns (int240 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int248 at `rdPtr` in returndata.\n function readInt248(\n ReturndataPointer rdPtr\n ) internal pure returns (int248 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int256 at `rdPtr` in returndata.\n function readInt256(\n ReturndataPointer rdPtr\n ) internal pure returns (int256 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n}\n\nlibrary MemoryReaders {\n /// @dev Reads the memory pointer at `mPtr` in memory.\n function readMemoryPointer(\n MemoryPointer mPtr\n ) internal pure returns (MemoryPointer value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads value at `mPtr` & applies a mask to return only last 4 bytes\n function readMaskedUint256(\n MemoryPointer mPtr\n ) internal pure returns (uint256 value) {\n value = mPtr.readUint256() & OffsetOrLengthMask;\n }\n\n /// @dev Reads the bool at `mPtr` in memory.\n function readBool(MemoryPointer mPtr) internal pure returns (bool value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the address at `mPtr` in memory.\n function readAddress(\n MemoryPointer mPtr\n ) internal pure returns (address value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes1 at `mPtr` in memory.\n function readBytes1(\n MemoryPointer mPtr\n ) internal pure returns (bytes1 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes2 at `mPtr` in memory.\n function readBytes2(\n MemoryPointer mPtr\n ) internal pure returns (bytes2 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes3 at `mPtr` in memory.\n function readBytes3(\n MemoryPointer mPtr\n ) internal pure returns (bytes3 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes4 at `mPtr` in memory.\n function readBytes4(\n MemoryPointer mPtr\n ) internal pure returns (bytes4 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes5 at `mPtr` in memory.\n function readBytes5(\n MemoryPointer mPtr\n ) internal pure returns (bytes5 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes6 at `mPtr` in memory.\n function readBytes6(\n MemoryPointer mPtr\n ) internal pure returns (bytes6 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes7 at `mPtr` in memory.\n function readBytes7(\n MemoryPointer mPtr\n ) internal pure returns (bytes7 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes8 at `mPtr` in memory.\n function readBytes8(\n MemoryPointer mPtr\n ) internal pure returns (bytes8 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes9 at `mPtr` in memory.\n function readBytes9(\n MemoryPointer mPtr\n ) internal pure returns (bytes9 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes10 at `mPtr` in memory.\n function readBytes10(\n MemoryPointer mPtr\n ) internal pure returns (bytes10 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes11 at `mPtr` in memory.\n function readBytes11(\n MemoryPointer mPtr\n ) internal pure returns (bytes11 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes12 at `mPtr` in memory.\n function readBytes12(\n MemoryPointer mPtr\n ) internal pure returns (bytes12 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes13 at `mPtr` in memory.\n function readBytes13(\n MemoryPointer mPtr\n ) internal pure returns (bytes13 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes14 at `mPtr` in memory.\n function readBytes14(\n MemoryPointer mPtr\n ) internal pure returns (bytes14 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes15 at `mPtr` in memory.\n function readBytes15(\n MemoryPointer mPtr\n ) internal pure returns (bytes15 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes16 at `mPtr` in memory.\n function readBytes16(\n MemoryPointer mPtr\n ) internal pure returns (bytes16 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes17 at `mPtr` in memory.\n function readBytes17(\n MemoryPointer mPtr\n ) internal pure returns (bytes17 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes18 at `mPtr` in memory.\n function readBytes18(\n MemoryPointer mPtr\n ) internal pure returns (bytes18 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes19 at `mPtr` in memory.\n function readBytes19(\n MemoryPointer mPtr\n ) internal pure returns (bytes19 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes20 at `mPtr` in memory.\n function readBytes20(\n MemoryPointer mPtr\n ) internal pure returns (bytes20 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes21 at `mPtr` in memory.\n function readBytes21(\n MemoryPointer mPtr\n ) internal pure returns (bytes21 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes22 at `mPtr` in memory.\n function readBytes22(\n MemoryPointer mPtr\n ) internal pure returns (bytes22 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes23 at `mPtr` in memory.\n function readBytes23(\n MemoryPointer mPtr\n ) internal pure returns (bytes23 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes24 at `mPtr` in memory.\n function readBytes24(\n MemoryPointer mPtr\n ) internal pure returns (bytes24 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes25 at `mPtr` in memory.\n function readBytes25(\n MemoryPointer mPtr\n ) internal pure returns (bytes25 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes26 at `mPtr` in memory.\n function readBytes26(\n MemoryPointer mPtr\n ) internal pure returns (bytes26 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes27 at `mPtr` in memory.\n function readBytes27(\n MemoryPointer mPtr\n ) internal pure returns (bytes27 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes28 at `mPtr` in memory.\n function readBytes28(\n MemoryPointer mPtr\n ) internal pure returns (bytes28 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes29 at `mPtr` in memory.\n function readBytes29(\n MemoryPointer mPtr\n ) internal pure returns (bytes29 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes30 at `mPtr` in memory.\n function readBytes30(\n MemoryPointer mPtr\n ) internal pure returns (bytes30 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes31 at `mPtr` in memory.\n function readBytes31(\n MemoryPointer mPtr\n ) internal pure returns (bytes31 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes32 at `mPtr` in memory.\n function readBytes32(\n MemoryPointer mPtr\n ) internal pure returns (bytes32 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint8 at `mPtr` in memory.\n function readUint8(MemoryPointer mPtr) internal pure returns (uint8 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint16 at `mPtr` in memory.\n function readUint16(\n MemoryPointer mPtr\n ) internal pure returns (uint16 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint24 at `mPtr` in memory.\n function readUint24(\n MemoryPointer mPtr\n ) internal pure returns (uint24 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint32 at `mPtr` in memory.\n function readUint32(\n MemoryPointer mPtr\n ) internal pure returns (uint32 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint40 at `mPtr` in memory.\n function readUint40(\n MemoryPointer mPtr\n ) internal pure returns (uint40 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint48 at `mPtr` in memory.\n function readUint48(\n MemoryPointer mPtr\n ) internal pure returns (uint48 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint56 at `mPtr` in memory.\n function readUint56(\n MemoryPointer mPtr\n ) internal pure returns (uint56 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint64 at `mPtr` in memory.\n function readUint64(\n MemoryPointer mPtr\n ) internal pure returns (uint64 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint72 at `mPtr` in memory.\n function readUint72(\n MemoryPointer mPtr\n ) internal pure returns (uint72 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint80 at `mPtr` in memory.\n function readUint80(\n MemoryPointer mPtr\n ) internal pure returns (uint80 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint88 at `mPtr` in memory.\n function readUint88(\n MemoryPointer mPtr\n ) internal pure returns (uint88 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint96 at `mPtr` in memory.\n function readUint96(\n MemoryPointer mPtr\n ) internal pure returns (uint96 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint104 at `mPtr` in memory.\n function readUint104(\n MemoryPointer mPtr\n ) internal pure returns (uint104 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint112 at `mPtr` in memory.\n function readUint112(\n MemoryPointer mPtr\n ) internal pure returns (uint112 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint120 at `mPtr` in memory.\n function readUint120(\n MemoryPointer mPtr\n ) internal pure returns (uint120 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint128 at `mPtr` in memory.\n function readUint128(\n MemoryPointer mPtr\n ) internal pure returns (uint128 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint136 at `mPtr` in memory.\n function readUint136(\n MemoryPointer mPtr\n ) internal pure returns (uint136 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint144 at `mPtr` in memory.\n function readUint144(\n MemoryPointer mPtr\n ) internal pure returns (uint144 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint152 at `mPtr` in memory.\n function readUint152(\n MemoryPointer mPtr\n ) internal pure returns (uint152 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint160 at `mPtr` in memory.\n function readUint160(\n MemoryPointer mPtr\n ) internal pure returns (uint160 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint168 at `mPtr` in memory.\n function readUint168(\n MemoryPointer mPtr\n ) internal pure returns (uint168 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint176 at `mPtr` in memory.\n function readUint176(\n MemoryPointer mPtr\n ) internal pure returns (uint176 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint184 at `mPtr` in memory.\n function readUint184(\n MemoryPointer mPtr\n ) internal pure returns (uint184 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint192 at `mPtr` in memory.\n function readUint192(\n MemoryPointer mPtr\n ) internal pure returns (uint192 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint200 at `mPtr` in memory.\n function readUint200(\n MemoryPointer mPtr\n ) internal pure returns (uint200 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint208 at `mPtr` in memory.\n function readUint208(\n MemoryPointer mPtr\n ) internal pure returns (uint208 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint216 at `mPtr` in memory.\n function readUint216(\n MemoryPointer mPtr\n ) internal pure returns (uint216 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint224 at `mPtr` in memory.\n function readUint224(\n MemoryPointer mPtr\n ) internal pure returns (uint224 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint232 at `mPtr` in memory.\n function readUint232(\n MemoryPointer mPtr\n ) internal pure returns (uint232 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint240 at `mPtr` in memory.\n function readUint240(\n MemoryPointer mPtr\n ) internal pure returns (uint240 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint248 at `mPtr` in memory.\n function readUint248(\n MemoryPointer mPtr\n ) internal pure returns (uint248 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint256 at `mPtr` in memory.\n function readUint256(\n MemoryPointer mPtr\n ) internal pure returns (uint256 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int8 at `mPtr` in memory.\n function readInt8(MemoryPointer mPtr) internal pure returns (int8 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int16 at `mPtr` in memory.\n function readInt16(MemoryPointer mPtr) internal pure returns (int16 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int24 at `mPtr` in memory.\n function readInt24(MemoryPointer mPtr) internal pure returns (int24 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int32 at `mPtr` in memory.\n function readInt32(MemoryPointer mPtr) internal pure returns (int32 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int40 at `mPtr` in memory.\n function readInt40(MemoryPointer mPtr) internal pure returns (int40 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int48 at `mPtr` in memory.\n function readInt48(MemoryPointer mPtr) internal pure returns (int48 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int56 at `mPtr` in memory.\n function readInt56(MemoryPointer mPtr) internal pure returns (int56 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int64 at `mPtr` in memory.\n function readInt64(MemoryPointer mPtr) internal pure returns (int64 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int72 at `mPtr` in memory.\n function readInt72(MemoryPointer mPtr) internal pure returns (int72 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int80 at `mPtr` in memory.\n function readInt80(MemoryPointer mPtr) internal pure returns (int80 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int88 at `mPtr` in memory.\n function readInt88(MemoryPointer mPtr) internal pure returns (int88 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int96 at `mPtr` in memory.\n function readInt96(MemoryPointer mPtr) internal pure returns (int96 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int104 at `mPtr` in memory.\n function readInt104(\n MemoryPointer mPtr\n ) internal pure returns (int104 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int112 at `mPtr` in memory.\n function readInt112(\n MemoryPointer mPtr\n ) internal pure returns (int112 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int120 at `mPtr` in memory.\n function readInt120(\n MemoryPointer mPtr\n ) internal pure returns (int120 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int128 at `mPtr` in memory.\n function readInt128(\n MemoryPointer mPtr\n ) internal pure returns (int128 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int136 at `mPtr` in memory.\n function readInt136(\n MemoryPointer mPtr\n ) internal pure returns (int136 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int144 at `mPtr` in memory.\n function readInt144(\n MemoryPointer mPtr\n ) internal pure returns (int144 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int152 at `mPtr` in memory.\n function readInt152(\n MemoryPointer mPtr\n ) internal pure returns (int152 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int160 at `mPtr` in memory.\n function readInt160(\n MemoryPointer mPtr\n ) internal pure returns (int160 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int168 at `mPtr` in memory.\n function readInt168(\n MemoryPointer mPtr\n ) internal pure returns (int168 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int176 at `mPtr` in memory.\n function readInt176(\n MemoryPointer mPtr\n ) internal pure returns (int176 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int184 at `mPtr` in memory.\n function readInt184(\n MemoryPointer mPtr\n ) internal pure returns (int184 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int192 at `mPtr` in memory.\n function readInt192(\n MemoryPointer mPtr\n ) internal pure returns (int192 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int200 at `mPtr` in memory.\n function readInt200(\n MemoryPointer mPtr\n ) internal pure returns (int200 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int208 at `mPtr` in memory.\n function readInt208(\n MemoryPointer mPtr\n ) internal pure returns (int208 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int216 at `mPtr` in memory.\n function readInt216(\n MemoryPointer mPtr\n ) internal pure returns (int216 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int224 at `mPtr` in memory.\n function readInt224(\n MemoryPointer mPtr\n ) internal pure returns (int224 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int232 at `mPtr` in memory.\n function readInt232(\n MemoryPointer mPtr\n ) internal pure returns (int232 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int240 at `mPtr` in memory.\n function readInt240(\n MemoryPointer mPtr\n ) internal pure returns (int240 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int248 at `mPtr` in memory.\n function readInt248(\n MemoryPointer mPtr\n ) internal pure returns (int248 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int256 at `mPtr` in memory.\n function readInt256(\n MemoryPointer mPtr\n ) internal pure returns (int256 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n}\n\nlibrary MemoryWriters {\n /// @dev Writes `valuePtr` to memory at `mPtr`.\n function write(MemoryPointer mPtr, MemoryPointer valuePtr) internal pure {\n assembly {\n mstore(mPtr, valuePtr)\n }\n }\n\n /// @dev Writes a boolean `value` to `mPtr` in memory.\n function write(MemoryPointer mPtr, bool value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n\n /// @dev Writes an address `value` to `mPtr` in memory.\n function write(MemoryPointer mPtr, address value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n\n /// @dev Writes a bytes32 `value` to `mPtr` in memory.\n /// Separate name to disambiguate literal write parameters.\n function writeBytes32(MemoryPointer mPtr, bytes32 value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n\n /// @dev Writes a uint256 `value` to `mPtr` in memory.\n function write(MemoryPointer mPtr, uint256 value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n\n /// @dev Writes an int256 `value` to `mPtr` in memory.\n /// Separate name to disambiguate literal write parameters.\n function writeInt(MemoryPointer mPtr, int256 value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n}\n" }, "lib/seaport/lib/seaport-types/src/interfaces/IERC165.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.7;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" }, "lib/openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.19;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\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://consensys.net/diligence/blog/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.8.0/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(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\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 if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(target.code.length > 0, \"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" }, "src/lib/ERC721SeaDropStructs.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { AllowListData, CreatorPayout } from \"./SeaDropStructs.sol\";\n\n/**\n * @notice A struct defining public drop data.\n * Designed to fit efficiently in two storage slots.\n *\n * @param startPrice The start price per token. (Up to 1.2m\n * of native token, e.g. ETH, MATIC)\n * @param endPrice The end price per token. If this differs\n * from startPrice, the current price will\n * be calculated based on the current time.\n * @param startTime The start time, ensure this is not zero.\n * @param endTime The end time, ensure this is not zero.\n * @param paymentToken The payment token address. Null for\n * native token.\n * @param maxTotalMintableByWallet Maximum total number of mints a user is\n * allowed. (The limit for this field is\n * 2^16 - 1)\n * @param feeBps Fee out of 10_000 basis points to be\n * collected.\n * @param restrictFeeRecipients If false, allow any fee recipient;\n * if true, check fee recipient is allowed.\n */\nstruct PublicDrop {\n uint80 startPrice; // 80/512 bits\n uint80 endPrice; // 160/512 bits\n uint40 startTime; // 200/512 bits\n uint40 endTime; // 240/512 bits\n address paymentToken; // 400/512 bits\n uint16 maxTotalMintableByWallet; // 416/512 bits\n uint16 feeBps; // 432/512 bits\n bool restrictFeeRecipients; // 440/512 bits\n}\n\n/**\n * @notice A struct defining mint params for an allow list.\n * An allow list leaf will be composed of `msg.sender` and\n * the following params.\n *\n * Note: Since feeBps is encoded in the leaf, backend should ensure\n * that feeBps is acceptable before generating a proof.\n *\n * @param startPrice The start price per token. (Up to 1.2m\n * of native token, e.g. ETH, MATIC)\n * @param endPrice The end price per token. If this differs\n * from startPrice, the current price will\n * be calculated based on the current time.\n * @param startTime The start time, ensure this is not zero.\n * @param endTime The end time, ensure this is not zero.\n * @param paymentToken The payment token for the mint. Null for\n * native token.\n * @param maxTotalMintableByWallet Maximum total number of mints a user is\n * allowed.\n * @param maxTokenSupplyForStage The limit of token supply this stage can\n * mint within.\n * @param dropStageIndex The drop stage index to emit with the event\n * for analytical purposes. This should be\n * non-zero since the public mint emits with\n * index zero.\n * @param feeBps Fee out of 10_000 basis points to be\n * collected.\n * @param restrictFeeRecipients If false, allow any fee recipient;\n * if true, check fee recipient is allowed.\n */\nstruct MintParams {\n uint256 startPrice;\n uint256 endPrice;\n uint256 startTime;\n uint256 endTime;\n address paymentToken;\n uint256 maxTotalMintableByWallet;\n uint256 maxTokenSupplyForStage;\n uint256 dropStageIndex; // non-zero\n uint256 feeBps;\n bool restrictFeeRecipients;\n}\n\n/**\n * @dev Struct containing internal SeaDrop implementation logic\n * mint details to avoid stack too deep.\n *\n * @param feeRecipient The fee recipient.\n * @param payer The payer of the mint.\n * @param minter The mint recipient.\n * @param quantity The number of tokens to mint.\n * @param withEffects Whether to apply state changes of the mint.\n */\nstruct MintDetails {\n address feeRecipient;\n address payer;\n address minter;\n uint256 quantity;\n bool withEffects;\n}\n\n/**\n * @notice A struct to configure multiple contract options in one transaction.\n */\nstruct MultiConfigureStruct {\n uint256 maxSupply;\n string baseURI;\n string contractURI;\n PublicDrop publicDrop;\n string dropURI;\n AllowListData allowListData;\n CreatorPayout[] creatorPayouts;\n bytes32 provenanceHash;\n address[] allowedFeeRecipients;\n address[] disallowedFeeRecipients;\n address[] allowedPayers;\n address[] disallowedPayers;\n // Server-signed\n address[] allowedSigners;\n address[] disallowedSigners;\n // ERC-2981\n address royaltyReceiver;\n uint96 royaltyBps;\n // Mint\n address mintRecipient;\n uint256 mintQuantity;\n}\n" } }, "settings": { "remappings": [ "forge-std/=lib/forge-std/src/", "ds-test/=lib/forge-std/lib/ds-test/src/", "ERC721A/=lib/ERC721A/contracts/", "ERC721A-Upgradeable/=lib/ERC721A-Upgradeable/contracts/", "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "@openzeppelin-upgradeable/contracts/=lib/openzeppelin-contracts-upgradeable/contracts/", "@rari-capital/solmate/=lib/seaport/lib/solmate/", "murky/=lib/murky/src/", "create2-scripts/=lib/create2-helpers/script/", "seadrop/=src/", "seaport-sol/=lib/seaport/lib/seaport-sol/", "seaport-types/=lib/seaport/lib/seaport-types/", "seaport-core/=lib/seaport/lib/seaport-core/", "seaport-test-utils/=lib/seaport/test/foundry/utils/", "solady/=lib/solady/" ], "optimizer": { "enabled": true, "runs": 100000 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "none", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "viaIR": false, "libraries": {} } }}
1
20,290,557
860257a47bb3b4d5963ca7020e7fd798ebc01dc6c03e27b6d574fd81a45a7413
467a8ca146a16f591fc290a9667035921b148e88dce2fb9a3bc81971e9099758
be49bd130e126a917ddb5fabf7cdeb6dd9887f40
84654be796dad370032391d5479f8f1fd9ddd14e
bb98f19f9d77ca7cfbed45b99a56a34ade77cd43
604080600a3d393df3fe73265c27c849b0e1a62636f6007e8a74dc2a2584aa3d366025573d3d3d3d34865af16031565b363d3d373d3d363d855af45b3d82803e603c573d81fd5b3d81f3
73265c27c849b0e1a62636f6007e8a74dc2a2584aa3d366025573d3d3d3d34865af16031565b363d3d373d3d363d855af45b3d82803e603c573d81fd5b3d81f3
1
20,290,557
860257a47bb3b4d5963ca7020e7fd798ebc01dc6c03e27b6d574fd81a45a7413
78b4727311edd7a7db2689622e99688594091d6fc3fb84ce3692db50e1ccdc6f
765de9c5f7288cb2cbfbbc257e43cdadf5e3db7b
765de9c5f7288cb2cbfbbc257e43cdadf5e3db7b
4c7e095647e90a3b847c353896e661baadbd26d0
610160604052348015610010575f80fd5b5060405161318a38038061318a83398181016040528101906100329190610823565b6040518060400160405280600581526020017f6378717362000000000000000000000000000000000000000000000000000000815250806040518060400160405280600181526020017f3100000000000000000000000000000000000000000000000000000000000000815250836040518060400160405280600581526020017f63787173620000000000000000000000000000000000000000000000000000008152506040518060400160405280600381526020017f4358510000000000000000000000000000000000000000000000000000000000815250816003908161011b9190610a88565b50806004908161012b9190610a88565b5050505f60055f6101000a81548160ff0219169083151502179055505f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036101b7575f6040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081526004016101ae9190610b66565b60405180910390fd5b6101c6816102af60201b60201c565b506101db60068361037460201b90919060201c565b61012081815250506101f760078261037460201b90919060201c565b6101408181525050818051906020012060e08181525050808051906020012061010081815250504660a081815250506102346103c160201b60201c565b608081815250503073ffffffffffffffffffffffffffffffffffffffff1660c08173ffffffffffffffffffffffffffffffffffffffff16815250505050506102a93361028461041b60201b60201c565b600a6102909190610ce7565b625b8d8061029e9190610d31565b61042360201b60201c565b50610f84565b5f600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600560016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b5f6020835110156103955761038e836104a860201b60201c565b90506103bb565b826103a58361050d60201b60201c565b5f0190816103b39190610a88565b5060ff5f1b90505b92915050565b5f7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60e051610100514630604051602001610400959493929190610d99565b60405160208183030381529060405280519060200120905090565b5f6012905090565b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610493575f6040517fec442f0500000000000000000000000000000000000000000000000000000000815260040161048a9190610b66565b60405180910390fd5b6104a45f838361051660201b60201c565b5050565b5f80829050601f815111156104f457826040517f305a27a90000000000000000000000000000000000000000000000000000000081526004016104eb9190610e50565b60405180910390fd5b80518161050090610e9d565b5f1c175f1b915050919050565b5f819050919050565b61052783838361052c60201b60201c565b505050565b61053a61055060201b60201c565b61054b83838361059760201b60201c565b505050565b61055e6107b060201b60201c565b15610595576040517fd93c066500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036105e7578060025f8282546105db9190610f03565b925050819055506106b5565b5f805f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054905081811015610670578381836040517fe450d38c00000000000000000000000000000000000000000000000000000000815260040161066793929190610f36565b60405180910390fd5b8181035f808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2081905550505b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036106fc578060025f8282540392505081905550610746565b805f808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825401925050819055505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516107a39190610f6b565b60405180910390a3505050565b5f60055f9054906101000a900460ff16905090565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6107f2826107c9565b9050919050565b610802816107e8565b811461080c575f80fd5b50565b5f8151905061081d816107f9565b92915050565b5f60208284031215610838576108376107c5565b5b5f6108458482850161080f565b91505092915050565b5f81519050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f60028204905060018216806108c957607f821691505b6020821081036108dc576108db610885565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f6008830261093e7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82610903565b6109488683610903565b95508019841693508086168417925050509392505050565b5f819050919050565b5f819050919050565b5f61098c61098761098284610960565b610969565b610960565b9050919050565b5f819050919050565b6109a583610972565b6109b96109b182610993565b84845461090f565b825550505050565b5f90565b6109cd6109c1565b6109d881848461099c565b505050565b5b818110156109fb576109f05f826109c5565b6001810190506109de565b5050565b601f821115610a4057610a11816108e2565b610a1a846108f4565b81016020851015610a29578190505b610a3d610a35856108f4565b8301826109dd565b50505b505050565b5f82821c905092915050565b5f610a605f1984600802610a45565b1980831691505092915050565b5f610a788383610a51565b9150826002028217905092915050565b610a918261084e565b67ffffffffffffffff811115610aaa57610aa9610858565b5b610ab482546108b2565b610abf8282856109ff565b5f60209050601f831160018114610af0575f8415610ade578287015190505b610ae88582610a6d565b865550610b4f565b601f198416610afe866108e2565b5f5b82811015610b2557848901518255600182019150602085019450602081019050610b00565b86831015610b425784890151610b3e601f891682610a51565b8355505b6001600288020188555050505b505050505050565b610b60816107e8565b82525050565b5f602082019050610b795f830184610b57565b92915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f8160011c9050919050565b5f808291508390505b6001851115610c0157808604811115610bdd57610bdc610b7f565b5b6001851615610bec5780820291505b8081029050610bfa85610bac565b9450610bc1565b94509492505050565b5f82610c195760019050610cd4565b81610c26575f9050610cd4565b8160018114610c3c5760028114610c4657610c75565b6001915050610cd4565b60ff841115610c5857610c57610b7f565b5b8360020a915084821115610c6f57610c6e610b7f565b5b50610cd4565b5060208310610133831016604e8410600b8410161715610caa5782820a905083811115610ca557610ca4610b7f565b5b610cd4565b610cb78484846001610bb8565b92509050818404811115610cce57610ccd610b7f565b5b81810290505b9392505050565b5f60ff82169050919050565b5f610cf182610960565b9150610cfc83610cdb565b9250610d297fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484610c0a565b905092915050565b5f610d3b82610960565b9150610d4683610960565b9250828202610d5481610960565b91508282048414831517610d6b57610d6a610b7f565b5b5092915050565b5f819050919050565b610d8481610d72565b82525050565b610d9381610960565b82525050565b5f60a082019050610dac5f830188610d7b565b610db96020830187610d7b565b610dc66040830186610d7b565b610dd36060830185610d8a565b610de06080830184610b57565b9695505050505050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f610e228261084e565b610e2c8185610dea565b9350610e3c818560208601610dfa565b610e4581610e08565b840191505092915050565b5f6020820190508181035f830152610e688184610e18565b905092915050565b5f81519050919050565b5f819050602082019050919050565b5f610e948251610d72565b80915050919050565b5f610ea782610e70565b82610eb184610e7a565b9050610ebc81610e89565b92506020821015610efc57610ef77fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83602003600802610903565b831692505b5050919050565b5f610f0d82610960565b9150610f1883610960565b9250828201905080821115610f3057610f2f610b7f565b5b92915050565b5f606082019050610f495f830186610b57565b610f566020830185610d8a565b610f636040830184610d8a565b949350505050565b5f602082019050610f7e5f830184610d8a565b92915050565b60805160a05160c05160e0516101005161012051610140516121b5610fd55f395f610fa201525f610f6701525f61129201525f61127101525f610b5801525f610bae01525f610bd701526121b55ff3fe608060405234801561000f575f80fd5b5060043610610140575f3560e01c8063715018a6116100b65780638da5cb5b1161007a5780638da5cb5b1461033057806395d89b411461034e578063a9059cbb1461036c578063d505accf1461039c578063dd62ed3e146103b8578063f2fde38b146103e857610140565b8063715018a6146102ac57806379cc6790146102b65780637ecebe00146102d25780638456cb591461030257806384b0196e1461030c57610140565b80633644e515116101085780633644e515146101fe5780633f4ba83a1461021c57806340c10f191461022657806342966c68146102425780635c975abb1461025e57806370a082311461027c57610140565b806306fdde0314610144578063095ea7b31461016257806318160ddd1461019257806323b872dd146101b0578063313ce567146101e0575b5f80fd5b61014c610404565b60405161015991906119fa565b60405180910390f35b61017c60048036038101906101779190611aab565b610494565b6040516101899190611b03565b60405180910390f35b61019a6104b6565b6040516101a79190611b2b565b60405180910390f35b6101ca60048036038101906101c59190611b44565b6104bf565b6040516101d79190611b03565b60405180910390f35b6101e86104ed565b6040516101f59190611baf565b60405180910390f35b6102066104f5565b6040516102139190611be0565b60405180910390f35b610224610503565b005b610240600480360381019061023b9190611aab565b610515565b005b61025c60048036038101906102579190611bf9565b61052b565b005b61026661053f565b6040516102739190611b03565b60405180910390f35b61029660048036038101906102919190611c24565b610554565b6040516102a39190611b2b565b60405180910390f35b6102b4610599565b005b6102d060048036038101906102cb9190611aab565b6105ac565b005b6102ec60048036038101906102e79190611c24565b6105cc565b6040516102f99190611b2b565b60405180910390f35b61030a6105dd565b005b6103146105ef565b6040516103279796959493929190611d4f565b60405180910390f35b610338610694565b6040516103459190611dd1565b60405180910390f35b6103566106bd565b60405161036391906119fa565b60405180910390f35b61038660048036038101906103819190611aab565b61074d565b6040516103939190611b03565b60405180910390f35b6103b660048036038101906103b19190611e3e565b61076f565b005b6103d260048036038101906103cd9190611edb565b6108b4565b6040516103df9190611b2b565b60405180910390f35b61040260048036038101906103fd9190611c24565b610936565b005b60606003805461041390611f46565b80601f016020809104026020016040519081016040528092919081815260200182805461043f90611f46565b801561048a5780601f106104615761010080835404028352916020019161048a565b820191905f5260205f20905b81548152906001019060200180831161046d57829003601f168201915b5050505050905090565b5f8061049e6109ba565b90506104ab8185856109c1565b600191505092915050565b5f600254905090565b5f806104c96109ba565b90506104d68582856109d3565b6104e1858585610a65565b60019150509392505050565b5f6012905090565b5f6104fe610b55565b905090565b61050b610c0b565b610513610c92565b565b61051d610c0b565b6105278282610cf3565b5050565b61053c6105366109ba565b82610d72565b50565b5f60055f9054906101000a900460ff16905090565b5f805f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20549050919050565b6105a1610c0b565b6105aa5f610df1565b565b6105be826105b86109ba565b836109d3565b6105c88282610d72565b5050565b5f6105d682610eb6565b9050919050565b6105e5610c0b565b6105ed610efc565b565b5f6060805f805f6060610600610f5e565b610608610f99565b46305f801b5f67ffffffffffffffff81111561062757610626611f76565b5b6040519080825280602002602001820160405280156106555781602001602082028036833780820191505090505b507f0f00000000000000000000000000000000000000000000000000000000000000959493929190965096509650965096509650965090919293949596565b5f600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600480546106cc90611f46565b80601f01602080910402602001604051908101604052809291908181526020018280546106f890611f46565b80156107435780601f1061071a57610100808354040283529160200191610743565b820191905f5260205f20905b81548152906001019060200180831161072657829003601f168201915b5050505050905090565b5f806107576109ba565b9050610764818585610a65565b600191505092915050565b834211156107b457836040517f627913020000000000000000000000000000000000000000000000000000000081526004016107ab9190611b2b565b60405180910390fd5b5f7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98888886107e28c610fd4565b896040516020016107f896959493929190611fa3565b6040516020818303038152906040528051906020012090505f61081a82611027565b90505f61082982878787611040565b90508973ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161461089d57808a6040517f4b800e46000000000000000000000000000000000000000000000000000000008152600401610894929190612002565b60405180910390fd5b6108a88a8a8a6109c1565b50505050505050505050565b5f60015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054905092915050565b61093e610c0b565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036109ae575f6040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081526004016109a59190611dd1565b60405180910390fd5b6109b781610df1565b50565b5f33905090565b6109ce838383600161106e565b505050565b5f6109de84846108b4565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114610a5f5781811015610a50578281836040517ffb8f41b2000000000000000000000000000000000000000000000000000000008152600401610a4793929190612029565b60405180910390fd5b610a5e84848484035f61106e565b5b50505050565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610ad5575f6040517f96c6fd1e000000000000000000000000000000000000000000000000000000008152600401610acc9190611dd1565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610b45575f6040517fec442f05000000000000000000000000000000000000000000000000000000008152600401610b3c9190611dd1565b60405180910390fd5b610b5083838361123d565b505050565b5f7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff16148015610bd057507f000000000000000000000000000000000000000000000000000000000000000046145b15610bfd577f00000000000000000000000000000000000000000000000000000000000000009050610c08565b610c0561124d565b90505b90565b610c136109ba565b73ffffffffffffffffffffffffffffffffffffffff16610c31610694565b73ffffffffffffffffffffffffffffffffffffffff1614610c9057610c546109ba565b6040517f118cdaa7000000000000000000000000000000000000000000000000000000008152600401610c879190611dd1565b60405180910390fd5b565b610c9a6112e2565b5f60055f6101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa610cdc6109ba565b604051610ce99190611dd1565b60405180910390a1565b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610d63575f6040517fec442f05000000000000000000000000000000000000000000000000000000008152600401610d5a9190611dd1565b60405180910390fd5b610d6e5f838361123d565b5050565b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610de2575f6040517f96c6fd1e000000000000000000000000000000000000000000000000000000008152600401610dd99190611dd1565b60405180910390fd5b610ded825f8361123d565b5050565b5f600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600560016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b5f60085f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20549050919050565b610f04611322565b600160055f6101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610f476109ba565b604051610f549190611dd1565b60405180910390a1565b6060610f9460067f000000000000000000000000000000000000000000000000000000000000000061136390919063ffffffff16565b905090565b6060610fcf60077f000000000000000000000000000000000000000000000000000000000000000061136390919063ffffffff16565b905090565b5f60085f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f815480929190600101919050559050919050565b5f611039611033610b55565b83611410565b9050919050565b5f805f8061105088888888611450565b9250925092506110608282611537565b829350505050949350505050565b5f73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16036110de575f6040517fe602df050000000000000000000000000000000000000000000000000000000081526004016110d59190611dd1565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361114e575f6040517f94280d620000000000000000000000000000000000000000000000000000000081526004016111459190611dd1565b60405180910390fd5b8160015f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055508015611237578273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161122e9190611b2b565b60405180910390a35b50505050565b611248838383611699565b505050565b5f7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f7f00000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000046306040516020016112c795949392919061205e565b60405160208183030381529060405280519060200120905090565b6112ea61053f565b611320576040517f8dfc202b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b61132a61053f565b15611361576040517fd93c066500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b606060ff5f1b831461137f57611378836116b1565b905061140a565b81805461138b90611f46565b80601f01602080910402602001604051908101604052809291908181526020018280546113b790611f46565b80156114025780601f106113d957610100808354040283529160200191611402565b820191905f5260205f20905b8154815290600101906020018083116113e557829003601f168201915b505050505090505b92915050565b5f6040517f190100000000000000000000000000000000000000000000000000000000000081528360028201528260228201526042812091505092915050565b5f805f7f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0845f1c111561148c575f60038592509250925061152d565b5f6001888888886040515f81526020016040526040516114af94939291906120af565b6020604051602081039080840390855afa1580156114cf573d5f803e3d5ffd5b5050506020604051035190505f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611520575f60015f801b9350935093505061152d565b805f805f1b935093509350505b9450945094915050565b5f600381111561154a576115496120f2565b5b82600381111561155d5761155c6120f2565b5b03156116955760016003811115611577576115766120f2565b5b82600381111561158a576115896120f2565b5b036115c1576040517ff645eedf00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600260038111156115d5576115d46120f2565b5b8260038111156115e8576115e76120f2565b5b0361162c57805f1c6040517ffce698f70000000000000000000000000000000000000000000000000000000081526004016116239190611b2b565b60405180910390fd5b60038081111561163f5761163e6120f2565b5b826003811115611652576116516120f2565b5b0361169457806040517fd78bce0c00000000000000000000000000000000000000000000000000000000815260040161168b9190611be0565b60405180910390fd5b5b5050565b6116a1611322565b6116ac838383611723565b505050565b60605f6116bd8361193c565b90505f602067ffffffffffffffff8111156116db576116da611f76565b5b6040519080825280601f01601f19166020018201604052801561170d5781602001600182028036833780820191505090505b5090508181528360208201528092505050919050565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611773578060025f828254611767919061214c565b92505081905550611841565b5f805f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20549050818110156117fc578381836040517fe450d38c0000000000000000000000000000000000000000000000000000000081526004016117f393929190612029565b60405180910390fd5b8181035f808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2081905550505b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611888578060025f82825403925050819055506118d2565b805f808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825401925050819055505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161192f9190611b2b565b60405180910390a3505050565b5f8060ff835f1c169050601f811115611981576040517fb3512b0c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80915050919050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f6119cc8261198a565b6119d68185611994565b93506119e68185602086016119a4565b6119ef816119b2565b840191505092915050565b5f6020820190508181035f830152611a1281846119c2565b905092915050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f611a4782611a1e565b9050919050565b611a5781611a3d565b8114611a61575f80fd5b50565b5f81359050611a7281611a4e565b92915050565b5f819050919050565b611a8a81611a78565b8114611a94575f80fd5b50565b5f81359050611aa581611a81565b92915050565b5f8060408385031215611ac157611ac0611a1a565b5b5f611ace85828601611a64565b9250506020611adf85828601611a97565b9150509250929050565b5f8115159050919050565b611afd81611ae9565b82525050565b5f602082019050611b165f830184611af4565b92915050565b611b2581611a78565b82525050565b5f602082019050611b3e5f830184611b1c565b92915050565b5f805f60608486031215611b5b57611b5a611a1a565b5b5f611b6886828701611a64565b9350506020611b7986828701611a64565b9250506040611b8a86828701611a97565b9150509250925092565b5f60ff82169050919050565b611ba981611b94565b82525050565b5f602082019050611bc25f830184611ba0565b92915050565b5f819050919050565b611bda81611bc8565b82525050565b5f602082019050611bf35f830184611bd1565b92915050565b5f60208284031215611c0e57611c0d611a1a565b5b5f611c1b84828501611a97565b91505092915050565b5f60208284031215611c3957611c38611a1a565b5b5f611c4684828501611a64565b91505092915050565b5f7fff0000000000000000000000000000000000000000000000000000000000000082169050919050565b611c8381611c4f565b82525050565b611c9281611a3d565b82525050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b611cca81611a78565b82525050565b5f611cdb8383611cc1565b60208301905092915050565b5f602082019050919050565b5f611cfd82611c98565b611d078185611ca2565b9350611d1283611cb2565b805f5b83811015611d42578151611d298882611cd0565b9750611d3483611ce7565b925050600181019050611d15565b5085935050505092915050565b5f60e082019050611d625f83018a611c7a565b8181036020830152611d7481896119c2565b90508181036040830152611d8881886119c2565b9050611d976060830187611b1c565b611da46080830186611c89565b611db160a0830185611bd1565b81810360c0830152611dc38184611cf3565b905098975050505050505050565b5f602082019050611de45f830184611c89565b92915050565b611df381611b94565b8114611dfd575f80fd5b50565b5f81359050611e0e81611dea565b92915050565b611e1d81611bc8565b8114611e27575f80fd5b50565b5f81359050611e3881611e14565b92915050565b5f805f805f805f60e0888a031215611e5957611e58611a1a565b5b5f611e668a828b01611a64565b9750506020611e778a828b01611a64565b9650506040611e888a828b01611a97565b9550506060611e998a828b01611a97565b9450506080611eaa8a828b01611e00565b93505060a0611ebb8a828b01611e2a565b92505060c0611ecc8a828b01611e2a565b91505092959891949750929550565b5f8060408385031215611ef157611ef0611a1a565b5b5f611efe85828601611a64565b9250506020611f0f85828601611a64565b9150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f6002820490506001821680611f5d57607f821691505b602082108103611f7057611f6f611f19565b5b50919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f60c082019050611fb65f830189611bd1565b611fc36020830188611c89565b611fd06040830187611c89565b611fdd6060830186611b1c565b611fea6080830185611b1c565b611ff760a0830184611b1c565b979650505050505050565b5f6040820190506120155f830185611c89565b6120226020830184611c89565b9392505050565b5f60608201905061203c5f830186611c89565b6120496020830185611b1c565b6120566040830184611b1c565b949350505050565b5f60a0820190506120715f830188611bd1565b61207e6020830187611bd1565b61208b6040830186611bd1565b6120986060830185611b1c565b6120a56080830184611c89565b9695505050505050565b5f6080820190506120c25f830187611bd1565b6120cf6020830186611ba0565b6120dc6040830185611bd1565b6120e96060830184611bd1565b95945050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f61215682611a78565b915061216183611a78565b92508282019050808211156121795761217861211f565b5b9291505056fea26469706673582212206b004e5e3249503b85a8a89698323064b914136225b7e9f8d6b586a746b8172f64736f6c634300081a0033000000000000000000000000765de9c5f7288cb2cbfbbc257e43cdadf5e3db7b
608060405234801561000f575f80fd5b5060043610610140575f3560e01c8063715018a6116100b65780638da5cb5b1161007a5780638da5cb5b1461033057806395d89b411461034e578063a9059cbb1461036c578063d505accf1461039c578063dd62ed3e146103b8578063f2fde38b146103e857610140565b8063715018a6146102ac57806379cc6790146102b65780637ecebe00146102d25780638456cb591461030257806384b0196e1461030c57610140565b80633644e515116101085780633644e515146101fe5780633f4ba83a1461021c57806340c10f191461022657806342966c68146102425780635c975abb1461025e57806370a082311461027c57610140565b806306fdde0314610144578063095ea7b31461016257806318160ddd1461019257806323b872dd146101b0578063313ce567146101e0575b5f80fd5b61014c610404565b60405161015991906119fa565b60405180910390f35b61017c60048036038101906101779190611aab565b610494565b6040516101899190611b03565b60405180910390f35b61019a6104b6565b6040516101a79190611b2b565b60405180910390f35b6101ca60048036038101906101c59190611b44565b6104bf565b6040516101d79190611b03565b60405180910390f35b6101e86104ed565b6040516101f59190611baf565b60405180910390f35b6102066104f5565b6040516102139190611be0565b60405180910390f35b610224610503565b005b610240600480360381019061023b9190611aab565b610515565b005b61025c60048036038101906102579190611bf9565b61052b565b005b61026661053f565b6040516102739190611b03565b60405180910390f35b61029660048036038101906102919190611c24565b610554565b6040516102a39190611b2b565b60405180910390f35b6102b4610599565b005b6102d060048036038101906102cb9190611aab565b6105ac565b005b6102ec60048036038101906102e79190611c24565b6105cc565b6040516102f99190611b2b565b60405180910390f35b61030a6105dd565b005b6103146105ef565b6040516103279796959493929190611d4f565b60405180910390f35b610338610694565b6040516103459190611dd1565b60405180910390f35b6103566106bd565b60405161036391906119fa565b60405180910390f35b61038660048036038101906103819190611aab565b61074d565b6040516103939190611b03565b60405180910390f35b6103b660048036038101906103b19190611e3e565b61076f565b005b6103d260048036038101906103cd9190611edb565b6108b4565b6040516103df9190611b2b565b60405180910390f35b61040260048036038101906103fd9190611c24565b610936565b005b60606003805461041390611f46565b80601f016020809104026020016040519081016040528092919081815260200182805461043f90611f46565b801561048a5780601f106104615761010080835404028352916020019161048a565b820191905f5260205f20905b81548152906001019060200180831161046d57829003601f168201915b5050505050905090565b5f8061049e6109ba565b90506104ab8185856109c1565b600191505092915050565b5f600254905090565b5f806104c96109ba565b90506104d68582856109d3565b6104e1858585610a65565b60019150509392505050565b5f6012905090565b5f6104fe610b55565b905090565b61050b610c0b565b610513610c92565b565b61051d610c0b565b6105278282610cf3565b5050565b61053c6105366109ba565b82610d72565b50565b5f60055f9054906101000a900460ff16905090565b5f805f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20549050919050565b6105a1610c0b565b6105aa5f610df1565b565b6105be826105b86109ba565b836109d3565b6105c88282610d72565b5050565b5f6105d682610eb6565b9050919050565b6105e5610c0b565b6105ed610efc565b565b5f6060805f805f6060610600610f5e565b610608610f99565b46305f801b5f67ffffffffffffffff81111561062757610626611f76565b5b6040519080825280602002602001820160405280156106555781602001602082028036833780820191505090505b507f0f00000000000000000000000000000000000000000000000000000000000000959493929190965096509650965096509650965090919293949596565b5f600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600480546106cc90611f46565b80601f01602080910402602001604051908101604052809291908181526020018280546106f890611f46565b80156107435780601f1061071a57610100808354040283529160200191610743565b820191905f5260205f20905b81548152906001019060200180831161072657829003601f168201915b5050505050905090565b5f806107576109ba565b9050610764818585610a65565b600191505092915050565b834211156107b457836040517f627913020000000000000000000000000000000000000000000000000000000081526004016107ab9190611b2b565b60405180910390fd5b5f7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98888886107e28c610fd4565b896040516020016107f896959493929190611fa3565b6040516020818303038152906040528051906020012090505f61081a82611027565b90505f61082982878787611040565b90508973ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161461089d57808a6040517f4b800e46000000000000000000000000000000000000000000000000000000008152600401610894929190612002565b60405180910390fd5b6108a88a8a8a6109c1565b50505050505050505050565b5f60015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054905092915050565b61093e610c0b565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036109ae575f6040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081526004016109a59190611dd1565b60405180910390fd5b6109b781610df1565b50565b5f33905090565b6109ce838383600161106e565b505050565b5f6109de84846108b4565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114610a5f5781811015610a50578281836040517ffb8f41b2000000000000000000000000000000000000000000000000000000008152600401610a4793929190612029565b60405180910390fd5b610a5e84848484035f61106e565b5b50505050565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610ad5575f6040517f96c6fd1e000000000000000000000000000000000000000000000000000000008152600401610acc9190611dd1565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610b45575f6040517fec442f05000000000000000000000000000000000000000000000000000000008152600401610b3c9190611dd1565b60405180910390fd5b610b5083838361123d565b505050565b5f7f0000000000000000000000004c7e095647e90a3b847c353896e661baadbd26d073ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff16148015610bd057507f000000000000000000000000000000000000000000000000000000000000000146145b15610bfd577ffb03850e0e4a69f8ed2520c16db54e0d2d6ed6ab67fe973d2b9cd998c3dad1c69050610c08565b610c0561124d565b90505b90565b610c136109ba565b73ffffffffffffffffffffffffffffffffffffffff16610c31610694565b73ffffffffffffffffffffffffffffffffffffffff1614610c9057610c546109ba565b6040517f118cdaa7000000000000000000000000000000000000000000000000000000008152600401610c879190611dd1565b60405180910390fd5b565b610c9a6112e2565b5f60055f6101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa610cdc6109ba565b604051610ce99190611dd1565b60405180910390a1565b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610d63575f6040517fec442f05000000000000000000000000000000000000000000000000000000008152600401610d5a9190611dd1565b60405180910390fd5b610d6e5f838361123d565b5050565b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610de2575f6040517f96c6fd1e000000000000000000000000000000000000000000000000000000008152600401610dd99190611dd1565b60405180910390fd5b610ded825f8361123d565b5050565b5f600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600560016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b5f60085f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20549050919050565b610f04611322565b600160055f6101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610f476109ba565b604051610f549190611dd1565b60405180910390a1565b6060610f9460067f637871736200000000000000000000000000000000000000000000000000000561136390919063ffffffff16565b905090565b6060610fcf60077f310000000000000000000000000000000000000000000000000000000000000161136390919063ffffffff16565b905090565b5f60085f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f815480929190600101919050559050919050565b5f611039611033610b55565b83611410565b9050919050565b5f805f8061105088888888611450565b9250925092506110608282611537565b829350505050949350505050565b5f73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16036110de575f6040517fe602df050000000000000000000000000000000000000000000000000000000081526004016110d59190611dd1565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361114e575f6040517f94280d620000000000000000000000000000000000000000000000000000000081526004016111459190611dd1565b60405180910390fd5b8160015f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055508015611237578273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161122e9190611b2b565b60405180910390a35b50505050565b611248838383611699565b505050565b5f7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f7f80ebd764751adbf6caf12934ba86a2a744f52ab3d4d9e7ab694e194b72f6df6a7fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc646306040516020016112c795949392919061205e565b60405160208183030381529060405280519060200120905090565b6112ea61053f565b611320576040517f8dfc202b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b61132a61053f565b15611361576040517fd93c066500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b606060ff5f1b831461137f57611378836116b1565b905061140a565b81805461138b90611f46565b80601f01602080910402602001604051908101604052809291908181526020018280546113b790611f46565b80156114025780601f106113d957610100808354040283529160200191611402565b820191905f5260205f20905b8154815290600101906020018083116113e557829003601f168201915b505050505090505b92915050565b5f6040517f190100000000000000000000000000000000000000000000000000000000000081528360028201528260228201526042812091505092915050565b5f805f7f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0845f1c111561148c575f60038592509250925061152d565b5f6001888888886040515f81526020016040526040516114af94939291906120af565b6020604051602081039080840390855afa1580156114cf573d5f803e3d5ffd5b5050506020604051035190505f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611520575f60015f801b9350935093505061152d565b805f805f1b935093509350505b9450945094915050565b5f600381111561154a576115496120f2565b5b82600381111561155d5761155c6120f2565b5b03156116955760016003811115611577576115766120f2565b5b82600381111561158a576115896120f2565b5b036115c1576040517ff645eedf00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600260038111156115d5576115d46120f2565b5b8260038111156115e8576115e76120f2565b5b0361162c57805f1c6040517ffce698f70000000000000000000000000000000000000000000000000000000081526004016116239190611b2b565b60405180910390fd5b60038081111561163f5761163e6120f2565b5b826003811115611652576116516120f2565b5b0361169457806040517fd78bce0c00000000000000000000000000000000000000000000000000000000815260040161168b9190611be0565b60405180910390fd5b5b5050565b6116a1611322565b6116ac838383611723565b505050565b60605f6116bd8361193c565b90505f602067ffffffffffffffff8111156116db576116da611f76565b5b6040519080825280601f01601f19166020018201604052801561170d5781602001600182028036833780820191505090505b5090508181528360208201528092505050919050565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611773578060025f828254611767919061214c565b92505081905550611841565b5f805f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20549050818110156117fc578381836040517fe450d38c0000000000000000000000000000000000000000000000000000000081526004016117f393929190612029565b60405180910390fd5b8181035f808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2081905550505b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611888578060025f82825403925050819055506118d2565b805f808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825401925050819055505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161192f9190611b2b565b60405180910390a3505050565b5f8060ff835f1c169050601f811115611981576040517fb3512b0c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80915050919050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f6119cc8261198a565b6119d68185611994565b93506119e68185602086016119a4565b6119ef816119b2565b840191505092915050565b5f6020820190508181035f830152611a1281846119c2565b905092915050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f611a4782611a1e565b9050919050565b611a5781611a3d565b8114611a61575f80fd5b50565b5f81359050611a7281611a4e565b92915050565b5f819050919050565b611a8a81611a78565b8114611a94575f80fd5b50565b5f81359050611aa581611a81565b92915050565b5f8060408385031215611ac157611ac0611a1a565b5b5f611ace85828601611a64565b9250506020611adf85828601611a97565b9150509250929050565b5f8115159050919050565b611afd81611ae9565b82525050565b5f602082019050611b165f830184611af4565b92915050565b611b2581611a78565b82525050565b5f602082019050611b3e5f830184611b1c565b92915050565b5f805f60608486031215611b5b57611b5a611a1a565b5b5f611b6886828701611a64565b9350506020611b7986828701611a64565b9250506040611b8a86828701611a97565b9150509250925092565b5f60ff82169050919050565b611ba981611b94565b82525050565b5f602082019050611bc25f830184611ba0565b92915050565b5f819050919050565b611bda81611bc8565b82525050565b5f602082019050611bf35f830184611bd1565b92915050565b5f60208284031215611c0e57611c0d611a1a565b5b5f611c1b84828501611a97565b91505092915050565b5f60208284031215611c3957611c38611a1a565b5b5f611c4684828501611a64565b91505092915050565b5f7fff0000000000000000000000000000000000000000000000000000000000000082169050919050565b611c8381611c4f565b82525050565b611c9281611a3d565b82525050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b611cca81611a78565b82525050565b5f611cdb8383611cc1565b60208301905092915050565b5f602082019050919050565b5f611cfd82611c98565b611d078185611ca2565b9350611d1283611cb2565b805f5b83811015611d42578151611d298882611cd0565b9750611d3483611ce7565b925050600181019050611d15565b5085935050505092915050565b5f60e082019050611d625f83018a611c7a565b8181036020830152611d7481896119c2565b90508181036040830152611d8881886119c2565b9050611d976060830187611b1c565b611da46080830186611c89565b611db160a0830185611bd1565b81810360c0830152611dc38184611cf3565b905098975050505050505050565b5f602082019050611de45f830184611c89565b92915050565b611df381611b94565b8114611dfd575f80fd5b50565b5f81359050611e0e81611dea565b92915050565b611e1d81611bc8565b8114611e27575f80fd5b50565b5f81359050611e3881611e14565b92915050565b5f805f805f805f60e0888a031215611e5957611e58611a1a565b5b5f611e668a828b01611a64565b9750506020611e778a828b01611a64565b9650506040611e888a828b01611a97565b9550506060611e998a828b01611a97565b9450506080611eaa8a828b01611e00565b93505060a0611ebb8a828b01611e2a565b92505060c0611ecc8a828b01611e2a565b91505092959891949750929550565b5f8060408385031215611ef157611ef0611a1a565b5b5f611efe85828601611a64565b9250506020611f0f85828601611a64565b9150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f6002820490506001821680611f5d57607f821691505b602082108103611f7057611f6f611f19565b5b50919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f60c082019050611fb65f830189611bd1565b611fc36020830188611c89565b611fd06040830187611c89565b611fdd6060830186611b1c565b611fea6080830185611b1c565b611ff760a0830184611b1c565b979650505050505050565b5f6040820190506120155f830185611c89565b6120226020830184611c89565b9392505050565b5f60608201905061203c5f830186611c89565b6120496020830185611b1c565b6120566040830184611b1c565b949350505050565b5f60a0820190506120715f830188611bd1565b61207e6020830187611bd1565b61208b6040830186611bd1565b6120986060830185611b1c565b6120a56080830184611c89565b9695505050505050565b5f6080820190506120c25f830187611bd1565b6120cf6020830186611ba0565b6120dc6040830185611bd1565b6120e96060830184611bd1565b95945050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f61215682611a78565b915061216183611a78565b92508282019050808211156121795761217861211f565b5b9291505056fea26469706673582212206b004e5e3249503b85a8a89698323064b914136225b7e9f8d6b586a746b8172f64736f6c634300081a0033
1
20,290,558
c998d5a876c776a287ac1e4abb13e40d5c3dfcc6017dc01117a23f95ad9388f2
8d017d4830cc8420b2bbbc95534ca638f0e6c2e704633507c2550e86663fab40
a7fb5ca286fc3fd67525629048a4de3ba24cba2e
c77ad0a71008d7094a62cfbd250a2eb2afdf2776
0ba91bdb7def3fa71c8325e9e11f56e7b8bab40c
608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe
1
20,290,558
c998d5a876c776a287ac1e4abb13e40d5c3dfcc6017dc01117a23f95ad9388f2
ab526685ddf024924ee6245c9d9c62c7852d588dd2cbe25176285cc7fd2d4a6e
03e670933776c9802b42dc7fe6f28cafddd9c418
03e670933776c9802b42dc7fe6f28cafddd9c418
6497413b7512672ff3dbae1539bcce66b6dea6b4
60806040526658d15e176280006001556000600260006101000a81548160ff0219169083151502179055507ffdc54b1a6f53a21d375d0dea774c3fa512a7033ced32e0e8b10d2bb45bb5eb336005557ffdc54b1a6f53a21d375d0dea855486a5745e1880bc7f8b7831930898887d45a66006557ffdc54b1a6f53a21d375d0deaee35ed8488f423d8f410f74862cb88a3d14781c06007557ffdc54b1a6f53a21d375d0dea855486a5745e1880bc7f8b7831930898887d45a66008553480156100c657600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061047f806101166000396000f3fe6080604052600436106100435760003560e01c80636c02a9311461004f5780637b61c3201461007a578063be9a6555146100a5578063d4e93292146100af5761004a565b3661004a57005b600080fd5b34801561005b57600080fd5b506100646100b9565b6040516100719190610331565b60405180910390f35b34801561008657600080fd5b5061008f61010a565b60405161009c9190610331565b60405180910390f35b6100ad61015b565b005b6100b7610165565b005b60008060015460008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163161010191906103b3565b90508091505090565b60008060015460008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163161015291906103b3565b90508091505090565b61016361016f565b565b61016d6101d1565b565b60006101856007546008546005546006546102a8565b90508073ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f193505050501580156101cd573d6000803e3d6000fd5b5050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461025f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161025690610311565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f193505050501580156102a5573d6000803e3d6000fd5b50565b60008060a083866102b991906103b3565b901b84876102c791906103b3565b6102d1919061035d565b905080915050949350505050565b60006102ec60208361034c565b91506102f782610420565b602082019050919050565b61030b816103e7565b82525050565b6000602082019050818103600083015261032a816102df565b9050919050565b60006020820190506103466000830184610302565b92915050565b600082825260208201905092915050565b6000610368826103e7565b9150610373836103e7565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156103a8576103a76103f1565b5b828201905092915050565b60006103be826103e7565b91506103c9836103e7565b9250828210156103dc576103db6103f1565b5b828203905092915050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260008201525056fea264697066735822122027830ee3dca265676a56d8da56db387eb7d7302f8c0575cd130b87eff676ce6064736f6c63430008040033
6080604052600436106100435760003560e01c80636c02a9311461004f5780637b61c3201461007a578063be9a6555146100a5578063d4e93292146100af5761004a565b3661004a57005b600080fd5b34801561005b57600080fd5b506100646100b9565b6040516100719190610331565b60405180910390f35b34801561008657600080fd5b5061008f61010a565b60405161009c9190610331565b60405180910390f35b6100ad61015b565b005b6100b7610165565b005b60008060015460008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163161010191906103b3565b90508091505090565b60008060015460008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163161015291906103b3565b90508091505090565b61016361016f565b565b61016d6101d1565b565b60006101856007546008546005546006546102a8565b90508073ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f193505050501580156101cd573d6000803e3d6000fd5b5050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461025f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161025690610311565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f193505050501580156102a5573d6000803e3d6000fd5b50565b60008060a083866102b991906103b3565b901b84876102c791906103b3565b6102d1919061035d565b905080915050949350505050565b60006102ec60208361034c565b91506102f782610420565b602082019050919050565b61030b816103e7565b82525050565b6000602082019050818103600083015261032a816102df565b9050919050565b60006020820190506103466000830184610302565b92915050565b600082825260208201905092915050565b6000610368826103e7565b9150610373836103e7565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156103a8576103a76103f1565b5b828201905092915050565b60006103be826103e7565b91506103c9836103e7565b9250828210156103dc576103db6103f1565b5b828203905092915050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260008201525056fea264697066735822122027830ee3dca265676a56d8da56db387eb7d7302f8c0575cd130b87eff676ce6064736f6c63430008040033
1
20,290,560
a6032a3c336a3dc607f00f273d63dd2a86aeb9423ef5499ecff602421a76150f
9f6ce37aff47f8792c4b265d36de61fc18602d744b2c16284b2772debf817372
41ed843a086f44b8cb23decc8170c132bc257874
29ef46035e9fa3d570c598d3266424ca11413b0c
6caaa3fdc51f68698d8d42d8df58a56be7af0546
3d602d80600a3d3981f3363d3d373d3d3d363d735397d0869aba0d55e96d5716d383f6e1d8695ed75af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d735397d0869aba0d55e96d5716d383f6e1d8695ed75af43d82803e903d91602b57fd5bf3
{{ "language": "Solidity", "sources": { "contracts/Forwarder.sol": { "content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity 0.8.10;\nimport '@openzeppelin/contracts/token/ERC1155/IERC1155.sol';\nimport '@openzeppelin/contracts/token/ERC721/IERC721.sol';\nimport '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol';\nimport '@openzeppelin/contracts/token/ERC1155/utils/ERC1155Receiver.sol';\nimport './ERC20Interface.sol';\nimport './TransferHelper.sol';\nimport './IForwarder.sol';\n\n/**\n * Contract that will forward any incoming Ether to the creator of the contract\n *\n */\ncontract Forwarder is IERC721Receiver, ERC1155Receiver, IForwarder {\n // Address to which any funds sent to this contract will be forwarded\n address public parentAddress;\n bool public autoFlush721 = true;\n bool public autoFlush1155 = true;\n\n event ForwarderDeposited(address from, uint256 value, bytes data);\n\n /**\n * Initialize the contract, and sets the destination address to that of the creator\n */\n function init(\n address _parentAddress,\n bool _autoFlush721,\n bool _autoFlush1155\n ) external onlyUninitialized {\n parentAddress = _parentAddress;\n uint256 value = address(this).balance;\n\n // set whether we want to automatically flush erc721/erc1155 tokens or not\n autoFlush721 = _autoFlush721;\n autoFlush1155 = _autoFlush1155;\n\n if (value == 0) {\n return;\n }\n\n (bool success, ) = parentAddress.call{ value: value }('');\n require(success, 'Flush failed');\n\n // NOTE: since we are forwarding on initialization,\n // we don't have the context of the original sender.\n // We still emit an event about the forwarding but set\n // the sender to the forwarder itself\n emit ForwarderDeposited(address(this), value, msg.data);\n }\n\n /**\n * Modifier that will execute internal code block only if the sender is the parent address\n */\n modifier onlyParent {\n require(msg.sender == parentAddress, 'Only Parent');\n _;\n }\n\n /**\n * Modifier that will execute internal code block only if the contract has not been initialized yet\n */\n modifier onlyUninitialized {\n require(parentAddress == address(0x0), 'Already initialized');\n _;\n }\n\n /**\n * Default function; Gets called when data is sent but does not match any other function\n */\n fallback() external payable {\n flush();\n }\n\n /**\n * Default function; Gets called when Ether is deposited with no data, and forwards it to the parent address\n */\n receive() external payable {\n flush();\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function setAutoFlush721(bool autoFlush)\n external\n virtual\n override\n onlyParent\n {\n autoFlush721 = autoFlush;\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function setAutoFlush1155(bool autoFlush)\n external\n virtual\n override\n onlyParent\n {\n autoFlush1155 = autoFlush;\n }\n\n /**\n * ERC721 standard callback function for when a ERC721 is transfered. The forwarder will send the nft\n * to the base wallet once the nft contract invokes this method after transfering the nft.\n *\n * @param _operator The address which called `safeTransferFrom` function\n * @param _from The address of the sender\n * @param _tokenId The token id of the nft\n * @param data Additional data with no specified format, sent in call to `_to`\n */\n function onERC721Received(\n address _operator,\n address _from,\n uint256 _tokenId,\n bytes memory data\n ) external virtual override returns (bytes4) {\n if (autoFlush721) {\n IERC721 instance = IERC721(msg.sender);\n require(\n instance.supportsInterface(type(IERC721).interfaceId),\n 'The caller does not support the ERC721 interface'\n );\n // this won't work for ERC721 re-entrancy\n instance.safeTransferFrom(address(this), parentAddress, _tokenId, data);\n }\n\n return this.onERC721Received.selector;\n }\n\n function callFromParent(\n address target,\n uint256 value,\n bytes calldata data\n ) external onlyParent returns (bytes memory) {\n (bool success, bytes memory returnedData) = target.call{ value: value }(\n data\n );\n require(success, 'Parent call execution failed');\n\n return returnedData;\n }\n\n /**\n * @inheritdoc IERC1155Receiver\n */\n function onERC1155Received(\n address _operator,\n address _from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external virtual override returns (bytes4) {\n IERC1155 instance = IERC1155(msg.sender);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n if (autoFlush1155) {\n instance.safeTransferFrom(address(this), parentAddress, id, value, data);\n }\n\n return this.onERC1155Received.selector;\n }\n\n /**\n * @inheritdoc IERC1155Receiver\n */\n function onERC1155BatchReceived(\n address _operator,\n address _from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external virtual override returns (bytes4) {\n IERC1155 instance = IERC1155(msg.sender);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n if (autoFlush1155) {\n instance.safeBatchTransferFrom(\n address(this),\n parentAddress,\n ids,\n values,\n data\n );\n }\n\n return this.onERC1155BatchReceived.selector;\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function flushTokens(address tokenContractAddress)\n external\n virtual\n override\n onlyParent\n {\n ERC20Interface instance = ERC20Interface(tokenContractAddress);\n address forwarderAddress = address(this);\n uint256 forwarderBalance = instance.balanceOf(forwarderAddress);\n if (forwarderBalance == 0) {\n return;\n }\n\n TransferHelper.safeTransfer(\n tokenContractAddress,\n parentAddress,\n forwarderBalance\n );\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function flushERC721Token(address tokenContractAddress, uint256 tokenId)\n external\n virtual\n override\n onlyParent\n {\n IERC721 instance = IERC721(tokenContractAddress);\n require(\n instance.supportsInterface(type(IERC721).interfaceId),\n 'The tokenContractAddress does not support the ERC721 interface'\n );\n\n address ownerAddress = instance.ownerOf(tokenId);\n instance.transferFrom(ownerAddress, parentAddress, tokenId);\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function flushERC1155Tokens(address tokenContractAddress, uint256 tokenId)\n external\n virtual\n override\n onlyParent\n {\n IERC1155 instance = IERC1155(tokenContractAddress);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n address forwarderAddress = address(this);\n uint256 forwarderBalance = instance.balanceOf(forwarderAddress, tokenId);\n\n instance.safeTransferFrom(\n forwarderAddress,\n parentAddress,\n tokenId,\n forwarderBalance,\n ''\n );\n }\n\n /**\n * @inheritdoc IForwarder\n */\n function batchFlushERC1155Tokens(\n address tokenContractAddress,\n uint256[] calldata tokenIds\n ) external virtual override onlyParent {\n IERC1155 instance = IERC1155(tokenContractAddress);\n require(\n instance.supportsInterface(type(IERC1155).interfaceId),\n 'The caller does not support the IERC1155 interface'\n );\n\n address forwarderAddress = address(this);\n uint256[] memory amounts = new uint256[](tokenIds.length);\n for (uint256 i = 0; i < tokenIds.length; i++) {\n amounts[i] = instance.balanceOf(forwarderAddress, tokenIds[i]);\n }\n\n instance.safeBatchTransferFrom(\n forwarderAddress,\n parentAddress,\n tokenIds,\n amounts,\n ''\n );\n }\n\n /**\n * Flush the entire balance of the contract to the parent address.\n */\n function flush() public {\n uint256 value = address(this).balance;\n\n if (value == 0) {\n return;\n }\n\n (bool success, ) = parentAddress.call{ value: value }('');\n require(success, 'Flush failed');\n emit ForwarderDeposited(msg.sender, value, msg.data);\n }\n\n /**\n * @inheritdoc IERC165\n */\n function supportsInterface(bytes4 interfaceId)\n public\n virtual\n override(ERC1155Receiver, IERC165)\n view\n returns (bool)\n {\n return\n interfaceId == type(IForwarder).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n}\n" }, "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" }, "@openzeppelin/contracts/token/ERC721/IERC721.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n}\n" }, "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" }, "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Receiver.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155Receiver.sol\";\nimport \"../../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\nabstract contract ERC1155Receiver is ERC165, IERC1155Receiver {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);\n }\n}\n" }, "contracts/ERC20Interface.sol": { "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.10;\n\n/**\n * Contract that exposes the needed erc20 token functions\n */\n\nabstract contract ERC20Interface {\n // Send _value amount of tokens to address _to\n function transfer(address _to, uint256 _value)\n public\n virtual\n returns (bool success);\n\n // Get the account balance of another account with address _owner\n function balanceOf(address _owner)\n public\n virtual\n view\n returns (uint256 balance);\n}\n" }, "contracts/TransferHelper.sol": { "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n// source: https://github.com/Uniswap/solidity-lib/blob/master/contracts/libraries/TransferHelper.sol\npragma solidity 0.8.10;\n\nimport '@openzeppelin/contracts/utils/Address.sol';\n\n// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false\nlibrary TransferHelper {\n function safeTransfer(\n address token,\n address to,\n uint256 value\n ) internal {\n // bytes4(keccak256(bytes('transfer(address,uint256)')));\n (bool success, bytes memory data) = token.call(\n abi.encodeWithSelector(0xa9059cbb, to, value)\n );\n require(\n success && (data.length == 0 || abi.decode(data, (bool))),\n 'TransferHelper::safeTransfer: transfer failed'\n );\n }\n\n function safeTransferFrom(\n address token,\n address from,\n address to,\n uint256 value\n ) internal {\n // bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));\n (bool success, bytes memory returndata) = token.call(\n abi.encodeWithSelector(0x23b872dd, from, to, value)\n );\n Address.verifyCallResult(\n success,\n returndata,\n 'TransferHelper::transferFrom: transferFrom failed'\n );\n }\n}\n" }, "contracts/IForwarder.sol": { "content": "pragma solidity ^0.8.0;\n\nimport '@openzeppelin/contracts/utils/introspection/IERC165.sol';\n\ninterface IForwarder is IERC165 {\n /**\n * Sets the autoflush721 parameter.\n *\n * @param autoFlush whether to autoflush erc721 tokens\n */\n function setAutoFlush721(bool autoFlush) external;\n\n /**\n * Sets the autoflush1155 parameter.\n *\n * @param autoFlush whether to autoflush erc1155 tokens\n */\n function setAutoFlush1155(bool autoFlush) external;\n\n /**\n * Execute a token transfer of the full balance from the forwarder token to the parent address\n *\n * @param tokenContractAddress the address of the erc20 token contract\n */\n function flushTokens(address tokenContractAddress) external;\n\n /**\n * Execute a nft transfer from the forwarder to the parent address\n *\n * @param tokenContractAddress the address of the ERC721 NFT contract\n * @param tokenId The token id of the nft\n */\n function flushERC721Token(address tokenContractAddress, uint256 tokenId)\n external;\n\n /**\n * Execute a nft transfer from the forwarder to the parent address.\n *\n * @param tokenContractAddress the address of the ERC1155 NFT contract\n * @param tokenId The token id of the nft\n */\n function flushERC1155Tokens(address tokenContractAddress, uint256 tokenId)\n external;\n\n /**\n * Execute a batch nft transfer from the forwarder to the parent address.\n *\n * @param tokenContractAddress the address of the ERC1155 NFT contract\n * @param tokenIds The token ids of the nfts\n */\n function batchFlushERC1155Tokens(\n address tokenContractAddress,\n uint256[] calldata tokenIds\n ) external;\n}\n" }, "@openzeppelin/contracts/utils/introspection/IERC165.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" }, "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155Receiver is IERC165 {\n /**\n @dev Handles the receipt of a single ERC1155 token type. This function is\n called at the end of a `safeTransferFrom` after the balance has been updated.\n To accept the transfer, this must return\n `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n (i.e. 0xf23a6e61, or its own function selector).\n @param operator The address which initiated the transfer (i.e. msg.sender)\n @param from The address which previously owned the token\n @param id The ID of the token being transferred\n @param value The amount of tokens being transferred\n @param data Additional data with no specified format\n @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n @dev Handles the receipt of a multiple ERC1155 token types. This function\n is called at the end of a `safeBatchTransferFrom` after the balances have\n been updated. To accept the transfer(s), this must return\n `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n (i.e. 0xbc197c81, or its own function selector).\n @param operator The address which initiated the batch transfer (i.e. msg.sender)\n @param from The address which previously owned the token\n @param ids An array containing ids of each token being transferred (order and length must match values array)\n @param values An array containing amounts of each token being transferred (order and length must match ids array)\n @param data Additional data with no specified format\n @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" }, "@openzeppelin/contracts/utils/introspection/ERC165.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" }, "@openzeppelin/contracts/utils/Address.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\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 require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason 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 // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" } }, "settings": { "optimizer": { "enabled": false, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} } }}
1
20,290,563
59caa2d5588032d8183798d15948fe4ad62bd01edd8aac5486c8d458beaf8db0
332f4b0e48126c3d2c76ead2ae8005a9e0cca2991356cee9c309a0a3d1131122
28155960c7a8224811f462b72b633da7e4b7fd2b
28155960c7a8224811f462b72b633da7e4b7fd2b
cbaea1fad7cb03d31af14fecaa5728af7bfcc90d
6101006040526200001d6a084595161401484a0000006002620002ca565b6009553480156200002c575f80fd5b505f80546001600160a01b031916339081178255604051909182917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350737a250d5630b4cf539739df2c5dacb4c659f2488d6080819052604080516315ab88c960e31b8152905163ad5c4648916004808201926020929091908290030181865afa158015620000c1573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190620000e79190620002f4565b6001600160a01b0390811660c0525f60058190556006556080516040805163c45a015560e01b81529051919092169163c45a01559160048083019260209291908290030181865afa1580156200013f573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190620001659190620002f4565b60c0516040516364e329cb60e11b81523060048201526001600160a01b03918216602482015291169063c9c65396906044016020604051808303815f875af1158015620001b4573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190620001da9190620002f4565b6001600160a01b0390811660a0523360e08190525f8181526002602090815260408083206b033b2e3c9fd0803ce80000009055600482528083208054600160ff1991821681179092553085528285208054909116909117905560038083528184206080519096168085529583528184205f1990819055948452825280832094835293905291909120556200026b3390565b6001600160a01b03165f6001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6b033b2e3c9fd0803ce8000000604051620002bc91815260200190565b60405180910390a362000323565b8082028115828204841417620002ee57634e487b7160e01b5f52601160045260245ffd5b92915050565b5f6020828403121562000305575f80fd5b81516001600160a01b03811681146200031c575f80fd5b9392505050565b60805160a05160c05160e051611100620003655f395f81816103bb0152610bd001525f610b4401525f8181610a120152610a5401525f610b9b01526111005ff3fe60806040526004361061011e575f3560e01c8063751039fc1161009d578063a9059cbb11610062578063a9059cbb14610335578063cc1776d314610354578063dd62ed3e14610369578063f177ff2a146103ad578063f2fde38b146103df575f80fd5b8063751039fc146102925780638c0b5e22146102a65780638da5cb5b146102bb5780638ea0a979146102eb57806395d89b411461030a575f80fd5b806329e7d7cb116100e357806329e7d7cb146101fb578063313ce5671461021a5780634f7041a51461023557806370a082311461024a578063715018a61461027e575f80fd5b806306fdde0314610129578063095ea7b31461016f57806318160ddd1461019e57806323b872dd146101c6578063293230b8146101e5575f80fd5b3661012557005b5f80fd5b348015610134575f80fd5b5060408051808201909152600c81526b0426f6f6b204f662050756d760a41b60208201525b6040516101669190610e6a565b60405180910390f35b34801561017a575f80fd5b5061018e610189366004610ed0565b6103fe565b6040519015158152602001610166565b3480156101a9575f80fd5b506b033b2e3c9fd0803ce80000005b604051908152602001610166565b3480156101d1575f80fd5b5061018e6101e0366004610ef8565b610414565b3480156101f0575f80fd5b506101f9610464565b005b348015610206575f80fd5b506101f9610215366004610f31565b6104a9565b348015610225575f80fd5b5060405160128152602001610166565b348015610240575f80fd5b506101b860055481565b348015610255575f80fd5b506101b8610264366004610f51565b6001600160a01b03165f9081526002602052604090205490565b348015610289575f80fd5b506101f9610595565b34801561029d575f80fd5b506101f9610606565b3480156102b1575f80fd5b506101b860095481565b3480156102c6575f80fd5b505f546001600160a01b03165b6040516001600160a01b039091168152602001610166565b3480156102f6575f80fd5b506101f9610305366004610f51565b610641565b348015610315575f80fd5b506040805180820190915260038152620424f560ec1b6020820152610159565b348015610340575f80fd5b5061018e61034f366004610ed0565b61068d565b34801561035f575f80fd5b506101b860065481565b348015610374575f80fd5b506101b8610383366004610f71565b6001600160a01b039182165f90815260036020908152604080832093909416825291909152205490565b3480156103b8575f80fd5b507f00000000000000000000000000000000000000000000000000000000000000006102d3565b3480156103ea575f80fd5b506101f96103f9366004610f51565b610699565b5f61040a3384846106ce565b5060015b92915050565b5f6104208484846107f1565b6001600160a01b0384165f9081526003602090815260408083203380855292529091205461045a918691610455908690610fb6565b6106ce565b5060019392505050565b5f546001600160a01b031633146104965760405162461bcd60e51b815260040161048d90610fc9565b60405180910390fd5b6007805460ff1916600117905543600855565b5f546001600160a01b031633146104d25760405162461bcd60e51b815260040161048d90610fc9565b6078821061052e5760405162461bcd60e51b815260206004820152602360248201527f43616e6e6f742073657420627579207461782067726561746572207468616e2060448201526231322560e81b606482015260840161048d565b6078811061058a5760405162461bcd60e51b8152602060048201526024808201527f43616e6e6f74207365742073656c6c207461782067726561746572207468616e6044820152632031322560e01b606482015260840161048d565b600591909155600655565b5f546001600160a01b031633146105be5760405162461bcd60e51b815260040161048d90610fc9565b5f80546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a35f80546001600160a01b0319169055565b5f546001600160a01b0316331461062f5760405162461bcd60e51b815260040161048d90610fc9565b6b033b2e3c9fd0803ce8000000600955565b5f546001600160a01b0316331461066a5760405162461bcd60e51b815260040161048d90610fc9565b6001600160a01b03165f908152600460205260409020805460ff19166001179055565b5f61040a3384846107f1565b5f546001600160a01b031633146106c25760405162461bcd60e51b815260040161048d90610fc9565b6106cb81610dac565b50565b6001600160a01b0383166107305760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161048d565b6001600160a01b0382166107915760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161048d565b6001600160a01b038381165f8181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166108555760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161048d565b633b9aca00811161089b5760405162461bcd60e51b815260206004820152601060248201526f135a5b881d1c985b9cd9995c88185b5d60821b604482015260640161048d565b6001600160a01b0383165f9081526004602052604081205460ff16806108d857506001600160a01b0383165f9081526004602052604090205460ff165b156108e457505f610c41565b60075460ff16158015906108fa57506009548211155b6109515760405162461bcd60e51b815260206004820152602260248201527f4c61756e6368202f204d6178205478416d6f756e74203125206174206c61756e6044820152610c6d60f31b606482015260840161048d565b600754610100900460ff16600103610a10576001600160a01b0384165f908152600260205260408120805484929061098a908490610fb6565b90915550506001600160a01b0383165f90815260026020526040812080548492906109b6908490610ffe565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610a0291815260200190565b60405180910390a350505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b031603610a525750600554610c41565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b031603610c3e57305f90815260026020526040902054683635c9adc5dea0000081118015610aba5750600754610100900460ff16155b15610c34576a084595161401484a000000811115610ae057506a084595161401484a0000005b6007805461ff0019166101001790556040805160028082526060820183525f9260208301908036833701905050905030815f81518110610b2257610b22611011565b60200260200101906001600160a01b031690816001600160a01b0316815250507f000000000000000000000000000000000000000000000000000000000000000081600181518110610b7657610b76611011565b6001600160a01b03928316602091820292909201015260405163791ac94760e01b81527f00000000000000000000000000000000000000000000000000000000000000009091169063791ac94790610bfa9085905f9086907f0000000000000000000000000000000000000000000000000000000000000000904290600401611025565b5f604051808303815f87803b158015610c11575f80fd5b505af1158015610c23573d5f803e3d5ffd5b50506007805461ff00191690555050505b5050600654610c41565b505f5b8015610d7f575f6064610c548385611094565b610c5e91906110ab565b90505f610c6b8285610fb6565b6001600160a01b0387165f90815260026020526040812080549293508692909190610c97908490610fb6565b90915550506001600160a01b0385165f9081526002602052604081208054839290610cc3908490610ffe565b9091555050305f9081526002602052604081208054849290610ce6908490610ffe565b909155505060405182815230906001600160a01b038816907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610d7091815260200190565b60405180910390a35050610da6565b6001600160a01b0384165f908152600260205260408120805484929061098a908490610fb6565b50505050565b6001600160a01b038116610e115760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161048d565b5f80546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a35f80546001600160a01b0319166001600160a01b0392909216919091179055565b5f6020808352835180828501525f5b81811015610e9557858101830151858201604001528201610e79565b505f604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b0381168114610ecb575f80fd5b919050565b5f8060408385031215610ee1575f80fd5b610eea83610eb5565b946020939093013593505050565b5f805f60608486031215610f0a575f80fd5b610f1384610eb5565b9250610f2160208501610eb5565b9150604084013590509250925092565b5f8060408385031215610f42575f80fd5b50508035926020909101359150565b5f60208284031215610f61575f80fd5b610f6a82610eb5565b9392505050565b5f8060408385031215610f82575f80fd5b610f8b83610eb5565b9150610f9960208401610eb5565b90509250929050565b634e487b7160e01b5f52601160045260245ffd5b8181038181111561040e5761040e610fa2565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b8082018082111561040e5761040e610fa2565b634e487b7160e01b5f52603260045260245ffd5b5f60a082018783526020878185015260a0604085015281875180845260c08601915082890193505f5b818110156110735784516001600160a01b03168352938301939183019160010161104e565b50506001600160a01b03969096166060850152505050608001529392505050565b808202811582820484141761040e5761040e610fa2565b5f826110c557634e487b7160e01b5f52601260045260245ffd5b50049056fea26469706673582212204a9b89dce5cb10b5f26b955bc7607f95b167152699ccc512e0a7515fe07da59464736f6c63430008140033
60806040526004361061011e575f3560e01c8063751039fc1161009d578063a9059cbb11610062578063a9059cbb14610335578063cc1776d314610354578063dd62ed3e14610369578063f177ff2a146103ad578063f2fde38b146103df575f80fd5b8063751039fc146102925780638c0b5e22146102a65780638da5cb5b146102bb5780638ea0a979146102eb57806395d89b411461030a575f80fd5b806329e7d7cb116100e357806329e7d7cb146101fb578063313ce5671461021a5780634f7041a51461023557806370a082311461024a578063715018a61461027e575f80fd5b806306fdde0314610129578063095ea7b31461016f57806318160ddd1461019e57806323b872dd146101c6578063293230b8146101e5575f80fd5b3661012557005b5f80fd5b348015610134575f80fd5b5060408051808201909152600c81526b0426f6f6b204f662050756d760a41b60208201525b6040516101669190610e6a565b60405180910390f35b34801561017a575f80fd5b5061018e610189366004610ed0565b6103fe565b6040519015158152602001610166565b3480156101a9575f80fd5b506b033b2e3c9fd0803ce80000005b604051908152602001610166565b3480156101d1575f80fd5b5061018e6101e0366004610ef8565b610414565b3480156101f0575f80fd5b506101f9610464565b005b348015610206575f80fd5b506101f9610215366004610f31565b6104a9565b348015610225575f80fd5b5060405160128152602001610166565b348015610240575f80fd5b506101b860055481565b348015610255575f80fd5b506101b8610264366004610f51565b6001600160a01b03165f9081526002602052604090205490565b348015610289575f80fd5b506101f9610595565b34801561029d575f80fd5b506101f9610606565b3480156102b1575f80fd5b506101b860095481565b3480156102c6575f80fd5b505f546001600160a01b03165b6040516001600160a01b039091168152602001610166565b3480156102f6575f80fd5b506101f9610305366004610f51565b610641565b348015610315575f80fd5b506040805180820190915260038152620424f560ec1b6020820152610159565b348015610340575f80fd5b5061018e61034f366004610ed0565b61068d565b34801561035f575f80fd5b506101b860065481565b348015610374575f80fd5b506101b8610383366004610f71565b6001600160a01b039182165f90815260036020908152604080832093909416825291909152205490565b3480156103b8575f80fd5b507f00000000000000000000000028155960c7a8224811f462b72b633da7e4b7fd2b6102d3565b3480156103ea575f80fd5b506101f96103f9366004610f51565b610699565b5f61040a3384846106ce565b5060015b92915050565b5f6104208484846107f1565b6001600160a01b0384165f9081526003602090815260408083203380855292529091205461045a918691610455908690610fb6565b6106ce565b5060019392505050565b5f546001600160a01b031633146104965760405162461bcd60e51b815260040161048d90610fc9565b60405180910390fd5b6007805460ff1916600117905543600855565b5f546001600160a01b031633146104d25760405162461bcd60e51b815260040161048d90610fc9565b6078821061052e5760405162461bcd60e51b815260206004820152602360248201527f43616e6e6f742073657420627579207461782067726561746572207468616e2060448201526231322560e81b606482015260840161048d565b6078811061058a5760405162461bcd60e51b8152602060048201526024808201527f43616e6e6f74207365742073656c6c207461782067726561746572207468616e6044820152632031322560e01b606482015260840161048d565b600591909155600655565b5f546001600160a01b031633146105be5760405162461bcd60e51b815260040161048d90610fc9565b5f80546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a35f80546001600160a01b0319169055565b5f546001600160a01b0316331461062f5760405162461bcd60e51b815260040161048d90610fc9565b6b033b2e3c9fd0803ce8000000600955565b5f546001600160a01b0316331461066a5760405162461bcd60e51b815260040161048d90610fc9565b6001600160a01b03165f908152600460205260409020805460ff19166001179055565b5f61040a3384846107f1565b5f546001600160a01b031633146106c25760405162461bcd60e51b815260040161048d90610fc9565b6106cb81610dac565b50565b6001600160a01b0383166107305760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161048d565b6001600160a01b0382166107915760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161048d565b6001600160a01b038381165f8181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166108555760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161048d565b633b9aca00811161089b5760405162461bcd60e51b815260206004820152601060248201526f135a5b881d1c985b9cd9995c88185b5d60821b604482015260640161048d565b6001600160a01b0383165f9081526004602052604081205460ff16806108d857506001600160a01b0383165f9081526004602052604090205460ff165b156108e457505f610c41565b60075460ff16158015906108fa57506009548211155b6109515760405162461bcd60e51b815260206004820152602260248201527f4c61756e6368202f204d6178205478416d6f756e74203125206174206c61756e6044820152610c6d60f31b606482015260840161048d565b600754610100900460ff16600103610a10576001600160a01b0384165f908152600260205260408120805484929061098a908490610fb6565b90915550506001600160a01b0383165f90815260026020526040812080548492906109b6908490610ffe565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610a0291815260200190565b60405180910390a350505050565b7f00000000000000000000000028c8caca882d7525c86b1ebd50a4b586744fcedc6001600160a01b0316846001600160a01b031603610a525750600554610c41565b7f00000000000000000000000028c8caca882d7525c86b1ebd50a4b586744fcedc6001600160a01b0316836001600160a01b031603610c3e57305f90815260026020526040902054683635c9adc5dea0000081118015610aba5750600754610100900460ff16155b15610c34576a084595161401484a000000811115610ae057506a084595161401484a0000005b6007805461ff0019166101001790556040805160028082526060820183525f9260208301908036833701905050905030815f81518110610b2257610b22611011565b60200260200101906001600160a01b031690816001600160a01b0316815250507f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281600181518110610b7657610b76611011565b6001600160a01b03928316602091820292909201015260405163791ac94760e01b81527f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d9091169063791ac94790610bfa9085905f9086907f00000000000000000000000028155960c7a8224811f462b72b633da7e4b7fd2b904290600401611025565b5f604051808303815f87803b158015610c11575f80fd5b505af1158015610c23573d5f803e3d5ffd5b50506007805461ff00191690555050505b5050600654610c41565b505f5b8015610d7f575f6064610c548385611094565b610c5e91906110ab565b90505f610c6b8285610fb6565b6001600160a01b0387165f90815260026020526040812080549293508692909190610c97908490610fb6565b90915550506001600160a01b0385165f9081526002602052604081208054839290610cc3908490610ffe565b9091555050305f9081526002602052604081208054849290610ce6908490610ffe565b909155505060405182815230906001600160a01b038816907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610d7091815260200190565b60405180910390a35050610da6565b6001600160a01b0384165f908152600260205260408120805484929061098a908490610fb6565b50505050565b6001600160a01b038116610e115760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161048d565b5f80546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a35f80546001600160a01b0319166001600160a01b0392909216919091179055565b5f6020808352835180828501525f5b81811015610e9557858101830151858201604001528201610e79565b505f604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b0381168114610ecb575f80fd5b919050565b5f8060408385031215610ee1575f80fd5b610eea83610eb5565b946020939093013593505050565b5f805f60608486031215610f0a575f80fd5b610f1384610eb5565b9250610f2160208501610eb5565b9150604084013590509250925092565b5f8060408385031215610f42575f80fd5b50508035926020909101359150565b5f60208284031215610f61575f80fd5b610f6a82610eb5565b9392505050565b5f8060408385031215610f82575f80fd5b610f8b83610eb5565b9150610f9960208401610eb5565b90509250929050565b634e487b7160e01b5f52601160045260245ffd5b8181038181111561040e5761040e610fa2565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b8082018082111561040e5761040e610fa2565b634e487b7160e01b5f52603260045260245ffd5b5f60a082018783526020878185015260a0604085015281875180845260c08601915082890193505f5b818110156110735784516001600160a01b03168352938301939183019160010161104e565b50506001600160a01b03969096166060850152505050608001529392505050565b808202811582820484141761040e5761040e610fa2565b5f826110c557634e487b7160e01b5f52601260045260245ffd5b50049056fea26469706673582212204a9b89dce5cb10b5f26b955bc7607f95b167152699ccc512e0a7515fe07da59464736f6c63430008140033
/** *Submitted for verification at Etherscan.io on 2024-06-29 */ /** *Submitted for verification at Etherscan.io on 2024-06-22 */ /** *Submitted for verification at Etherscan.io on 2024-06-14 */ /** *Submitted for verification at Etherscan.io on 2024-05-30 */ /** *Submitted for verification at Etherscan.io on 2024-05-03 */ pragma solidity 0.8.20; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } } contract Ownable is Context { address private _owner; address private _previousOwner; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); constructor() { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function transferOwnership(address newOwner) public onlyOwner { _transferOwnership(newOwner); } function _transferOwnership(address newOwner) internal { require( newOwner != address(0), "Ownable: new owner is the zero address" ); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval( address indexed owner, address indexed spender, uint256 value ); } interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface IUniswapV2Router02 { function swapExactTokensForETHSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external; function factory() external pure returns (address); function WETH() external pure returns (address); } contract BOP is Context, IERC20, Ownable { string private constant _name = "Book Of Pump"; string private constant _symbol = "BOP"; uint256 private constant _totalSupply = 1_000_000_000e18; uint256 private constant onePercent = 10_000_000e18; uint256 private constant minSwap = 1_000e18; uint8 private constant _decimals = 18; mapping(address => uint256) private _balance; mapping(address => mapping(address => uint256)) private _allowances; mapping(address => bool) private _isExcludedFromFeeWallet; IUniswapV2Router02 immutable uniswapV2Router; address immutable uniswapV2Pair; address immutable WETH; address payable immutable marketingWallet; uint256 public buyTax; uint256 public sellTax; uint8 private launch; uint8 private inSwapAndLiquify; uint256 private launchBlock; uint256 public maxTxAmount = onePercent * 2; //max Tx for first mins after launch constructor() { uniswapV2Router = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D ); WETH = uniswapV2Router.WETH(); buyTax = 0; sellTax = 0; uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair( address(this), WETH ); marketingWallet = payable(msg.sender); _balance[msg.sender] = _totalSupply; _isExcludedFromFeeWallet[marketingWallet] = true; _isExcludedFromFeeWallet[msg.sender] = true; _isExcludedFromFeeWallet[address(this)] = true; _allowances[address(this)][address(uniswapV2Router)] = type(uint256) .max; _allowances[msg.sender][address(uniswapV2Router)] = type(uint256).max; _allowances[marketingWallet][address(uniswapV2Router)] = type(uint256) .max; emit Transfer(address(0), _msgSender(), _totalSupply); } function name() public pure returns (string memory) { return _name; } function setMarketingWallet() public view returns (address) { return marketingWallet; } function symbol() public pure returns (string memory) { return _symbol; } function decimals() public pure returns (uint8) { return _decimals; } function totalSupply() public pure override returns (uint256) { return _totalSupply; } function balanceOf(address account) public view override returns (uint256) { return _balance[account]; } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom( address sender, address recipient, uint256 amount ) public override returns (bool) { _transfer(sender, recipient, amount); _approve( sender, _msgSender(), _allowances[sender][_msgSender()] - amount ); return true; } function removeLimits() external onlyOwner { maxTxAmount = _totalSupply; } function _approve( address owner, address spender, uint256 amount ) private { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function startTrading() external onlyOwner { launch = 1; launchBlock = block.number; } function excludeWalletFromFees(address wallet) external onlyOwner { _isExcludedFromFeeWallet[wallet] = true; } function updateFeeAmount(uint256 newBuyTax, uint256 newSellTax) external onlyOwner { require(newBuyTax < 120, "Cannot set buy tax greater than 12%"); require(newSellTax < 120, "Cannot set sell tax greater than 12%"); buyTax = newBuyTax; sellTax = newSellTax; } function _transfer( address from, address to, uint256 amount ) private { require(from != address(0), "ERC20: transfer from the zero address"); require(amount > 1e9, "Min transfer amt"); uint256 _tax; if (_isExcludedFromFeeWallet[from] || _isExcludedFromFeeWallet[to]) { _tax = 0; } else { require( launch != 0 && amount <= maxTxAmount, "Launch / Max TxAmount 1% at launch" ); if (inSwapAndLiquify == 1) { //No tax transfer _balance[from] -= amount; _balance[to] += amount; emit Transfer(from, to, amount); return; } if (from == uniswapV2Pair) { _tax = buyTax; } else if (to == uniswapV2Pair) { uint256 tokensToSwap = _balance[address(this)]; if (tokensToSwap > minSwap && inSwapAndLiquify == 0) { if (tokensToSwap > onePercent) { tokensToSwap = onePercent; } inSwapAndLiquify = 1; address[] memory path = new address[](2); path[0] = address(this); path[1] = WETH; uniswapV2Router .swapExactTokensForETHSupportingFeeOnTransferTokens( tokensToSwap, 0, path, marketingWallet, block.timestamp ); inSwapAndLiquify = 0; } _tax = sellTax; } else { _tax = 0; } } //Is there tax for sender|receiver? if (_tax != 0) { //Tax transfer uint256 taxTokens = (amount * _tax) / 100; uint256 transferAmount = amount - taxTokens; _balance[from] -= amount; _balance[to] += transferAmount; _balance[address(this)] += taxTokens; emit Transfer(from, address(this), taxTokens); emit Transfer(from, to, transferAmount); } else { //No tax transfer _balance[from] -= amount; _balance[to] += amount; emit Transfer(from, to, amount); } } receive() external payable {} }
1
20,290,563
59caa2d5588032d8183798d15948fe4ad62bd01edd8aac5486c8d458beaf8db0
332f4b0e48126c3d2c76ead2ae8005a9e0cca2991356cee9c309a0a3d1131122
28155960c7a8224811f462b72b633da7e4b7fd2b
5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f
28c8caca882d7525c86b1ebd50a4b586744fcedc
60806040526001600c5534801561001557600080fd5b506040514690806052612d228239604080519182900360520182208282018252600a8352692ab734b9bbb0b8102b1960b11b6020938401528151808301835260018152603160f81b908401528151808401919091527fbfcc8ef98ffbf7b6c3fec7bf5185b566b9863e35a9d83acd49ad6824b5969738818301527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606082015260808101949094523060a0808601919091528151808603909101815260c09094019052825192019190912060035550600580546001600160a01b03191633179055612c1d806101056000396000f3fe608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a7146105da578063d505accf146105e2578063dd62ed3e14610640578063fff6cae91461067b576101b9565b8063ba9a7a5614610597578063bc25cf771461059f578063c45a0155146105d2576101b9565b80637ecebe00116100d35780637ecebe00146104d757806389afcb441461050a57806395d89b4114610556578063a9059cbb1461055e576101b9565b80636a6278421461046957806370a082311461049c5780637464fc3d146104cf576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610416578063485cc9551461041e5780635909c0d5146104595780635a3d549314610461576101b9565b806323b872dd146103ad57806330adf81f146103f0578063313ce567146103f8576101b9565b8063095ea7b311610197578063095ea7b3146103155780630dfe16811461036257806318160ddd14610393576101b9565b8063022c0d9f146101be57806306fdde03146102595780630902f1ac146102d6575b600080fd5b610257600480360360808110156101d457600080fd5b81359160208101359173ffffffffffffffffffffffffffffffffffffffff604083013516919081019060808101606082013564010000000081111561021857600080fd5b82018360208201111561022a57600080fd5b8035906020019184600183028401116401000000008311171561024c57600080fd5b509092509050610683565b005b610261610d57565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029b578181015183820152602001610283565b50505050905090810190601f1680156102c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102de610d90565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b61034e6004803603604081101561032b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de5565b604080519115158252519081900360200190f35b61036a610dfc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61039b610e18565b60408051918252519081900360200190f35b61034e600480360360608110156103c357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e1e565b61039b610efd565b610400610f21565b6040805160ff9092168252519081900360200190f35b61039b610f26565b6102576004803603604081101561043457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610f2c565b61039b611005565b61039b61100b565b61039b6004803603602081101561047f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611011565b61039b600480360360208110156104b257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113cb565b61039b6113dd565b61039b600480360360208110156104ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113e3565b61053d6004803603602081101561052057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113f5565b6040805192835260208301919091528051918290030190f35b610261611892565b61034e6004803603604081101561057457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356118cb565b61039b6118d8565b610257600480360360208110156105b557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166118de565b61036a611ad4565b61036a611af0565b610257600480360360e08110156105f857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b0c565b61039b6004803603604081101561065657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611dd8565b610257611df5565b600c546001146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55841515806107075750600084115b61075c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b2f6025913960400191505060405180910390fd5b600080610767610d90565b5091509150816dffffffffffffffffffffffffffff168710801561079a5750806dffffffffffffffffffffffffffff1686105b6107ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b786021913960400191505060405180910390fd5b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff91821691908116908916821480159061085457508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b6108bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a156108d0576108d0828a8d611fdb565b89156108e1576108e1818a8c611fdb565b86156109c3578873ffffffffffffffffffffffffffffffffffffffff166310d1e85c338d8d8c8c6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050505b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8416916370a08231916024808301926020929190829003018186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191955073ffffffffffffffffffffffffffffffffffffffff8316916370a0823191602480820192602092909190829003018186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d6020811015610af557600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a90038311610b1f576000610b35565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610b59576000610b6f565b89856dffffffffffffffffffffffffffff160383035b90506000821180610b805750600081115b610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b546024913960400191505060405180910390fd5b6000610c09610beb84600363ffffffff6121e816565b610bfd876103e863ffffffff6121e816565b9063ffffffff61226e16565b90506000610c21610beb84600363ffffffff6121e816565b9050610c59620f4240610c4d6dffffffffffffffffffffffffffff8b8116908b1663ffffffff6121e816565b9063ffffffff6121e816565b610c69838363ffffffff6121e816565b1015610cd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610ce4848488886122e0565b60408051838152602081018390528082018d9052606081018c9052905173ffffffffffffffffffffffffffffffffffffffff8b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a81526020017f556e69737761702056320000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610df233848461259c565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610ee85773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610eb6908363ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610ef384848461260b565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610fb257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c5460011461108457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611094610d90565b50600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905193955091935060009273ffffffffffffffffffffffffffffffffffffffff909116916370a08231916024808301926020929190829003018186803b15801561110e57600080fd5b505afa158015611122573d6000803e3d6000fd5b505050506040513d602081101561113857600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905192935060009273ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d60208110156111db57600080fd5b505190506000611201836dffffffffffffffffffffffffffff871663ffffffff61226e16565b90506000611225836dffffffffffffffffffffffffffff871663ffffffff61226e16565b9050600061123387876126ec565b600054909150806112705761125c6103e8610bfd611257878763ffffffff6121e816565b612878565b985061126b60006103e86128ca565b6112cd565b6112ca6dffffffffffffffffffffffffffff8916611294868463ffffffff6121e816565b8161129b57fe5b046dffffffffffffffffffffffffffff89166112bd868563ffffffff6121e816565b816112c457fe5b0461297a565b98505b60008911611326576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612bc16028913960400191505060405180910390fd5b6113308a8a6128ca565b61133c86868a8a6122e0565b811561137e5760085461137a906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461146957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611479610d90565b50600654600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905194965092945073ffffffffffffffffffffffffffffffffffffffff9182169391169160009184916370a08231916024808301926020929190829003018186803b1580156114fb57600080fd5b505afa15801561150f573d6000803e3d6000fd5b505050506040513d602081101561152557600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191925060009173ffffffffffffffffffffffffffffffffffffffff8516916370a08231916024808301926020929190829003018186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d60208110156115c357600080fd5b5051306000908152600160205260408120549192506115e288886126ec565b600054909150806115f9848763ffffffff6121e816565b8161160057fe5b049a5080611614848663ffffffff6121e816565b8161161b57fe5b04995060008b11801561162e575060008a115b611683576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612b996028913960400191505060405180910390fd5b61168d3084612992565b611698878d8d611fdb565b6116a3868d8c611fdb565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8916916370a08231916024808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d602081101561173957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191965073ffffffffffffffffffffffffffffffffffffffff8816916370a0823191602480820192602092909190829003018186803b1580156117ab57600080fd5b505afa1580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b505193506117e585858b8b6122e0565b811561182757600854611823906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b604080518c8152602081018c9052815173ffffffffffffffffffffffffffffffffffffffff8f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f554e492d5632000000000000000000000000000000000000000000000000000081525081565b6000610df233848461260b565b6103e881565b600c5460011461194f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654600754600854604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff9485169490931692611a2b9285928792611a26926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff61226e16565b611fdb565b600854604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611aca9284928792611a26926e01000000000000000000000000000090046dffffffffffffffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff8616916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611b7b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff80891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e2808201937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019281900390910190855afa158015611cdc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611d5757508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611dc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611dcd89898961259c565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611e6657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611fd49273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b158015611f7a57600080fd5b505afa158015611f8e573d6000803e3d6000fd5b505050506040513d6020811015611fa457600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166122e0565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e743235362900000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b602083106120e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016120a4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612143576040519150601f19603f3d011682016040523d82523d6000602084013e612148565b606091505b5091509150818015612176575080511580612176575080806020019051602081101561217357600080fd5b50515b6121e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b60008115806122035750508082028282828161220057fe5b04145b610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061230c57506dffffffffffffffffffffffffffff8311155b61237757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906123c757506dffffffffffffffffffffffffffff841615155b80156123e257506dffffffffffffffffffffffffffff831615155b15612492578063ffffffff16612425856123fb86612a57565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169063ffffffff612a7b16565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff8116612465846123fb87612a57565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054612641908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160205260408082209390935590841681522054612683908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561275757600080fd5b505afa15801561276b573d6000803e3d6000fd5b505050506040513d602081101561278157600080fd5b5051600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061286457801561285f5760006127d86112576dffffffffffffffffffffffffffff88811690881663ffffffff6121e816565b905060006127e583612878565b90508082111561285c576000612813612804848463ffffffff61226e16565b6000549063ffffffff6121e816565b905060006128388361282c86600563ffffffff6121e816565b9063ffffffff612abc16565b9050600081838161284557fe5b04905080156128585761285887826128ca565b5050505b50505b612870565b8015612870576000600b555b505092915050565b600060038211156128bb575080600160028204015b818110156128b5578091506002818285816128a457fe5b0401816128ad57fe5b04905061288d565b506128c5565b81156128c5575060015b919050565b6000546128dd908263ffffffff612abc16565b600090815573ffffffffffffffffffffffffffffffffffffffff8316815260016020526040902054612915908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000818310612989578161298b565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020546129c8908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081209190915554612a02908263ffffffff61226e16565b600090815560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff841681612ab457fe5b049392505050565b80820182811015610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158207dca18479e58487606bf70c79e44d8dee62353c9ee6d01f9a9d70885b8765f2264736f6c63430005100032454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e747261637429
608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a7146105da578063d505accf146105e2578063dd62ed3e14610640578063fff6cae91461067b576101b9565b8063ba9a7a5614610597578063bc25cf771461059f578063c45a0155146105d2576101b9565b80637ecebe00116100d35780637ecebe00146104d757806389afcb441461050a57806395d89b4114610556578063a9059cbb1461055e576101b9565b80636a6278421461046957806370a082311461049c5780637464fc3d146104cf576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610416578063485cc9551461041e5780635909c0d5146104595780635a3d549314610461576101b9565b806323b872dd146103ad57806330adf81f146103f0578063313ce567146103f8576101b9565b8063095ea7b311610197578063095ea7b3146103155780630dfe16811461036257806318160ddd14610393576101b9565b8063022c0d9f146101be57806306fdde03146102595780630902f1ac146102d6575b600080fd5b610257600480360360808110156101d457600080fd5b81359160208101359173ffffffffffffffffffffffffffffffffffffffff604083013516919081019060808101606082013564010000000081111561021857600080fd5b82018360208201111561022a57600080fd5b8035906020019184600183028401116401000000008311171561024c57600080fd5b509092509050610683565b005b610261610d57565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029b578181015183820152602001610283565b50505050905090810190601f1680156102c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102de610d90565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b61034e6004803603604081101561032b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de5565b604080519115158252519081900360200190f35b61036a610dfc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61039b610e18565b60408051918252519081900360200190f35b61034e600480360360608110156103c357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e1e565b61039b610efd565b610400610f21565b6040805160ff9092168252519081900360200190f35b61039b610f26565b6102576004803603604081101561043457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610f2c565b61039b611005565b61039b61100b565b61039b6004803603602081101561047f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611011565b61039b600480360360208110156104b257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113cb565b61039b6113dd565b61039b600480360360208110156104ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113e3565b61053d6004803603602081101561052057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113f5565b6040805192835260208301919091528051918290030190f35b610261611892565b61034e6004803603604081101561057457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356118cb565b61039b6118d8565b610257600480360360208110156105b557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166118de565b61036a611ad4565b61036a611af0565b610257600480360360e08110156105f857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b0c565b61039b6004803603604081101561065657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611dd8565b610257611df5565b600c546001146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55841515806107075750600084115b61075c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b2f6025913960400191505060405180910390fd5b600080610767610d90565b5091509150816dffffffffffffffffffffffffffff168710801561079a5750806dffffffffffffffffffffffffffff1686105b6107ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b786021913960400191505060405180910390fd5b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff91821691908116908916821480159061085457508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b6108bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a156108d0576108d0828a8d611fdb565b89156108e1576108e1818a8c611fdb565b86156109c3578873ffffffffffffffffffffffffffffffffffffffff166310d1e85c338d8d8c8c6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050505b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8416916370a08231916024808301926020929190829003018186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191955073ffffffffffffffffffffffffffffffffffffffff8316916370a0823191602480820192602092909190829003018186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d6020811015610af557600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a90038311610b1f576000610b35565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610b59576000610b6f565b89856dffffffffffffffffffffffffffff160383035b90506000821180610b805750600081115b610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b546024913960400191505060405180910390fd5b6000610c09610beb84600363ffffffff6121e816565b610bfd876103e863ffffffff6121e816565b9063ffffffff61226e16565b90506000610c21610beb84600363ffffffff6121e816565b9050610c59620f4240610c4d6dffffffffffffffffffffffffffff8b8116908b1663ffffffff6121e816565b9063ffffffff6121e816565b610c69838363ffffffff6121e816565b1015610cd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610ce4848488886122e0565b60408051838152602081018390528082018d9052606081018c9052905173ffffffffffffffffffffffffffffffffffffffff8b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a81526020017f556e69737761702056320000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610df233848461259c565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610ee85773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610eb6908363ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610ef384848461260b565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610fb257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c5460011461108457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611094610d90565b50600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905193955091935060009273ffffffffffffffffffffffffffffffffffffffff909116916370a08231916024808301926020929190829003018186803b15801561110e57600080fd5b505afa158015611122573d6000803e3d6000fd5b505050506040513d602081101561113857600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905192935060009273ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d60208110156111db57600080fd5b505190506000611201836dffffffffffffffffffffffffffff871663ffffffff61226e16565b90506000611225836dffffffffffffffffffffffffffff871663ffffffff61226e16565b9050600061123387876126ec565b600054909150806112705761125c6103e8610bfd611257878763ffffffff6121e816565b612878565b985061126b60006103e86128ca565b6112cd565b6112ca6dffffffffffffffffffffffffffff8916611294868463ffffffff6121e816565b8161129b57fe5b046dffffffffffffffffffffffffffff89166112bd868563ffffffff6121e816565b816112c457fe5b0461297a565b98505b60008911611326576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612bc16028913960400191505060405180910390fd5b6113308a8a6128ca565b61133c86868a8a6122e0565b811561137e5760085461137a906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461146957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611479610d90565b50600654600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905194965092945073ffffffffffffffffffffffffffffffffffffffff9182169391169160009184916370a08231916024808301926020929190829003018186803b1580156114fb57600080fd5b505afa15801561150f573d6000803e3d6000fd5b505050506040513d602081101561152557600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191925060009173ffffffffffffffffffffffffffffffffffffffff8516916370a08231916024808301926020929190829003018186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d60208110156115c357600080fd5b5051306000908152600160205260408120549192506115e288886126ec565b600054909150806115f9848763ffffffff6121e816565b8161160057fe5b049a5080611614848663ffffffff6121e816565b8161161b57fe5b04995060008b11801561162e575060008a115b611683576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612b996028913960400191505060405180910390fd5b61168d3084612992565b611698878d8d611fdb565b6116a3868d8c611fdb565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8916916370a08231916024808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d602081101561173957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191965073ffffffffffffffffffffffffffffffffffffffff8816916370a0823191602480820192602092909190829003018186803b1580156117ab57600080fd5b505afa1580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b505193506117e585858b8b6122e0565b811561182757600854611823906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b604080518c8152602081018c9052815173ffffffffffffffffffffffffffffffffffffffff8f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f554e492d5632000000000000000000000000000000000000000000000000000081525081565b6000610df233848461260b565b6103e881565b600c5460011461194f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654600754600854604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff9485169490931692611a2b9285928792611a26926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff61226e16565b611fdb565b600854604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611aca9284928792611a26926e01000000000000000000000000000090046dffffffffffffffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff8616916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611b7b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff80891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e2808201937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019281900390910190855afa158015611cdc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611d5757508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611dc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611dcd89898961259c565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611e6657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611fd49273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b158015611f7a57600080fd5b505afa158015611f8e573d6000803e3d6000fd5b505050506040513d6020811015611fa457600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166122e0565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e743235362900000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b602083106120e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016120a4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612143576040519150601f19603f3d011682016040523d82523d6000602084013e612148565b606091505b5091509150818015612176575080511580612176575080806020019051602081101561217357600080fd5b50515b6121e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b60008115806122035750508082028282828161220057fe5b04145b610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061230c57506dffffffffffffffffffffffffffff8311155b61237757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906123c757506dffffffffffffffffffffffffffff841615155b80156123e257506dffffffffffffffffffffffffffff831615155b15612492578063ffffffff16612425856123fb86612a57565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169063ffffffff612a7b16565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff8116612465846123fb87612a57565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054612641908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160205260408082209390935590841681522054612683908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561275757600080fd5b505afa15801561276b573d6000803e3d6000fd5b505050506040513d602081101561278157600080fd5b5051600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061286457801561285f5760006127d86112576dffffffffffffffffffffffffffff88811690881663ffffffff6121e816565b905060006127e583612878565b90508082111561285c576000612813612804848463ffffffff61226e16565b6000549063ffffffff6121e816565b905060006128388361282c86600563ffffffff6121e816565b9063ffffffff612abc16565b9050600081838161284557fe5b04905080156128585761285887826128ca565b5050505b50505b612870565b8015612870576000600b555b505092915050565b600060038211156128bb575080600160028204015b818110156128b5578091506002818285816128a457fe5b0401816128ad57fe5b04905061288d565b506128c5565b81156128c5575060015b919050565b6000546128dd908263ffffffff612abc16565b600090815573ffffffffffffffffffffffffffffffffffffffff8316815260016020526040902054612915908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000818310612989578161298b565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020546129c8908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081209190915554612a02908263ffffffff61226e16565b600090815560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff841681612ab457fe5b049392505050565b80820182811015610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158207dca18479e58487606bf70c79e44d8dee62353c9ee6d01f9a9d70885b8765f2264736f6c63430005100032
// File: contracts/interfaces/IUniswapV2Pair.sol pragma solidity >=0.5.0; interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; } // File: contracts/interfaces/IUniswapV2ERC20.sol pragma solidity >=0.5.0; interface IUniswapV2ERC20 { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; } // File: contracts/libraries/SafeMath.sol pragma solidity =0.5.16; // a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math) library SafeMath { function add(uint x, uint y) internal pure returns (uint z) { require((z = x + y) >= x, 'ds-math-add-overflow'); } function sub(uint x, uint y) internal pure returns (uint z) { require((z = x - y) <= x, 'ds-math-sub-underflow'); } function mul(uint x, uint y) internal pure returns (uint z) { require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow'); } } // File: contracts/UniswapV2ERC20.sol pragma solidity =0.5.16; contract UniswapV2ERC20 is IUniswapV2ERC20 { using SafeMath for uint; string public constant name = 'Uniswap V2'; string public constant symbol = 'UNI-V2'; uint8 public constant decimals = 18; uint public totalSupply; mapping(address => uint) public balanceOf; mapping(address => mapping(address => uint)) public allowance; bytes32 public DOMAIN_SEPARATOR; // keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9; mapping(address => uint) public nonces; event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); constructor() public { uint chainId; assembly { chainId := chainid } DOMAIN_SEPARATOR = keccak256( abi.encode( keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'), keccak256(bytes(name)), keccak256(bytes('1')), chainId, address(this) ) ); } function _mint(address to, uint value) internal { totalSupply = totalSupply.add(value); balanceOf[to] = balanceOf[to].add(value); emit Transfer(address(0), to, value); } function _burn(address from, uint value) internal { balanceOf[from] = balanceOf[from].sub(value); totalSupply = totalSupply.sub(value); emit Transfer(from, address(0), value); } function _approve(address owner, address spender, uint value) private { allowance[owner][spender] = value; emit Approval(owner, spender, value); } function _transfer(address from, address to, uint value) private { balanceOf[from] = balanceOf[from].sub(value); balanceOf[to] = balanceOf[to].add(value); emit Transfer(from, to, value); } function approve(address spender, uint value) external returns (bool) { _approve(msg.sender, spender, value); return true; } function transfer(address to, uint value) external returns (bool) { _transfer(msg.sender, to, value); return true; } function transferFrom(address from, address to, uint value) external returns (bool) { if (allowance[from][msg.sender] != uint(-1)) { allowance[from][msg.sender] = allowance[from][msg.sender].sub(value); } _transfer(from, to, value); return true; } function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external { require(deadline >= block.timestamp, 'UniswapV2: EXPIRED'); bytes32 digest = keccak256( abi.encodePacked( '\x19\x01', DOMAIN_SEPARATOR, keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline)) ) ); address recoveredAddress = ecrecover(digest, v, r, s); require(recoveredAddress != address(0) && recoveredAddress == owner, 'UniswapV2: INVALID_SIGNATURE'); _approve(owner, spender, value); } } // File: contracts/libraries/Math.sol pragma solidity =0.5.16; // a library for performing various math operations library Math { function min(uint x, uint y) internal pure returns (uint z) { z = x < y ? x : y; } // babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method) function sqrt(uint y) internal pure returns (uint z) { if (y > 3) { z = y; uint x = y / 2 + 1; while (x < z) { z = x; x = (y / x + x) / 2; } } else if (y != 0) { z = 1; } } } // File: contracts/libraries/UQ112x112.sol pragma solidity =0.5.16; // a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format)) // range: [0, 2**112 - 1] // resolution: 1 / 2**112 library UQ112x112 { uint224 constant Q112 = 2**112; // encode a uint112 as a UQ112x112 function encode(uint112 y) internal pure returns (uint224 z) { z = uint224(y) * Q112; // never overflows } // divide a UQ112x112 by a uint112, returning a UQ112x112 function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) { z = x / uint224(y); } } // File: contracts/interfaces/IERC20.sol pragma solidity >=0.5.0; interface IERC20 { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); } // File: contracts/interfaces/IUniswapV2Factory.sol pragma solidity >=0.5.0; interface IUniswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint) external view returns (address pair); function allPairsLength() external view returns (uint); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; } // File: contracts/interfaces/IUniswapV2Callee.sol pragma solidity >=0.5.0; interface IUniswapV2Callee { function uniswapV2Call(address sender, uint amount0, uint amount1, bytes calldata data) external; } // File: contracts/UniswapV2Pair.sol pragma solidity =0.5.16; contract UniswapV2Pair is IUniswapV2Pair, UniswapV2ERC20 { using SafeMath for uint; using UQ112x112 for uint224; uint public constant MINIMUM_LIQUIDITY = 10**3; bytes4 private constant SELECTOR = bytes4(keccak256(bytes('transfer(address,uint256)'))); address public factory; address public token0; address public token1; uint112 private reserve0; // uses single storage slot, accessible via getReserves uint112 private reserve1; // uses single storage slot, accessible via getReserves uint32 private blockTimestampLast; // uses single storage slot, accessible via getReserves uint public price0CumulativeLast; uint public price1CumulativeLast; uint public kLast; // reserve0 * reserve1, as of immediately after the most recent liquidity event uint private unlocked = 1; modifier lock() { require(unlocked == 1, 'UniswapV2: LOCKED'); unlocked = 0; _; unlocked = 1; } function getReserves() public view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast) { _reserve0 = reserve0; _reserve1 = reserve1; _blockTimestampLast = blockTimestampLast; } function _safeTransfer(address token, address to, uint value) private { (bool success, bytes memory data) = token.call(abi.encodeWithSelector(SELECTOR, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'UniswapV2: TRANSFER_FAILED'); } event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); constructor() public { factory = msg.sender; } // called once by the factory at time of deployment function initialize(address _token0, address _token1) external { require(msg.sender == factory, 'UniswapV2: FORBIDDEN'); // sufficient check token0 = _token0; token1 = _token1; } // update reserves and, on the first call per block, price accumulators function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private { require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'UniswapV2: OVERFLOW'); uint32 blockTimestamp = uint32(block.timestamp % 2**32); uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) { // * never overflows, and + overflow is desired price0CumulativeLast += uint(UQ112x112.encode(_reserve1).uqdiv(_reserve0)) * timeElapsed; price1CumulativeLast += uint(UQ112x112.encode(_reserve0).uqdiv(_reserve1)) * timeElapsed; } reserve0 = uint112(balance0); reserve1 = uint112(balance1); blockTimestampLast = blockTimestamp; emit Sync(reserve0, reserve1); } // if fee is on, mint liquidity equivalent to 1/6th of the growth in sqrt(k) function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) { address feeTo = IUniswapV2Factory(factory).feeTo(); feeOn = feeTo != address(0); uint _kLast = kLast; // gas savings if (feeOn) { if (_kLast != 0) { uint rootK = Math.sqrt(uint(_reserve0).mul(_reserve1)); uint rootKLast = Math.sqrt(_kLast); if (rootK > rootKLast) { uint numerator = totalSupply.mul(rootK.sub(rootKLast)); uint denominator = rootK.mul(5).add(rootKLast); uint liquidity = numerator / denominator; if (liquidity > 0) _mint(feeTo, liquidity); } } } else if (_kLast != 0) { kLast = 0; } } // this low-level function should be called from a contract which performs important safety checks function mint(address to) external lock returns (uint liquidity) { (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings uint balance0 = IERC20(token0).balanceOf(address(this)); uint balance1 = IERC20(token1).balanceOf(address(this)); uint amount0 = balance0.sub(_reserve0); uint amount1 = balance1.sub(_reserve1); bool feeOn = _mintFee(_reserve0, _reserve1); uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee if (_totalSupply == 0) { liquidity = Math.sqrt(amount0.mul(amount1)).sub(MINIMUM_LIQUIDITY); _mint(address(0), MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens } else { liquidity = Math.min(amount0.mul(_totalSupply) / _reserve0, amount1.mul(_totalSupply) / _reserve1); } require(liquidity > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED'); _mint(to, liquidity); _update(balance0, balance1, _reserve0, _reserve1); if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date emit Mint(msg.sender, amount0, amount1); } // this low-level function should be called from a contract which performs important safety checks function burn(address to) external lock returns (uint amount0, uint amount1) { (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings address _token0 = token0; // gas savings address _token1 = token1; // gas savings uint balance0 = IERC20(_token0).balanceOf(address(this)); uint balance1 = IERC20(_token1).balanceOf(address(this)); uint liquidity = balanceOf[address(this)]; bool feeOn = _mintFee(_reserve0, _reserve1); uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee amount0 = liquidity.mul(balance0) / _totalSupply; // using balances ensures pro-rata distribution amount1 = liquidity.mul(balance1) / _totalSupply; // using balances ensures pro-rata distribution require(amount0 > 0 && amount1 > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED'); _burn(address(this), liquidity); _safeTransfer(_token0, to, amount0); _safeTransfer(_token1, to, amount1); balance0 = IERC20(_token0).balanceOf(address(this)); balance1 = IERC20(_token1).balanceOf(address(this)); _update(balance0, balance1, _reserve0, _reserve1); if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date emit Burn(msg.sender, amount0, amount1, to); } // this low-level function should be called from a contract which performs important safety checks function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external lock { require(amount0Out > 0 || amount1Out > 0, 'UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT'); (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings require(amount0Out < _reserve0 && amount1Out < _reserve1, 'UniswapV2: INSUFFICIENT_LIQUIDITY'); uint balance0; uint balance1; { // scope for _token{0,1}, avoids stack too deep errors address _token0 = token0; address _token1 = token1; require(to != _token0 && to != _token1, 'UniswapV2: INVALID_TO'); if (amount0Out > 0) _safeTransfer(_token0, to, amount0Out); // optimistically transfer tokens if (amount1Out > 0) _safeTransfer(_token1, to, amount1Out); // optimistically transfer tokens if (data.length > 0) IUniswapV2Callee(to).uniswapV2Call(msg.sender, amount0Out, amount1Out, data); balance0 = IERC20(_token0).balanceOf(address(this)); balance1 = IERC20(_token1).balanceOf(address(this)); } uint amount0In = balance0 > _reserve0 - amount0Out ? balance0 - (_reserve0 - amount0Out) : 0; uint amount1In = balance1 > _reserve1 - amount1Out ? balance1 - (_reserve1 - amount1Out) : 0; require(amount0In > 0 || amount1In > 0, 'UniswapV2: INSUFFICIENT_INPUT_AMOUNT'); { // scope for reserve{0,1}Adjusted, avoids stack too deep errors uint balance0Adjusted = balance0.mul(1000).sub(amount0In.mul(3)); uint balance1Adjusted = balance1.mul(1000).sub(amount1In.mul(3)); require(balance0Adjusted.mul(balance1Adjusted) >= uint(_reserve0).mul(_reserve1).mul(1000**2), 'UniswapV2: K'); } _update(balance0, balance1, _reserve0, _reserve1); emit Swap(msg.sender, amount0In, amount1In, amount0Out, amount1Out, to); } // force balances to match reserves function skim(address to) external lock { address _token0 = token0; // gas savings address _token1 = token1; // gas savings _safeTransfer(_token0, to, IERC20(_token0).balanceOf(address(this)).sub(reserve0)); _safeTransfer(_token1, to, IERC20(_token1).balanceOf(address(this)).sub(reserve1)); } // force reserves to match balances function sync() external lock { _update(IERC20(token0).balanceOf(address(this)), IERC20(token1).balanceOf(address(this)), reserve0, reserve1); } }
1
20,290,563
59caa2d5588032d8183798d15948fe4ad62bd01edd8aac5486c8d458beaf8db0
1b414adde71dcd2b67f7e7a418c913606cd8387dad34ec8280bdc59a0b3c4e4a
9f5c2ae82df9cf37297c5d2b7b6557317527444e
ffa397285ce46fb78c588a9e993286aac68c37cd
8ef6f152c73ace0aa35d544971c93bf2bd3d5061
3d602d80600a3d3981f3363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3
pragma solidity 0.7.5; /* The MIT License (MIT) Copyright (c) 2018 Murray Software, LLC. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //solhint-disable max-line-length //solhint-disable no-inline-assembly contract CloneFactory { function createClone(address target, bytes32 salt) internal returns (address payable result) { bytes20 targetBytes = bytes20(target); assembly { // load the next free memory slot as a place to store the clone contract data let clone := mload(0x40) // The bytecode block below is responsible for contract initialization // during deployment, it is worth noting the proxied contract constructor will not be called during // the cloning procedure and that is why an initialization function needs to be called after the // clone is created mstore( clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000 ) // This stores the address location of the implementation contract // so that the proxy knows where to delegate call logic to mstore(add(clone, 0x14), targetBytes) // The bytecode block is the actual code that is deployed for each clone created. // It forwards all calls to the already deployed implementation via a delegatecall mstore( add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000 ) // deploy the contract using the CREATE2 opcode // this deploys the minimal proxy defined above, which will proxy all // calls to use the logic defined in the implementation contract `target` result := create2(0, clone, 0x37, salt) } } function isClone(address target, address query) internal view returns (bool result) { bytes20 targetBytes = bytes20(target); assembly { // load the next free memory slot as a place to store the comparison clone let clone := mload(0x40) // The next three lines store the expected bytecode for a miniml proxy // that targets `target` as its implementation contract mstore( clone, 0x363d3d373d3d3d363d7300000000000000000000000000000000000000000000 ) mstore(add(clone, 0xa), targetBytes) mstore( add(clone, 0x1e), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000 ) // the next two lines store the bytecode of the contract that we are checking in memory let other := add(clone, 0x40) extcodecopy(query, other, 0, 0x2d) // Check if the expected bytecode equals the actual bytecode and return the result result := and( eq(mload(clone), mload(other)), eq(mload(add(clone, 0xd)), mload(add(other, 0xd))) ) } } } /** * Contract that exposes the needed erc20 token functions */ abstract contract ERC20Interface { // Send _value amount of tokens to address _to function transfer(address _to, uint256 _value) public virtual returns (bool success); // Get the account balance of another account with address _owner function balanceOf(address _owner) public virtual view returns (uint256 balance); } // helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false library TransferHelper { function safeApprove( address token, address to, uint256 value ) internal { // bytes4(keccak256(bytes('approve(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::safeApprove: approve failed' ); } function safeTransfer( address token, address to, uint256 value ) internal { // bytes4(keccak256(bytes('transfer(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::safeTransfer: transfer failed' ); } function safeTransferFrom( address token, address from, address to, uint256 value ) internal { // bytes4(keccak256(bytes('transferFrom(address,address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::transferFrom: transferFrom failed' ); } function safeTransferETH(address to, uint256 value) internal { (bool success, ) = to.call{value: value}(new bytes(0)); require(success, 'TransferHelper::safeTransferETH: ETH transfer failed'); } } /** * Contract that will forward any incoming Ether to the creator of the contract * */ contract Forwarder { // Address to which any funds sent to this contract will be forwarded address public parentAddress; event ForwarderDeposited(address from, uint256 value, bytes data); /** * Initialize the contract, and sets the destination address to that of the creator */ function init(address _parentAddress) external onlyUninitialized { parentAddress = _parentAddress; uint256 value = address(this).balance; if (value == 0) { return; } (bool success, ) = parentAddress.call{ value: value }(''); require(success, 'Flush failed'); // NOTE: since we are forwarding on initialization, // we don't have the context of the original sender. // We still emit an event about the forwarding but set // the sender to the forwarder itself emit ForwarderDeposited(address(this), value, msg.data); } /** * Modifier that will execute internal code block only if the sender is the parent address */ modifier onlyParent { require(msg.sender == parentAddress, 'Only Parent'); _; } /** * Modifier that will execute internal code block only if the contract has not been initialized yet */ modifier onlyUninitialized { require(parentAddress == address(0x0), 'Already initialized'); _; } /** * Default function; Gets called when data is sent but does not match any other function */ fallback() external payable { flush(); } /** * Default function; Gets called when Ether is deposited with no data, and forwards it to the parent address */ receive() external payable { flush(); } /** * Execute a token transfer of the full balance from the forwarder token to the parent address * @param tokenContractAddress the address of the erc20 token contract */ function flushTokens(address tokenContractAddress) external onlyParent { ERC20Interface instance = ERC20Interface(tokenContractAddress); address forwarderAddress = address(this); uint256 forwarderBalance = instance.balanceOf(forwarderAddress); if (forwarderBalance == 0) { return; } TransferHelper.safeTransfer( tokenContractAddress, parentAddress, forwarderBalance ); } /** * Flush the entire balance of the contract to the parent address. */ function flush() public { uint256 value = address(this).balance; if (value == 0) { return; } (bool success, ) = parentAddress.call{ value: value }(''); require(success, 'Flush failed'); emit ForwarderDeposited(msg.sender, value, msg.data); } } contract ForwarderFactory is CloneFactory { address public implementationAddress; event ForwarderCreated(address newForwarderAddress, address parentAddress); constructor(address _implementationAddress) { implementationAddress = _implementationAddress; } function createForwarder(address parent, bytes32 salt) external { // include the signers in the salt so any contract deployed to a given address must have the same signers bytes32 finalSalt = keccak256(abi.encodePacked(parent, salt)); address payable clone = createClone(implementationAddress, finalSalt); Forwarder(clone).init(parent); emit ForwarderCreated(clone, parent); } }
1
20,290,565
3a0bc3de13b55cb22570749e265741be542b1678497d880a1501140d69a98434
c832c24b585a92b04a3ef10d60cf3ff36eaa39b10889c24d6fec60eec7fcf9cf
4a20805f146ea250cdbd51d60bcac147031d0b6c
5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f
1dde2eee8541ff7f74b2bbb0729ce5938b630880
60806040526001600c5534801561001557600080fd5b506040514690806052612d228239604080519182900360520182208282018252600a8352692ab734b9bbb0b8102b1960b11b6020938401528151808301835260018152603160f81b908401528151808401919091527fbfcc8ef98ffbf7b6c3fec7bf5185b566b9863e35a9d83acd49ad6824b5969738818301527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606082015260808101949094523060a0808601919091528151808603909101815260c09094019052825192019190912060035550600580546001600160a01b03191633179055612c1d806101056000396000f3fe608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a7146105da578063d505accf146105e2578063dd62ed3e14610640578063fff6cae91461067b576101b9565b8063ba9a7a5614610597578063bc25cf771461059f578063c45a0155146105d2576101b9565b80637ecebe00116100d35780637ecebe00146104d757806389afcb441461050a57806395d89b4114610556578063a9059cbb1461055e576101b9565b80636a6278421461046957806370a082311461049c5780637464fc3d146104cf576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610416578063485cc9551461041e5780635909c0d5146104595780635a3d549314610461576101b9565b806323b872dd146103ad57806330adf81f146103f0578063313ce567146103f8576101b9565b8063095ea7b311610197578063095ea7b3146103155780630dfe16811461036257806318160ddd14610393576101b9565b8063022c0d9f146101be57806306fdde03146102595780630902f1ac146102d6575b600080fd5b610257600480360360808110156101d457600080fd5b81359160208101359173ffffffffffffffffffffffffffffffffffffffff604083013516919081019060808101606082013564010000000081111561021857600080fd5b82018360208201111561022a57600080fd5b8035906020019184600183028401116401000000008311171561024c57600080fd5b509092509050610683565b005b610261610d57565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029b578181015183820152602001610283565b50505050905090810190601f1680156102c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102de610d90565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b61034e6004803603604081101561032b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de5565b604080519115158252519081900360200190f35b61036a610dfc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61039b610e18565b60408051918252519081900360200190f35b61034e600480360360608110156103c357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e1e565b61039b610efd565b610400610f21565b6040805160ff9092168252519081900360200190f35b61039b610f26565b6102576004803603604081101561043457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610f2c565b61039b611005565b61039b61100b565b61039b6004803603602081101561047f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611011565b61039b600480360360208110156104b257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113cb565b61039b6113dd565b61039b600480360360208110156104ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113e3565b61053d6004803603602081101561052057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113f5565b6040805192835260208301919091528051918290030190f35b610261611892565b61034e6004803603604081101561057457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356118cb565b61039b6118d8565b610257600480360360208110156105b557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166118de565b61036a611ad4565b61036a611af0565b610257600480360360e08110156105f857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b0c565b61039b6004803603604081101561065657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611dd8565b610257611df5565b600c546001146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55841515806107075750600084115b61075c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b2f6025913960400191505060405180910390fd5b600080610767610d90565b5091509150816dffffffffffffffffffffffffffff168710801561079a5750806dffffffffffffffffffffffffffff1686105b6107ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b786021913960400191505060405180910390fd5b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff91821691908116908916821480159061085457508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b6108bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a156108d0576108d0828a8d611fdb565b89156108e1576108e1818a8c611fdb565b86156109c3578873ffffffffffffffffffffffffffffffffffffffff166310d1e85c338d8d8c8c6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050505b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8416916370a08231916024808301926020929190829003018186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191955073ffffffffffffffffffffffffffffffffffffffff8316916370a0823191602480820192602092909190829003018186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d6020811015610af557600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a90038311610b1f576000610b35565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610b59576000610b6f565b89856dffffffffffffffffffffffffffff160383035b90506000821180610b805750600081115b610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b546024913960400191505060405180910390fd5b6000610c09610beb84600363ffffffff6121e816565b610bfd876103e863ffffffff6121e816565b9063ffffffff61226e16565b90506000610c21610beb84600363ffffffff6121e816565b9050610c59620f4240610c4d6dffffffffffffffffffffffffffff8b8116908b1663ffffffff6121e816565b9063ffffffff6121e816565b610c69838363ffffffff6121e816565b1015610cd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610ce4848488886122e0565b60408051838152602081018390528082018d9052606081018c9052905173ffffffffffffffffffffffffffffffffffffffff8b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a81526020017f556e69737761702056320000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610df233848461259c565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610ee85773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610eb6908363ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610ef384848461260b565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610fb257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c5460011461108457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611094610d90565b50600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905193955091935060009273ffffffffffffffffffffffffffffffffffffffff909116916370a08231916024808301926020929190829003018186803b15801561110e57600080fd5b505afa158015611122573d6000803e3d6000fd5b505050506040513d602081101561113857600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905192935060009273ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d60208110156111db57600080fd5b505190506000611201836dffffffffffffffffffffffffffff871663ffffffff61226e16565b90506000611225836dffffffffffffffffffffffffffff871663ffffffff61226e16565b9050600061123387876126ec565b600054909150806112705761125c6103e8610bfd611257878763ffffffff6121e816565b612878565b985061126b60006103e86128ca565b6112cd565b6112ca6dffffffffffffffffffffffffffff8916611294868463ffffffff6121e816565b8161129b57fe5b046dffffffffffffffffffffffffffff89166112bd868563ffffffff6121e816565b816112c457fe5b0461297a565b98505b60008911611326576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612bc16028913960400191505060405180910390fd5b6113308a8a6128ca565b61133c86868a8a6122e0565b811561137e5760085461137a906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461146957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611479610d90565b50600654600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905194965092945073ffffffffffffffffffffffffffffffffffffffff9182169391169160009184916370a08231916024808301926020929190829003018186803b1580156114fb57600080fd5b505afa15801561150f573d6000803e3d6000fd5b505050506040513d602081101561152557600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191925060009173ffffffffffffffffffffffffffffffffffffffff8516916370a08231916024808301926020929190829003018186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d60208110156115c357600080fd5b5051306000908152600160205260408120549192506115e288886126ec565b600054909150806115f9848763ffffffff6121e816565b8161160057fe5b049a5080611614848663ffffffff6121e816565b8161161b57fe5b04995060008b11801561162e575060008a115b611683576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612b996028913960400191505060405180910390fd5b61168d3084612992565b611698878d8d611fdb565b6116a3868d8c611fdb565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8916916370a08231916024808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d602081101561173957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191965073ffffffffffffffffffffffffffffffffffffffff8816916370a0823191602480820192602092909190829003018186803b1580156117ab57600080fd5b505afa1580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b505193506117e585858b8b6122e0565b811561182757600854611823906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b604080518c8152602081018c9052815173ffffffffffffffffffffffffffffffffffffffff8f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f554e492d5632000000000000000000000000000000000000000000000000000081525081565b6000610df233848461260b565b6103e881565b600c5460011461194f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654600754600854604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff9485169490931692611a2b9285928792611a26926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff61226e16565b611fdb565b600854604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611aca9284928792611a26926e01000000000000000000000000000090046dffffffffffffffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff8616916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611b7b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff80891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e2808201937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019281900390910190855afa158015611cdc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611d5757508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611dc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611dcd89898961259c565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611e6657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611fd49273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b158015611f7a57600080fd5b505afa158015611f8e573d6000803e3d6000fd5b505050506040513d6020811015611fa457600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166122e0565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e743235362900000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b602083106120e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016120a4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612143576040519150601f19603f3d011682016040523d82523d6000602084013e612148565b606091505b5091509150818015612176575080511580612176575080806020019051602081101561217357600080fd5b50515b6121e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b60008115806122035750508082028282828161220057fe5b04145b610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061230c57506dffffffffffffffffffffffffffff8311155b61237757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906123c757506dffffffffffffffffffffffffffff841615155b80156123e257506dffffffffffffffffffffffffffff831615155b15612492578063ffffffff16612425856123fb86612a57565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169063ffffffff612a7b16565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff8116612465846123fb87612a57565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054612641908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160205260408082209390935590841681522054612683908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561275757600080fd5b505afa15801561276b573d6000803e3d6000fd5b505050506040513d602081101561278157600080fd5b5051600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061286457801561285f5760006127d86112576dffffffffffffffffffffffffffff88811690881663ffffffff6121e816565b905060006127e583612878565b90508082111561285c576000612813612804848463ffffffff61226e16565b6000549063ffffffff6121e816565b905060006128388361282c86600563ffffffff6121e816565b9063ffffffff612abc16565b9050600081838161284557fe5b04905080156128585761285887826128ca565b5050505b50505b612870565b8015612870576000600b555b505092915050565b600060038211156128bb575080600160028204015b818110156128b5578091506002818285816128a457fe5b0401816128ad57fe5b04905061288d565b506128c5565b81156128c5575060015b919050565b6000546128dd908263ffffffff612abc16565b600090815573ffffffffffffffffffffffffffffffffffffffff8316815260016020526040902054612915908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000818310612989578161298b565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020546129c8908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081209190915554612a02908263ffffffff61226e16565b600090815560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff841681612ab457fe5b049392505050565b80820182811015610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158207dca18479e58487606bf70c79e44d8dee62353c9ee6d01f9a9d70885b8765f2264736f6c63430005100032454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e747261637429
608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a7146105da578063d505accf146105e2578063dd62ed3e14610640578063fff6cae91461067b576101b9565b8063ba9a7a5614610597578063bc25cf771461059f578063c45a0155146105d2576101b9565b80637ecebe00116100d35780637ecebe00146104d757806389afcb441461050a57806395d89b4114610556578063a9059cbb1461055e576101b9565b80636a6278421461046957806370a082311461049c5780637464fc3d146104cf576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610416578063485cc9551461041e5780635909c0d5146104595780635a3d549314610461576101b9565b806323b872dd146103ad57806330adf81f146103f0578063313ce567146103f8576101b9565b8063095ea7b311610197578063095ea7b3146103155780630dfe16811461036257806318160ddd14610393576101b9565b8063022c0d9f146101be57806306fdde03146102595780630902f1ac146102d6575b600080fd5b610257600480360360808110156101d457600080fd5b81359160208101359173ffffffffffffffffffffffffffffffffffffffff604083013516919081019060808101606082013564010000000081111561021857600080fd5b82018360208201111561022a57600080fd5b8035906020019184600183028401116401000000008311171561024c57600080fd5b509092509050610683565b005b610261610d57565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029b578181015183820152602001610283565b50505050905090810190601f1680156102c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102de610d90565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b61034e6004803603604081101561032b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de5565b604080519115158252519081900360200190f35b61036a610dfc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61039b610e18565b60408051918252519081900360200190f35b61034e600480360360608110156103c357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e1e565b61039b610efd565b610400610f21565b6040805160ff9092168252519081900360200190f35b61039b610f26565b6102576004803603604081101561043457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610f2c565b61039b611005565b61039b61100b565b61039b6004803603602081101561047f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611011565b61039b600480360360208110156104b257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113cb565b61039b6113dd565b61039b600480360360208110156104ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113e3565b61053d6004803603602081101561052057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113f5565b6040805192835260208301919091528051918290030190f35b610261611892565b61034e6004803603604081101561057457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356118cb565b61039b6118d8565b610257600480360360208110156105b557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166118de565b61036a611ad4565b61036a611af0565b610257600480360360e08110156105f857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b0c565b61039b6004803603604081101561065657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611dd8565b610257611df5565b600c546001146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55841515806107075750600084115b61075c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b2f6025913960400191505060405180910390fd5b600080610767610d90565b5091509150816dffffffffffffffffffffffffffff168710801561079a5750806dffffffffffffffffffffffffffff1686105b6107ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b786021913960400191505060405180910390fd5b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff91821691908116908916821480159061085457508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b6108bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a156108d0576108d0828a8d611fdb565b89156108e1576108e1818a8c611fdb565b86156109c3578873ffffffffffffffffffffffffffffffffffffffff166310d1e85c338d8d8c8c6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050505b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8416916370a08231916024808301926020929190829003018186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191955073ffffffffffffffffffffffffffffffffffffffff8316916370a0823191602480820192602092909190829003018186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d6020811015610af557600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a90038311610b1f576000610b35565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610b59576000610b6f565b89856dffffffffffffffffffffffffffff160383035b90506000821180610b805750600081115b610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b546024913960400191505060405180910390fd5b6000610c09610beb84600363ffffffff6121e816565b610bfd876103e863ffffffff6121e816565b9063ffffffff61226e16565b90506000610c21610beb84600363ffffffff6121e816565b9050610c59620f4240610c4d6dffffffffffffffffffffffffffff8b8116908b1663ffffffff6121e816565b9063ffffffff6121e816565b610c69838363ffffffff6121e816565b1015610cd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610ce4848488886122e0565b60408051838152602081018390528082018d9052606081018c9052905173ffffffffffffffffffffffffffffffffffffffff8b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a81526020017f556e69737761702056320000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610df233848461259c565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610ee85773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610eb6908363ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610ef384848461260b565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610fb257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c5460011461108457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611094610d90565b50600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905193955091935060009273ffffffffffffffffffffffffffffffffffffffff909116916370a08231916024808301926020929190829003018186803b15801561110e57600080fd5b505afa158015611122573d6000803e3d6000fd5b505050506040513d602081101561113857600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905192935060009273ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d60208110156111db57600080fd5b505190506000611201836dffffffffffffffffffffffffffff871663ffffffff61226e16565b90506000611225836dffffffffffffffffffffffffffff871663ffffffff61226e16565b9050600061123387876126ec565b600054909150806112705761125c6103e8610bfd611257878763ffffffff6121e816565b612878565b985061126b60006103e86128ca565b6112cd565b6112ca6dffffffffffffffffffffffffffff8916611294868463ffffffff6121e816565b8161129b57fe5b046dffffffffffffffffffffffffffff89166112bd868563ffffffff6121e816565b816112c457fe5b0461297a565b98505b60008911611326576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612bc16028913960400191505060405180910390fd5b6113308a8a6128ca565b61133c86868a8a6122e0565b811561137e5760085461137a906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461146957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611479610d90565b50600654600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905194965092945073ffffffffffffffffffffffffffffffffffffffff9182169391169160009184916370a08231916024808301926020929190829003018186803b1580156114fb57600080fd5b505afa15801561150f573d6000803e3d6000fd5b505050506040513d602081101561152557600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191925060009173ffffffffffffffffffffffffffffffffffffffff8516916370a08231916024808301926020929190829003018186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d60208110156115c357600080fd5b5051306000908152600160205260408120549192506115e288886126ec565b600054909150806115f9848763ffffffff6121e816565b8161160057fe5b049a5080611614848663ffffffff6121e816565b8161161b57fe5b04995060008b11801561162e575060008a115b611683576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612b996028913960400191505060405180910390fd5b61168d3084612992565b611698878d8d611fdb565b6116a3868d8c611fdb565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8916916370a08231916024808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d602081101561173957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191965073ffffffffffffffffffffffffffffffffffffffff8816916370a0823191602480820192602092909190829003018186803b1580156117ab57600080fd5b505afa1580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b505193506117e585858b8b6122e0565b811561182757600854611823906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b604080518c8152602081018c9052815173ffffffffffffffffffffffffffffffffffffffff8f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f554e492d5632000000000000000000000000000000000000000000000000000081525081565b6000610df233848461260b565b6103e881565b600c5460011461194f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654600754600854604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff9485169490931692611a2b9285928792611a26926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff61226e16565b611fdb565b600854604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611aca9284928792611a26926e01000000000000000000000000000090046dffffffffffffffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff8616916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611b7b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff80891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e2808201937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019281900390910190855afa158015611cdc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611d5757508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611dc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611dcd89898961259c565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611e6657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611fd49273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b158015611f7a57600080fd5b505afa158015611f8e573d6000803e3d6000fd5b505050506040513d6020811015611fa457600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166122e0565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e743235362900000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b602083106120e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016120a4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612143576040519150601f19603f3d011682016040523d82523d6000602084013e612148565b606091505b5091509150818015612176575080511580612176575080806020019051602081101561217357600080fd5b50515b6121e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b60008115806122035750508082028282828161220057fe5b04145b610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061230c57506dffffffffffffffffffffffffffff8311155b61237757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906123c757506dffffffffffffffffffffffffffff841615155b80156123e257506dffffffffffffffffffffffffffff831615155b15612492578063ffffffff16612425856123fb86612a57565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169063ffffffff612a7b16565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff8116612465846123fb87612a57565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054612641908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160205260408082209390935590841681522054612683908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561275757600080fd5b505afa15801561276b573d6000803e3d6000fd5b505050506040513d602081101561278157600080fd5b5051600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061286457801561285f5760006127d86112576dffffffffffffffffffffffffffff88811690881663ffffffff6121e816565b905060006127e583612878565b90508082111561285c576000612813612804848463ffffffff61226e16565b6000549063ffffffff6121e816565b905060006128388361282c86600563ffffffff6121e816565b9063ffffffff612abc16565b9050600081838161284557fe5b04905080156128585761285887826128ca565b5050505b50505b612870565b8015612870576000600b555b505092915050565b600060038211156128bb575080600160028204015b818110156128b5578091506002818285816128a457fe5b0401816128ad57fe5b04905061288d565b506128c5565b81156128c5575060015b919050565b6000546128dd908263ffffffff612abc16565b600090815573ffffffffffffffffffffffffffffffffffffffff8316815260016020526040902054612915908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000818310612989578161298b565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020546129c8908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081209190915554612a02908263ffffffff61226e16565b600090815560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff841681612ab457fe5b049392505050565b80820182811015610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158207dca18479e58487606bf70c79e44d8dee62353c9ee6d01f9a9d70885b8765f2264736f6c63430005100032
// File: contracts/interfaces/IUniswapV2Pair.sol pragma solidity >=0.5.0; interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; } // File: contracts/interfaces/IUniswapV2ERC20.sol pragma solidity >=0.5.0; interface IUniswapV2ERC20 { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; } // File: contracts/libraries/SafeMath.sol pragma solidity =0.5.16; // a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math) library SafeMath { function add(uint x, uint y) internal pure returns (uint z) { require((z = x + y) >= x, 'ds-math-add-overflow'); } function sub(uint x, uint y) internal pure returns (uint z) { require((z = x - y) <= x, 'ds-math-sub-underflow'); } function mul(uint x, uint y) internal pure returns (uint z) { require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow'); } } // File: contracts/UniswapV2ERC20.sol pragma solidity =0.5.16; contract UniswapV2ERC20 is IUniswapV2ERC20 { using SafeMath for uint; string public constant name = 'Uniswap V2'; string public constant symbol = 'UNI-V2'; uint8 public constant decimals = 18; uint public totalSupply; mapping(address => uint) public balanceOf; mapping(address => mapping(address => uint)) public allowance; bytes32 public DOMAIN_SEPARATOR; // keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9; mapping(address => uint) public nonces; event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); constructor() public { uint chainId; assembly { chainId := chainid } DOMAIN_SEPARATOR = keccak256( abi.encode( keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'), keccak256(bytes(name)), keccak256(bytes('1')), chainId, address(this) ) ); } function _mint(address to, uint value) internal { totalSupply = totalSupply.add(value); balanceOf[to] = balanceOf[to].add(value); emit Transfer(address(0), to, value); } function _burn(address from, uint value) internal { balanceOf[from] = balanceOf[from].sub(value); totalSupply = totalSupply.sub(value); emit Transfer(from, address(0), value); } function _approve(address owner, address spender, uint value) private { allowance[owner][spender] = value; emit Approval(owner, spender, value); } function _transfer(address from, address to, uint value) private { balanceOf[from] = balanceOf[from].sub(value); balanceOf[to] = balanceOf[to].add(value); emit Transfer(from, to, value); } function approve(address spender, uint value) external returns (bool) { _approve(msg.sender, spender, value); return true; } function transfer(address to, uint value) external returns (bool) { _transfer(msg.sender, to, value); return true; } function transferFrom(address from, address to, uint value) external returns (bool) { if (allowance[from][msg.sender] != uint(-1)) { allowance[from][msg.sender] = allowance[from][msg.sender].sub(value); } _transfer(from, to, value); return true; } function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external { require(deadline >= block.timestamp, 'UniswapV2: EXPIRED'); bytes32 digest = keccak256( abi.encodePacked( '\x19\x01', DOMAIN_SEPARATOR, keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline)) ) ); address recoveredAddress = ecrecover(digest, v, r, s); require(recoveredAddress != address(0) && recoveredAddress == owner, 'UniswapV2: INVALID_SIGNATURE'); _approve(owner, spender, value); } } // File: contracts/libraries/Math.sol pragma solidity =0.5.16; // a library for performing various math operations library Math { function min(uint x, uint y) internal pure returns (uint z) { z = x < y ? x : y; } // babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method) function sqrt(uint y) internal pure returns (uint z) { if (y > 3) { z = y; uint x = y / 2 + 1; while (x < z) { z = x; x = (y / x + x) / 2; } } else if (y != 0) { z = 1; } } } // File: contracts/libraries/UQ112x112.sol pragma solidity =0.5.16; // a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format)) // range: [0, 2**112 - 1] // resolution: 1 / 2**112 library UQ112x112 { uint224 constant Q112 = 2**112; // encode a uint112 as a UQ112x112 function encode(uint112 y) internal pure returns (uint224 z) { z = uint224(y) * Q112; // never overflows } // divide a UQ112x112 by a uint112, returning a UQ112x112 function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) { z = x / uint224(y); } } // File: contracts/interfaces/IERC20.sol pragma solidity >=0.5.0; interface IERC20 { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); } // File: contracts/interfaces/IUniswapV2Factory.sol pragma solidity >=0.5.0; interface IUniswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint) external view returns (address pair); function allPairsLength() external view returns (uint); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; } // File: contracts/interfaces/IUniswapV2Callee.sol pragma solidity >=0.5.0; interface IUniswapV2Callee { function uniswapV2Call(address sender, uint amount0, uint amount1, bytes calldata data) external; } // File: contracts/UniswapV2Pair.sol pragma solidity =0.5.16; contract UniswapV2Pair is IUniswapV2Pair, UniswapV2ERC20 { using SafeMath for uint; using UQ112x112 for uint224; uint public constant MINIMUM_LIQUIDITY = 10**3; bytes4 private constant SELECTOR = bytes4(keccak256(bytes('transfer(address,uint256)'))); address public factory; address public token0; address public token1; uint112 private reserve0; // uses single storage slot, accessible via getReserves uint112 private reserve1; // uses single storage slot, accessible via getReserves uint32 private blockTimestampLast; // uses single storage slot, accessible via getReserves uint public price0CumulativeLast; uint public price1CumulativeLast; uint public kLast; // reserve0 * reserve1, as of immediately after the most recent liquidity event uint private unlocked = 1; modifier lock() { require(unlocked == 1, 'UniswapV2: LOCKED'); unlocked = 0; _; unlocked = 1; } function getReserves() public view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast) { _reserve0 = reserve0; _reserve1 = reserve1; _blockTimestampLast = blockTimestampLast; } function _safeTransfer(address token, address to, uint value) private { (bool success, bytes memory data) = token.call(abi.encodeWithSelector(SELECTOR, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'UniswapV2: TRANSFER_FAILED'); } event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); constructor() public { factory = msg.sender; } // called once by the factory at time of deployment function initialize(address _token0, address _token1) external { require(msg.sender == factory, 'UniswapV2: FORBIDDEN'); // sufficient check token0 = _token0; token1 = _token1; } // update reserves and, on the first call per block, price accumulators function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private { require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'UniswapV2: OVERFLOW'); uint32 blockTimestamp = uint32(block.timestamp % 2**32); uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) { // * never overflows, and + overflow is desired price0CumulativeLast += uint(UQ112x112.encode(_reserve1).uqdiv(_reserve0)) * timeElapsed; price1CumulativeLast += uint(UQ112x112.encode(_reserve0).uqdiv(_reserve1)) * timeElapsed; } reserve0 = uint112(balance0); reserve1 = uint112(balance1); blockTimestampLast = blockTimestamp; emit Sync(reserve0, reserve1); } // if fee is on, mint liquidity equivalent to 1/6th of the growth in sqrt(k) function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) { address feeTo = IUniswapV2Factory(factory).feeTo(); feeOn = feeTo != address(0); uint _kLast = kLast; // gas savings if (feeOn) { if (_kLast != 0) { uint rootK = Math.sqrt(uint(_reserve0).mul(_reserve1)); uint rootKLast = Math.sqrt(_kLast); if (rootK > rootKLast) { uint numerator = totalSupply.mul(rootK.sub(rootKLast)); uint denominator = rootK.mul(5).add(rootKLast); uint liquidity = numerator / denominator; if (liquidity > 0) _mint(feeTo, liquidity); } } } else if (_kLast != 0) { kLast = 0; } } // this low-level function should be called from a contract which performs important safety checks function mint(address to) external lock returns (uint liquidity) { (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings uint balance0 = IERC20(token0).balanceOf(address(this)); uint balance1 = IERC20(token1).balanceOf(address(this)); uint amount0 = balance0.sub(_reserve0); uint amount1 = balance1.sub(_reserve1); bool feeOn = _mintFee(_reserve0, _reserve1); uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee if (_totalSupply == 0) { liquidity = Math.sqrt(amount0.mul(amount1)).sub(MINIMUM_LIQUIDITY); _mint(address(0), MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens } else { liquidity = Math.min(amount0.mul(_totalSupply) / _reserve0, amount1.mul(_totalSupply) / _reserve1); } require(liquidity > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED'); _mint(to, liquidity); _update(balance0, balance1, _reserve0, _reserve1); if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date emit Mint(msg.sender, amount0, amount1); } // this low-level function should be called from a contract which performs important safety checks function burn(address to) external lock returns (uint amount0, uint amount1) { (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings address _token0 = token0; // gas savings address _token1 = token1; // gas savings uint balance0 = IERC20(_token0).balanceOf(address(this)); uint balance1 = IERC20(_token1).balanceOf(address(this)); uint liquidity = balanceOf[address(this)]; bool feeOn = _mintFee(_reserve0, _reserve1); uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee amount0 = liquidity.mul(balance0) / _totalSupply; // using balances ensures pro-rata distribution amount1 = liquidity.mul(balance1) / _totalSupply; // using balances ensures pro-rata distribution require(amount0 > 0 && amount1 > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED'); _burn(address(this), liquidity); _safeTransfer(_token0, to, amount0); _safeTransfer(_token1, to, amount1); balance0 = IERC20(_token0).balanceOf(address(this)); balance1 = IERC20(_token1).balanceOf(address(this)); _update(balance0, balance1, _reserve0, _reserve1); if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date emit Burn(msg.sender, amount0, amount1, to); } // this low-level function should be called from a contract which performs important safety checks function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external lock { require(amount0Out > 0 || amount1Out > 0, 'UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT'); (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings require(amount0Out < _reserve0 && amount1Out < _reserve1, 'UniswapV2: INSUFFICIENT_LIQUIDITY'); uint balance0; uint balance1; { // scope for _token{0,1}, avoids stack too deep errors address _token0 = token0; address _token1 = token1; require(to != _token0 && to != _token1, 'UniswapV2: INVALID_TO'); if (amount0Out > 0) _safeTransfer(_token0, to, amount0Out); // optimistically transfer tokens if (amount1Out > 0) _safeTransfer(_token1, to, amount1Out); // optimistically transfer tokens if (data.length > 0) IUniswapV2Callee(to).uniswapV2Call(msg.sender, amount0Out, amount1Out, data); balance0 = IERC20(_token0).balanceOf(address(this)); balance1 = IERC20(_token1).balanceOf(address(this)); } uint amount0In = balance0 > _reserve0 - amount0Out ? balance0 - (_reserve0 - amount0Out) : 0; uint amount1In = balance1 > _reserve1 - amount1Out ? balance1 - (_reserve1 - amount1Out) : 0; require(amount0In > 0 || amount1In > 0, 'UniswapV2: INSUFFICIENT_INPUT_AMOUNT'); { // scope for reserve{0,1}Adjusted, avoids stack too deep errors uint balance0Adjusted = balance0.mul(1000).sub(amount0In.mul(3)); uint balance1Adjusted = balance1.mul(1000).sub(amount1In.mul(3)); require(balance0Adjusted.mul(balance1Adjusted) >= uint(_reserve0).mul(_reserve1).mul(1000**2), 'UniswapV2: K'); } _update(balance0, balance1, _reserve0, _reserve1); emit Swap(msg.sender, amount0In, amount1In, amount0Out, amount1Out, to); } // force balances to match reserves function skim(address to) external lock { address _token0 = token0; // gas savings address _token1 = token1; // gas savings _safeTransfer(_token0, to, IERC20(_token0).balanceOf(address(this)).sub(reserve0)); _safeTransfer(_token1, to, IERC20(_token1).balanceOf(address(this)).sub(reserve1)); } // force reserves to match balances function sync() external lock { _update(IERC20(token0).balanceOf(address(this)), IERC20(token1).balanceOf(address(this)), reserve0, reserve1); } }
1
20,290,565
3a0bc3de13b55cb22570749e265741be542b1678497d880a1501140d69a98434
a0088fa9deed086b4d1826f5b53e01eff279800b3f04e9537847b880469b7ab7
ccae4d586c74224fdc10291b39079c9d8316344e
a6b71e26c5e0845f74c812102ca7114b6a896ab2
f6c9fedecee9bd620439c4636d0e9f036d7e5720
608060405234801561001057600080fd5b506040516101e63803806101e68339818101604052602081101561003357600080fd5b8101908080519060200190929190505050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156100ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806101c46022913960400191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505060ab806101196000396000f3fe608060405273ffffffffffffffffffffffffffffffffffffffff600054167fa619486e0000000000000000000000000000000000000000000000000000000060003514156050578060005260206000f35b3660008037600080366000845af43d6000803e60008114156070573d6000fd5b3d6000f3fea2646970667358221220d1429297349653a4918076d650332de1a1068c5f3e07c5c82360c277770b955264736f6c63430007060033496e76616c69642073696e676c65746f6e20616464726573732070726f7669646564000000000000000000000000d9db270c1b5e3bd161e8c8503c55ceabee709552
608060405273ffffffffffffffffffffffffffffffffffffffff600054167fa619486e0000000000000000000000000000000000000000000000000000000060003514156050578060005260206000f35b3660008037600080366000845af43d6000803e60008114156070573d6000fd5b3d6000f3fea2646970667358221220d1429297349653a4918076d650332de1a1068c5f3e07c5c82360c277770b955264736f6c63430007060033
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.7.0 <0.9.0; /// @title IProxy - Helper interface to access masterCopy of the Proxy on-chain /// @author Richard Meissner - <[email protected]> interface IProxy { function masterCopy() external view returns (address); } /// @title GnosisSafeProxy - Generic proxy contract allows to execute all transactions applying the code of a master contract. /// @author Stefan George - <[email protected]> /// @author Richard Meissner - <[email protected]> contract GnosisSafeProxy { // singleton always needs to be first declared variable, to ensure that it is at the same location in the contracts to which calls are delegated. // To reduce deployment costs this variable is internal and needs to be retrieved via `getStorageAt` address internal singleton; /// @dev Constructor function sets address of singleton contract. /// @param _singleton Singleton address. constructor(address _singleton) { require(_singleton != address(0), "Invalid singleton address provided"); singleton = _singleton; } /// @dev Fallback function forwards all transactions and returns all received return data. fallback() external payable { // solhint-disable-next-line no-inline-assembly assembly { let _singleton := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff) // 0xa619486e == keccak("masterCopy()"). The value is right padded to 32-bytes with 0s if eq(calldataload(0), 0xa619486e00000000000000000000000000000000000000000000000000000000) { mstore(0, _singleton) return(0, 0x20) } calldatacopy(0, 0, calldatasize()) let success := delegatecall(gas(), _singleton, 0, calldatasize(), 0, 0) returndatacopy(0, 0, returndatasize()) if eq(success, 0) { revert(0, returndatasize()) } return(0, returndatasize()) } } } /// @title Proxy Factory - Allows to create new proxy contact and execute a message call to the new proxy within one transaction. /// @author Stefan George - <[email protected]> contract GnosisSafeProxyFactory { event ProxyCreation(GnosisSafeProxy proxy, address singleton); /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction. /// @param singleton Address of singleton contract. /// @param data Payload for message call sent to new proxy contract. function createProxy(address singleton, bytes memory data) public returns (GnosisSafeProxy proxy) { proxy = new GnosisSafeProxy(singleton); if (data.length > 0) // solhint-disable-next-line no-inline-assembly assembly { if eq(call(gas(), proxy, 0, add(data, 0x20), mload(data), 0, 0), 0) { revert(0, 0) } } emit ProxyCreation(proxy, singleton); } /// @dev Allows to retrieve the runtime code of a deployed Proxy. This can be used to check that the expected Proxy was deployed. function proxyRuntimeCode() public pure returns (bytes memory) { return type(GnosisSafeProxy).runtimeCode; } /// @dev Allows to retrieve the creation code used for the Proxy deployment. With this it is easily possible to calculate predicted address. function proxyCreationCode() public pure returns (bytes memory) { return type(GnosisSafeProxy).creationCode; } /// @dev Allows to create new proxy contact using CREATE2 but it doesn't run the initializer. /// This method is only meant as an utility to be called from other methods /// @param _singleton Address of singleton contract. /// @param initializer Payload for message call sent to new proxy contract. /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. function deployProxyWithNonce( address _singleton, bytes memory initializer, uint256 saltNonce ) internal returns (GnosisSafeProxy proxy) { // If the initializer changes the proxy address should change too. Hashing the initializer data is cheaper than just concatinating it bytes32 salt = keccak256(abi.encodePacked(keccak256(initializer), saltNonce)); bytes memory deploymentData = abi.encodePacked(type(GnosisSafeProxy).creationCode, uint256(uint160(_singleton))); // solhint-disable-next-line no-inline-assembly assembly { proxy := create2(0x0, add(0x20, deploymentData), mload(deploymentData), salt) } require(address(proxy) != address(0), "Create2 call failed"); } /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction. /// @param _singleton Address of singleton contract. /// @param initializer Payload for message call sent to new proxy contract. /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. function createProxyWithNonce( address _singleton, bytes memory initializer, uint256 saltNonce ) public returns (GnosisSafeProxy proxy) { proxy = deployProxyWithNonce(_singleton, initializer, saltNonce); if (initializer.length > 0) // solhint-disable-next-line no-inline-assembly assembly { if eq(call(gas(), proxy, 0, add(initializer, 0x20), mload(initializer), 0, 0), 0) { revert(0, 0) } } emit ProxyCreation(proxy, _singleton); } /// @dev Allows to create new proxy contact, execute a message call to the new proxy and call a specified callback within one transaction /// @param _singleton Address of singleton contract. /// @param initializer Payload for message call sent to new proxy contract. /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. /// @param callback Callback that will be invoced after the new proxy contract has been successfully deployed and initialized. function createProxyWithCallback( address _singleton, bytes memory initializer, uint256 saltNonce, IProxyCreationCallback callback ) public returns (GnosisSafeProxy proxy) { uint256 saltNonceWithCallback = uint256(keccak256(abi.encodePacked(saltNonce, callback))); proxy = createProxyWithNonce(_singleton, initializer, saltNonceWithCallback); if (address(callback) != address(0)) callback.proxyCreated(proxy, _singleton, initializer, saltNonce); } /// @dev Allows to get the address for a new proxy contact created via `createProxyWithNonce` /// This method is only meant for address calculation purpose when you use an initializer that would revert, /// therefore the response is returned with a revert. When calling this method set `from` to the address of the proxy factory. /// @param _singleton Address of singleton contract. /// @param initializer Payload for message call sent to new proxy contract. /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. function calculateCreateProxyWithNonceAddress( address _singleton, bytes calldata initializer, uint256 saltNonce ) external returns (GnosisSafeProxy proxy) { proxy = deployProxyWithNonce(_singleton, initializer, saltNonce); revert(string(abi.encodePacked(proxy))); } } interface IProxyCreationCallback { function proxyCreated( GnosisSafeProxy proxy, address _singleton, bytes calldata initializer, uint256 saltNonce ) external; }
1
20,290,566
2196144cab702fce8771fe271553b11c2947d8fb792a94e166fc7b08aadfd576
9504e19d1934f12f00871046a7e6d7e4e323bbbb3eaea881ffe4adc2b23b216e
3aeb5831f91d29b3992d659821a7fed7b805a107
ffa397285ce46fb78c588a9e993286aac68c37cd
2ab4afa38b7c28102ea1482e23831dabc26dadec
3d602d80600a3d3981f3363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3
pragma solidity 0.7.5; /* The MIT License (MIT) Copyright (c) 2018 Murray Software, LLC. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //solhint-disable max-line-length //solhint-disable no-inline-assembly contract CloneFactory { function createClone(address target, bytes32 salt) internal returns (address payable result) { bytes20 targetBytes = bytes20(target); assembly { // load the next free memory slot as a place to store the clone contract data let clone := mload(0x40) // The bytecode block below is responsible for contract initialization // during deployment, it is worth noting the proxied contract constructor will not be called during // the cloning procedure and that is why an initialization function needs to be called after the // clone is created mstore( clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000 ) // This stores the address location of the implementation contract // so that the proxy knows where to delegate call logic to mstore(add(clone, 0x14), targetBytes) // The bytecode block is the actual code that is deployed for each clone created. // It forwards all calls to the already deployed implementation via a delegatecall mstore( add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000 ) // deploy the contract using the CREATE2 opcode // this deploys the minimal proxy defined above, which will proxy all // calls to use the logic defined in the implementation contract `target` result := create2(0, clone, 0x37, salt) } } function isClone(address target, address query) internal view returns (bool result) { bytes20 targetBytes = bytes20(target); assembly { // load the next free memory slot as a place to store the comparison clone let clone := mload(0x40) // The next three lines store the expected bytecode for a miniml proxy // that targets `target` as its implementation contract mstore( clone, 0x363d3d373d3d3d363d7300000000000000000000000000000000000000000000 ) mstore(add(clone, 0xa), targetBytes) mstore( add(clone, 0x1e), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000 ) // the next two lines store the bytecode of the contract that we are checking in memory let other := add(clone, 0x40) extcodecopy(query, other, 0, 0x2d) // Check if the expected bytecode equals the actual bytecode and return the result result := and( eq(mload(clone), mload(other)), eq(mload(add(clone, 0xd)), mload(add(other, 0xd))) ) } } } /** * Contract that exposes the needed erc20 token functions */ abstract contract ERC20Interface { // Send _value amount of tokens to address _to function transfer(address _to, uint256 _value) public virtual returns (bool success); // Get the account balance of another account with address _owner function balanceOf(address _owner) public virtual view returns (uint256 balance); } // helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false library TransferHelper { function safeApprove( address token, address to, uint256 value ) internal { // bytes4(keccak256(bytes('approve(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::safeApprove: approve failed' ); } function safeTransfer( address token, address to, uint256 value ) internal { // bytes4(keccak256(bytes('transfer(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::safeTransfer: transfer failed' ); } function safeTransferFrom( address token, address from, address to, uint256 value ) internal { // bytes4(keccak256(bytes('transferFrom(address,address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::transferFrom: transferFrom failed' ); } function safeTransferETH(address to, uint256 value) internal { (bool success, ) = to.call{value: value}(new bytes(0)); require(success, 'TransferHelper::safeTransferETH: ETH transfer failed'); } } /** * Contract that will forward any incoming Ether to the creator of the contract * */ contract Forwarder { // Address to which any funds sent to this contract will be forwarded address public parentAddress; event ForwarderDeposited(address from, uint256 value, bytes data); /** * Initialize the contract, and sets the destination address to that of the creator */ function init(address _parentAddress) external onlyUninitialized { parentAddress = _parentAddress; uint256 value = address(this).balance; if (value == 0) { return; } (bool success, ) = parentAddress.call{ value: value }(''); require(success, 'Flush failed'); // NOTE: since we are forwarding on initialization, // we don't have the context of the original sender. // We still emit an event about the forwarding but set // the sender to the forwarder itself emit ForwarderDeposited(address(this), value, msg.data); } /** * Modifier that will execute internal code block only if the sender is the parent address */ modifier onlyParent { require(msg.sender == parentAddress, 'Only Parent'); _; } /** * Modifier that will execute internal code block only if the contract has not been initialized yet */ modifier onlyUninitialized { require(parentAddress == address(0x0), 'Already initialized'); _; } /** * Default function; Gets called when data is sent but does not match any other function */ fallback() external payable { flush(); } /** * Default function; Gets called when Ether is deposited with no data, and forwards it to the parent address */ receive() external payable { flush(); } /** * Execute a token transfer of the full balance from the forwarder token to the parent address * @param tokenContractAddress the address of the erc20 token contract */ function flushTokens(address tokenContractAddress) external onlyParent { ERC20Interface instance = ERC20Interface(tokenContractAddress); address forwarderAddress = address(this); uint256 forwarderBalance = instance.balanceOf(forwarderAddress); if (forwarderBalance == 0) { return; } TransferHelper.safeTransfer( tokenContractAddress, parentAddress, forwarderBalance ); } /** * Flush the entire balance of the contract to the parent address. */ function flush() public { uint256 value = address(this).balance; if (value == 0) { return; } (bool success, ) = parentAddress.call{ value: value }(''); require(success, 'Flush failed'); emit ForwarderDeposited(msg.sender, value, msg.data); } } contract ForwarderFactory is CloneFactory { address public implementationAddress; event ForwarderCreated(address newForwarderAddress, address parentAddress); constructor(address _implementationAddress) { implementationAddress = _implementationAddress; } function createForwarder(address parent, bytes32 salt) external { // include the signers in the salt so any contract deployed to a given address must have the same signers bytes32 finalSalt = keccak256(abi.encodePacked(parent, salt)); address payable clone = createClone(implementationAddress, finalSalt); Forwarder(clone).init(parent); emit ForwarderCreated(clone, parent); } }
1
20,290,567
13666267e93a8723fac72a9ac77217f19312faf7e3ca6dca8559daab6f4139cc
3ceb83239d95bd90e009d10ff6011a8bb09af6156c651bb751966c8f20dffb8e
c182f073c0c10b4f6c89a1b778a8a6f65ce63d65
c182f073c0c10b4f6c89a1b778a8a6f65ce63d65
6b37cb1b0239e2f3d4866d9e2851cfdddf16efad
608060405234801562000010575f80fd5b50604051620021f9380380620021f9833981810160405281019062000036919062000285565b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603620000a7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200009e906200033c565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160362000118576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200010f90620003aa565b60405180910390fd5b8160035f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550805f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055503360015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508260025f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050620003ca565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6200024f8262000224565b9050919050565b620002618162000243565b81146200026c575f80fd5b50565b5f815190506200027f8162000256565b92915050565b5f805f606084860312156200029f576200029e62000220565b5b5f620002ae868287016200026f565b9350506020620002c1868287016200026f565b9250506040620002d4868287016200026f565b9150509250925092565b5f82825260208201905092915050565b7f6d7573742073657420746f6b656e2061646472657373000000000000000000005f82015250565b5f62000324601683620002de565b91506200033182620002ee565b602082019050919050565b5f6020820190508181035f830152620003558162000316565b9050919050565b7f6d75737420736574206f7261636c6520616464726573730000000000000000005f82015250565b5f62000392601783620002de565b91506200039f826200035c565b602082019050919050565b5f6020820190508181035f830152620003c38162000384565b9050919050565b611e2180620003d85f395ff3fe608060405234801561000f575f80fd5b50600436106100cd575f3560e01c8063b07f84961161008a578063cdc1842411610064578063cdc18424146101bf578063ed516cc0146101dd578063f2fde38b146101f9578063fc0c546a14610215576100cd565b8063b07f84961461017d578063bed9d86114610199578063cb82cc8f146101a3576100cd565b806349a79036146100d157806376ee4c0f146100ed5780637dc0d1d0146101095780638929f4c6146101275780638da5cb5b146101435780639e281a9814610161575b5f80fd5b6100eb60048036038101906100e691906112dc565b610233565b005b610107600480360381019061010291906113ce565b610372565b005b610111610696565b60405161011e91906114e0565b60405180910390f35b610141600480360381019061013c91906114f9565b6106b9565b005b61014b6107d0565b6040516101589190611533565b60405180910390f35b61017b6004803603810190610176919061154c565b6107f5565b005b610197600480360381019061019291906113ce565b610a3e565b005b6101a1610ce6565b005b6101bd60048036038101906101b891906114f9565b610df1565b005b6101c7610fb0565b6040516101d49190611533565b60405180910390f35b6101f760048036038101906101f291906112dc565b610fd5565b005b610213600480360381019061020e91906112dc565b611115565b005b61021d611255565b60405161022a91906115aa565b60405180910390f35b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146102c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102b99061161d565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610330576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161032790611685565b60405180910390fd5b805f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610401576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103f8906116ed565b60405180910390fd5b5f61012c5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166396426d976040518163ffffffff1660e01b8152600401602060405180830381865afa15801561046d573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610491919061171f565b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636fd4f2296040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104f9573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061051d919061171f565b426105289190611777565b61053291906117aa565b61053c9190611818565b905081811015610581576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161057890611892565b60405180910390fd5b60035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b67f8cbd6040518163ffffffff1660e01b81526004015f604051808303815f87803b1580156105e7575f80fd5b505af11580156105f9573d5f803e3d5ffd5b505050505f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635eaa9ced8989898989896040518763ffffffff1660e01b815260040161065f96959493929190611928565b5f604051808303815f87803b158015610676575f80fd5b505af1158015610688573d5f803e3d5ffd5b505050505050505050505050565b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610748576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161073f906119c7565b60405180910390fd5b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638929f4c6826040518263ffffffff1660e01b81526004016107a091906119e5565b5f604051808303815f87803b1580156107b7575f80fd5b505af11580156107c9573d5f803e3d5ffd5b5050505050565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60025f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610884576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161087b90611a6e565b60405180910390fd5b8060035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016108df9190611533565b602060405180830381865afa1580156108fa573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061091e919061171f565b101561095f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161095690611ad6565b60405180910390fd5b60035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b81526004016109bb929190611af4565b6020604051808303815f875af11580156109d7573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109fb9190611b50565b610a3a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3190611bc5565b60405180910390fd5b5050565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610acd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ac4906116ed565b60405180910390fd5b5f61012c5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166396426d976040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b39573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b5d919061171f565b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636fd4f2296040518163ffffffff1660e01b8152600401602060405180830381865afa158015610bc5573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610be9919061171f565b42610bf49190611777565b610bfe91906117aa565b610c089190611818565b905081811015610c4d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c4490611892565b60405180910390fd5b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635eaa9ced8989898989896040518763ffffffff1660e01b8152600401610caf96959493929190611928565b5f604051808303815f87803b158015610cc6575f80fd5b505af1158015610cd8573d5f803e3d5ffd5b505050505050505050505050565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610d75576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d6c90611c2d565b60405180910390fd5b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bed9d8616040518163ffffffff1660e01b81526004015f604051808303815f87803b158015610dd9575f80fd5b505af1158015610deb573d5f803e3d5ffd5b50505050565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7790611c95565b60405180910390fd5b60035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b35f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff1660e01b8152600401610efb929190611af4565b5f604051808303815f87803b158015610f12575f80fd5b505af1158015610f24573d5f803e3d5ffd5b505050505f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663cb82cc8f826040518263ffffffff1660e01b8152600401610f8091906119e5565b5f604051808303815f87803b158015610f97575f80fd5b505af1158015610fa9573d5f803e3d5ffd5b5050505050565b60025f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611064576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161105b9061161d565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036110d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110c990611cfd565b60405180910390fd5b8060035f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60025f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146111a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119b90611d65565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611212576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161120990611dcd565b60405180910390fd5b8060015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f80fd5b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6112ab82611282565b9050919050565b6112bb816112a1565b81146112c5575f80fd5b50565b5f813590506112d6816112b2565b92915050565b5f602082840312156112f1576112f061127a565b5b5f6112fe848285016112c8565b91505092915050565b5f819050919050565b61131981611307565b8114611323575f80fd5b50565b5f8135905061133481611310565b92915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f84011261135b5761135a61133a565b5b8235905067ffffffffffffffff8111156113785761137761133e565b5b60208301915083600182028301111561139457611393611342565b5b9250929050565b5f819050919050565b6113ad8161139b565b81146113b7575f80fd5b50565b5f813590506113c8816113a4565b92915050565b5f805f805f805f60a0888a0312156113e9576113e861127a565b5b5f6113f68a828b01611326565b975050602088013567ffffffffffffffff8111156114175761141661127e565b5b6114238a828b01611346565b965096505060406114368a828b016113ba565b945050606088013567ffffffffffffffff8111156114575761145661127e565b5b6114638a828b01611346565b935093505060806114768a828b016113ba565b91505092959891949750929550565b5f819050919050565b5f6114a86114a361149e84611282565b611485565b611282565b9050919050565b5f6114b98261148e565b9050919050565b5f6114ca826114af565b9050919050565b6114da816114c0565b82525050565b5f6020820190506114f35f8301846114d1565b92915050565b5f6020828403121561150e5761150d61127a565b5b5f61151b848285016113ba565b91505092915050565b61152d816112a1565b82525050565b5f6020820190506115465f830184611524565b92915050565b5f80604083850312156115625761156161127a565b5b5f61156f858286016112c8565b9250506020611580858286016113ba565b9150509250929050565b5f611594826114af565b9050919050565b6115a48161158a565b82525050565b5f6020820190506115bd5f83018461159b565b92915050565b5f82825260208201905092915050565b7f6f6e6c79206f776e65722063616e2072657365742061646472657373000000005f82015250565b5f611607601c836115c3565b9150611612826115d3565b602082019050919050565b5f6020820190508181035f830152611634816115fb565b9050919050565b7f6d75737420736574206f7261636c6520616464726573730000000000000000005f82015250565b5f61166f6017836115c3565b915061167a8261163b565b602082019050919050565b5f6020820190508181035f83015261169c81611663565b9050919050565b7f6f6e6c79206f776e65722063616e207375626d69742076616c756500000000005f82015250565b5f6116d7601b836115c3565b91506116e2826116a3565b602082019050919050565b5f6020820190508181035f830152611704816116cb565b9050919050565b5f81519050611719816113a4565b92915050565b5f602082840312156117345761173361127a565b5b5f6117418482850161170b565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6117818261139b565b915061178c8361139b565b92508282039050818111156117a4576117a361174a565b5b92915050565b5f6117b48261139b565b91506117bf8361139b565b92508282026117cd8161139b565b915082820484148315176117e4576117e361174a565b5b5092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f6118228261139b565b915061182d8361139b565b92508261183d5761183c6117eb565b5b828204905092915050565b7f6e6f7420656e6f75676820726577617264206f722062616c616e6365000000005f82015250565b5f61187c601c836115c3565b915061188782611848565b602082019050919050565b5f6020820190508181035f8301526118a981611870565b9050919050565b6118b981611307565b82525050565b5f82825260208201905092915050565b828183375f83830152505050565b5f601f19601f8301169050919050565b5f6118f883856118bf565b93506119058385846118cf565b61190e836118dd565b840190509392505050565b6119228161139b565b82525050565b5f60808201905061193b5f8301896118b0565b818103602083015261194e8187896118ed565b905061195d6040830186611919565b81810360608301526119708184866118ed565b9050979650505050505050565b7f6f6e6c79206f776e65722063616e2072657175657374207769746864726177005f82015250565b5f6119b1601f836115c3565b91506119bc8261197d565b602082019050919050565b5f6020820190508181035f8301526119de816119a5565b9050919050565b5f6020820190506119f85f830184611919565b92915050565b7f6f6e6c7920776974686472617765722063616e20776974686472617720746f6b5f8201527f656e000000000000000000000000000000000000000000000000000000000000602082015250565b5f611a586022836115c3565b9150611a63826119fe565b604082019050919050565b5f6020820190508181035f830152611a8581611a4c565b9050919050565b7f496e73756666696369656e742062616c616e63650000000000000000000000005f82015250565b5f611ac06014836115c3565b9150611acb82611a8c565b602082019050919050565b5f6020820190508181035f830152611aed81611ab4565b9050919050565b5f604082019050611b075f830185611524565b611b146020830184611919565b9392505050565b5f8115159050919050565b611b2f81611b1b565b8114611b39575f80fd5b50565b5f81519050611b4a81611b26565b92915050565b5f60208284031215611b6557611b6461127a565b5b5f611b7284828501611b3c565b91505092915050565b7f5472616e73666572206661696c656400000000000000000000000000000000005f82015250565b5f611baf600f836115c3565b9150611bba82611b7b565b602082019050919050565b5f6020820190508181035f830152611bdc81611ba3565b9050919050565b7f6f6e6c79206f776e65722063616e207769746864726177207374616b650000005f82015250565b5f611c17601d836115c3565b9150611c2282611be3565b602082019050919050565b5f6020820190508181035f830152611c4481611c0b565b9050919050565b7f6f6e6c79206f776e65722063616e206465706f736974000000000000000000005f82015250565b5f611c7f6016836115c3565b9150611c8a82611c4b565b602082019050919050565b5f6020820190508181035f830152611cac81611c73565b9050919050565b7f6d7573742073657420746f6b656e2061646472657373000000000000000000005f82015250565b5f611ce76016836115c3565b9150611cf282611cb3565b602082019050919050565b5f6020820190508181035f830152611d1481611cdb565b9050919050565b7f6f6e6c79206f776e65722063616e207265736574206f776e65727368697000005f82015250565b5f611d4f601e836115c3565b9150611d5a82611d1b565b602082019050919050565b5f6020820190508181035f830152611d7c81611d43565b9050919050565b7f496e76616c6964206164647265737300000000000000000000000000000000005f82015250565b5f611db7600f836115c3565b9150611dc282611d83565b602082019050919050565b5f6020820190508181035f830152611de481611dab565b905091905056fea2646970667358221220d42998d21b24b178ae7afb9d2e1c0e95425fd0be5b07a1a586d07ab3bc83403064736f6c63430008180033000000000000000000000000024326bf8d2db920fa20e56a89bc102aecced4ec00000000000000000000000088df592f8eb5d7bd38bfef7deb0fbc02cf3778a00000000000000000000000008cfc184c877154a8f9ffe0fe75649dbe5e2dbebf
608060405234801561000f575f80fd5b50600436106100cd575f3560e01c8063b07f84961161008a578063cdc1842411610064578063cdc18424146101bf578063ed516cc0146101dd578063f2fde38b146101f9578063fc0c546a14610215576100cd565b8063b07f84961461017d578063bed9d86114610199578063cb82cc8f146101a3576100cd565b806349a79036146100d157806376ee4c0f146100ed5780637dc0d1d0146101095780638929f4c6146101275780638da5cb5b146101435780639e281a9814610161575b5f80fd5b6100eb60048036038101906100e691906112dc565b610233565b005b610107600480360381019061010291906113ce565b610372565b005b610111610696565b60405161011e91906114e0565b60405180910390f35b610141600480360381019061013c91906114f9565b6106b9565b005b61014b6107d0565b6040516101589190611533565b60405180910390f35b61017b6004803603810190610176919061154c565b6107f5565b005b610197600480360381019061019291906113ce565b610a3e565b005b6101a1610ce6565b005b6101bd60048036038101906101b891906114f9565b610df1565b005b6101c7610fb0565b6040516101d49190611533565b60405180910390f35b6101f760048036038101906101f291906112dc565b610fd5565b005b610213600480360381019061020e91906112dc565b611115565b005b61021d611255565b60405161022a91906115aa565b60405180910390f35b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146102c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102b99061161d565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610330576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161032790611685565b60405180910390fd5b805f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610401576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103f8906116ed565b60405180910390fd5b5f61012c5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166396426d976040518163ffffffff1660e01b8152600401602060405180830381865afa15801561046d573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610491919061171f565b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636fd4f2296040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104f9573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061051d919061171f565b426105289190611777565b61053291906117aa565b61053c9190611818565b905081811015610581576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161057890611892565b60405180910390fd5b60035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b67f8cbd6040518163ffffffff1660e01b81526004015f604051808303815f87803b1580156105e7575f80fd5b505af11580156105f9573d5f803e3d5ffd5b505050505f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635eaa9ced8989898989896040518763ffffffff1660e01b815260040161065f96959493929190611928565b5f604051808303815f87803b158015610676575f80fd5b505af1158015610688573d5f803e3d5ffd5b505050505050505050505050565b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610748576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161073f906119c7565b60405180910390fd5b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638929f4c6826040518263ffffffff1660e01b81526004016107a091906119e5565b5f604051808303815f87803b1580156107b7575f80fd5b505af11580156107c9573d5f803e3d5ffd5b5050505050565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60025f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610884576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161087b90611a6e565b60405180910390fd5b8060035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016108df9190611533565b602060405180830381865afa1580156108fa573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061091e919061171f565b101561095f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161095690611ad6565b60405180910390fd5b60035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b81526004016109bb929190611af4565b6020604051808303815f875af11580156109d7573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109fb9190611b50565b610a3a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3190611bc5565b60405180910390fd5b5050565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610acd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ac4906116ed565b60405180910390fd5b5f61012c5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166396426d976040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b39573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b5d919061171f565b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636fd4f2296040518163ffffffff1660e01b8152600401602060405180830381865afa158015610bc5573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610be9919061171f565b42610bf49190611777565b610bfe91906117aa565b610c089190611818565b905081811015610c4d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c4490611892565b60405180910390fd5b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635eaa9ced8989898989896040518763ffffffff1660e01b8152600401610caf96959493929190611928565b5f604051808303815f87803b158015610cc6575f80fd5b505af1158015610cd8573d5f803e3d5ffd5b505050505050505050505050565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610d75576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d6c90611c2d565b60405180910390fd5b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bed9d8616040518163ffffffff1660e01b81526004015f604051808303815f87803b158015610dd9575f80fd5b505af1158015610deb573d5f803e3d5ffd5b50505050565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7790611c95565b60405180910390fd5b60035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b35f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff1660e01b8152600401610efb929190611af4565b5f604051808303815f87803b158015610f12575f80fd5b505af1158015610f24573d5f803e3d5ffd5b505050505f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663cb82cc8f826040518263ffffffff1660e01b8152600401610f8091906119e5565b5f604051808303815f87803b158015610f97575f80fd5b505af1158015610fa9573d5f803e3d5ffd5b5050505050565b60025f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611064576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161105b9061161d565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036110d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110c990611cfd565b60405180910390fd5b8060035f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60025f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146111a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119b90611d65565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611212576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161120990611dcd565b60405180910390fd5b8060015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f80fd5b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6112ab82611282565b9050919050565b6112bb816112a1565b81146112c5575f80fd5b50565b5f813590506112d6816112b2565b92915050565b5f602082840312156112f1576112f061127a565b5b5f6112fe848285016112c8565b91505092915050565b5f819050919050565b61131981611307565b8114611323575f80fd5b50565b5f8135905061133481611310565b92915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f84011261135b5761135a61133a565b5b8235905067ffffffffffffffff8111156113785761137761133e565b5b60208301915083600182028301111561139457611393611342565b5b9250929050565b5f819050919050565b6113ad8161139b565b81146113b7575f80fd5b50565b5f813590506113c8816113a4565b92915050565b5f805f805f805f60a0888a0312156113e9576113e861127a565b5b5f6113f68a828b01611326565b975050602088013567ffffffffffffffff8111156114175761141661127e565b5b6114238a828b01611346565b965096505060406114368a828b016113ba565b945050606088013567ffffffffffffffff8111156114575761145661127e565b5b6114638a828b01611346565b935093505060806114768a828b016113ba565b91505092959891949750929550565b5f819050919050565b5f6114a86114a361149e84611282565b611485565b611282565b9050919050565b5f6114b98261148e565b9050919050565b5f6114ca826114af565b9050919050565b6114da816114c0565b82525050565b5f6020820190506114f35f8301846114d1565b92915050565b5f6020828403121561150e5761150d61127a565b5b5f61151b848285016113ba565b91505092915050565b61152d816112a1565b82525050565b5f6020820190506115465f830184611524565b92915050565b5f80604083850312156115625761156161127a565b5b5f61156f858286016112c8565b9250506020611580858286016113ba565b9150509250929050565b5f611594826114af565b9050919050565b6115a48161158a565b82525050565b5f6020820190506115bd5f83018461159b565b92915050565b5f82825260208201905092915050565b7f6f6e6c79206f776e65722063616e2072657365742061646472657373000000005f82015250565b5f611607601c836115c3565b9150611612826115d3565b602082019050919050565b5f6020820190508181035f830152611634816115fb565b9050919050565b7f6d75737420736574206f7261636c6520616464726573730000000000000000005f82015250565b5f61166f6017836115c3565b915061167a8261163b565b602082019050919050565b5f6020820190508181035f83015261169c81611663565b9050919050565b7f6f6e6c79206f776e65722063616e207375626d69742076616c756500000000005f82015250565b5f6116d7601b836115c3565b91506116e2826116a3565b602082019050919050565b5f6020820190508181035f830152611704816116cb565b9050919050565b5f81519050611719816113a4565b92915050565b5f602082840312156117345761173361127a565b5b5f6117418482850161170b565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6117818261139b565b915061178c8361139b565b92508282039050818111156117a4576117a361174a565b5b92915050565b5f6117b48261139b565b91506117bf8361139b565b92508282026117cd8161139b565b915082820484148315176117e4576117e361174a565b5b5092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f6118228261139b565b915061182d8361139b565b92508261183d5761183c6117eb565b5b828204905092915050565b7f6e6f7420656e6f75676820726577617264206f722062616c616e6365000000005f82015250565b5f61187c601c836115c3565b915061188782611848565b602082019050919050565b5f6020820190508181035f8301526118a981611870565b9050919050565b6118b981611307565b82525050565b5f82825260208201905092915050565b828183375f83830152505050565b5f601f19601f8301169050919050565b5f6118f883856118bf565b93506119058385846118cf565b61190e836118dd565b840190509392505050565b6119228161139b565b82525050565b5f60808201905061193b5f8301896118b0565b818103602083015261194e8187896118ed565b905061195d6040830186611919565b81810360608301526119708184866118ed565b9050979650505050505050565b7f6f6e6c79206f776e65722063616e2072657175657374207769746864726177005f82015250565b5f6119b1601f836115c3565b91506119bc8261197d565b602082019050919050565b5f6020820190508181035f8301526119de816119a5565b9050919050565b5f6020820190506119f85f830184611919565b92915050565b7f6f6e6c7920776974686472617765722063616e20776974686472617720746f6b5f8201527f656e000000000000000000000000000000000000000000000000000000000000602082015250565b5f611a586022836115c3565b9150611a63826119fe565b604082019050919050565b5f6020820190508181035f830152611a8581611a4c565b9050919050565b7f496e73756666696369656e742062616c616e63650000000000000000000000005f82015250565b5f611ac06014836115c3565b9150611acb82611a8c565b602082019050919050565b5f6020820190508181035f830152611aed81611ab4565b9050919050565b5f604082019050611b075f830185611524565b611b146020830184611919565b9392505050565b5f8115159050919050565b611b2f81611b1b565b8114611b39575f80fd5b50565b5f81519050611b4a81611b26565b92915050565b5f60208284031215611b6557611b6461127a565b5b5f611b7284828501611b3c565b91505092915050565b7f5472616e73666572206661696c656400000000000000000000000000000000005f82015250565b5f611baf600f836115c3565b9150611bba82611b7b565b602082019050919050565b5f6020820190508181035f830152611bdc81611ba3565b9050919050565b7f6f6e6c79206f776e65722063616e207769746864726177207374616b650000005f82015250565b5f611c17601d836115c3565b9150611c2282611be3565b602082019050919050565b5f6020820190508181035f830152611c4481611c0b565b9050919050565b7f6f6e6c79206f776e65722063616e206465706f736974000000000000000000005f82015250565b5f611c7f6016836115c3565b9150611c8a82611c4b565b602082019050919050565b5f6020820190508181035f830152611cac81611c73565b9050919050565b7f6d7573742073657420746f6b656e2061646472657373000000000000000000005f82015250565b5f611ce76016836115c3565b9150611cf282611cb3565b602082019050919050565b5f6020820190508181035f830152611d1481611cdb565b9050919050565b7f6f6e6c79206f776e65722063616e207265736574206f776e65727368697000005f82015250565b5f611d4f601e836115c3565b9150611d5a82611d1b565b602082019050919050565b5f6020820190508181035f830152611d7c81611d43565b9050919050565b7f496e76616c6964206164647265737300000000000000000000000000000000005f82015250565b5f611db7600f836115c3565b9150611dc282611d83565b602082019050919050565b5f6020820190508181035f830152611de481611dab565b905091905056fea2646970667358221220d42998d21b24b178ae7afb9d2e1c0e95425fd0be5b07a1a586d07ab3bc83403064736f6c63430008180033
1
20,290,567
13666267e93a8723fac72a9ac77217f19312faf7e3ca6dca8559daab6f4139cc
3a8b01dc2cd38141c445cb2e1f9542c8791c4e47d31d8532e3e5ecead0bb59eb
aaeff290d5117dac60ad8e6939385c48918a991c
00b19a5200a100e5fc4c9800772f4d002f218400
b0b06f45af9cfadb70c5e1f57b9033742ec9b3dd
3d602d80600a3d3981f3363d3d373d3d3d363d739f36ee33fd56c7d9a78facd3249c580b1ca464a25af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d739f36ee33fd56c7d9a78facd3249c580b1ca464a25af43d82803e903d91602b57fd5bf3
{{ "language": "Solidity", "sources": { "src/clones/ERC1155SeaDropCloneable.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {\n ERC1155SeaDropContractOffererCloneable\n} from \"./ERC1155SeaDropContractOffererCloneable.sol\";\n\n/**\n * @title ERC1155SeaDropCloneable\n * @author James Wenzel (emo.eth)\n * @author Ryan Ghods (ralxz.eth)\n * @author Stephan Min (stephanm.eth)\n * @author Michael Cohen (notmichael.eth)\n * @custom:contributor Limit Break (@limitbreak)\n * @notice A cloneable ERC1155 token contract that can mint as a\n * Seaport contract offerer.\n * Implements Limit Break's Creator Token Standards transfer\n * validation for royalty enforcement.\n */\ncontract ERC1155SeaDropCloneable is ERC1155SeaDropContractOffererCloneable {\n /**\n * @notice Initialize the token contract.\n *\n * @param allowedConfigurer The address of the contract allowed to\n * implementation code. Also contains SeaDrop\n * implementation code.\n * @param allowedSeaport The address of the Seaport contract allowed to\n * interact.\n * @param name_ The name of the token.\n * @param symbol_ The symbol of the token.\n */\n function initialize(\n address allowedConfigurer,\n address allowedSeaport,\n string memory name_,\n string memory symbol_,\n address initialOwner\n ) public initializer {\n // Initialize ownership.\n _initializeOwner(initialOwner);\n\n // Initialize ERC1155SeaDropContractOffererCloneable.\n __ERC1155SeaDropContractOffererCloneable_init(\n allowedConfigurer,\n allowedSeaport,\n name_,\n symbol_\n );\n }\n\n /**\n * @notice Burns a token, restricted to the owner or approved operator,\n * and must have sufficient balance.\n *\n * @param from The address to burn from.\n * @param id The token id to burn.\n * @param amount The amount to burn.\n */\n function burn(address from, uint256 id, uint256 amount) external {\n // Burn the token.\n _burn(msg.sender, from, id, amount);\n }\n\n /**\n * @notice Burns a batch of tokens, restricted to the owner or\n * approved operator, and must have sufficient balance.\n *\n * @param from The address to burn from.\n * @param ids The token ids to burn.\n * @param amounts The amounts to burn per token id.\n */\n function batchBurn(\n address from,\n uint256[] calldata ids,\n uint256[] calldata amounts\n ) external {\n // Burn the tokens.\n _batchBurn(msg.sender, from, ids, amounts);\n }\n}\n" }, "src/clones/ERC1155SeaDropContractOffererCloneable.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { IERC1155SeaDrop } from \"../interfaces/IERC1155SeaDrop.sol\";\n\nimport { ISeaDropToken } from \"../interfaces/ISeaDropToken.sol\";\n\nimport {\n ERC1155ContractMetadataCloneable\n} from \"./ERC1155ContractMetadataCloneable.sol\";\n\nimport {\n ERC1155SeaDropContractOffererStorage\n} from \"../lib/ERC1155SeaDropContractOffererStorage.sol\";\n\nimport {\n ERC1155SeaDropErrorsAndEvents\n} from \"../lib/ERC1155SeaDropErrorsAndEvents.sol\";\n\nimport { PublicDrop } from \"../lib//ERC1155SeaDropStructs.sol\";\n\nimport { AllowListData } from \"../lib/SeaDropStructs.sol\";\n\nimport {\n ERC1155ConduitPreapproved\n} from \"../lib/ERC1155ConduitPreapproved.sol\";\n\nimport { ERC1155 } from \"solady/src/tokens/ERC1155.sol\";\n\nimport { SpentItem } from \"seaport-types/src/lib/ConsiderationStructs.sol\";\n\nimport {\n ContractOffererInterface\n} from \"seaport-types/src/interfaces/ContractOffererInterface.sol\";\n\nimport {\n IERC165\n} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\n/**\n * @title ERC1155SeaDropContractOffererCloneable\n * @author James Wenzel (emo.eth)\n * @author Ryan Ghods (ralxz.eth)\n * @author Stephan Min (stephanm.eth)\n * @author Michael Cohen (notmichael.eth)\n * @notice A cloneable ERC1155 token contract that can mint as a\n * Seaport contract offerer.\n */\ncontract ERC1155SeaDropContractOffererCloneable is\n ERC1155ContractMetadataCloneable,\n ERC1155SeaDropErrorsAndEvents\n{\n using ERC1155SeaDropContractOffererStorage for ERC1155SeaDropContractOffererStorage.Layout;\n\n /**\n * @notice Initialize the token contract.\n *\n * @param allowedConfigurer The address of the contract allowed to\n * configure parameters. Also contains SeaDrop\n * implementation code.\n * @param allowedSeaport The address of the Seaport contract allowed to\n * interact.\n * @param name_ The name of the token.\n * @param symbol_ The symbol of the token.\n */\n function __ERC1155SeaDropContractOffererCloneable_init(\n address allowedConfigurer,\n address allowedSeaport,\n string memory name_,\n string memory symbol_\n ) internal onlyInitializing {\n // Set the allowed Seaport to interact with this contract.\n if (allowedSeaport == address(0)) {\n revert AllowedSeaportCannotBeZeroAddress();\n }\n ERC1155SeaDropContractOffererStorage.layout()._allowedSeaport[\n allowedSeaport\n ] = true;\n\n // Set the allowed Seaport enumeration.\n address[] memory enumeratedAllowedSeaport = new address[](1);\n enumeratedAllowedSeaport[0] = allowedSeaport;\n ERC1155SeaDropContractOffererStorage\n .layout()\n ._enumeratedAllowedSeaport = enumeratedAllowedSeaport;\n\n // Emit an event noting the contract deployment.\n emit SeaDropTokenDeployed(SEADROP_TOKEN_TYPE.ERC1155_CLONE);\n\n // Initialize ERC1155ContractMetadataCloneable.\n __ERC1155ContractMetadataCloneable_init(\n allowedConfigurer,\n name_,\n symbol_\n );\n }\n\n /**\n * @notice The fallback function is used as a dispatcher for SeaDrop\n * methods.\n */\n fallback(bytes calldata) external returns (bytes memory output) {\n // Get the function selector.\n bytes4 selector = msg.sig;\n\n // Get the rest of the msg data after the selector.\n bytes calldata data = msg.data[4:];\n\n // Determine if we should forward the call to the implementation\n // contract with SeaDrop logic.\n bool callSeaDropImplementation = selector ==\n ISeaDropToken.updateAllowedSeaport.selector ||\n selector == ISeaDropToken.updateDropURI.selector ||\n selector == ISeaDropToken.updateAllowList.selector ||\n selector == ISeaDropToken.updateCreatorPayouts.selector ||\n selector == ISeaDropToken.updatePayer.selector ||\n selector == ISeaDropToken.updateAllowedFeeRecipient.selector ||\n selector == ISeaDropToken.updateSigner.selector ||\n selector == IERC1155SeaDrop.updatePublicDrop.selector ||\n selector == ContractOffererInterface.previewOrder.selector ||\n selector == ContractOffererInterface.generateOrder.selector ||\n selector == ContractOffererInterface.getSeaportMetadata.selector ||\n selector == IERC1155SeaDrop.getPublicDrop.selector ||\n selector == IERC1155SeaDrop.getPublicDropIndexes.selector ||\n selector == ISeaDropToken.getAllowedSeaport.selector ||\n selector == ISeaDropToken.getCreatorPayouts.selector ||\n selector == ISeaDropToken.getAllowListMerkleRoot.selector ||\n selector == ISeaDropToken.getAllowedFeeRecipients.selector ||\n selector == ISeaDropToken.getSigners.selector ||\n selector == ISeaDropToken.getDigestIsUsed.selector ||\n selector == ISeaDropToken.getPayers.selector;\n\n // Determine if we should require only the owner or configurer calling.\n bool requireOnlyOwnerOrConfigurer = selector ==\n ISeaDropToken.updateAllowedSeaport.selector ||\n selector == ISeaDropToken.updateDropURI.selector ||\n selector == ISeaDropToken.updateAllowList.selector ||\n selector == ISeaDropToken.updateCreatorPayouts.selector ||\n selector == ISeaDropToken.updatePayer.selector ||\n selector == ISeaDropToken.updateAllowedFeeRecipient.selector ||\n selector == IERC1155SeaDrop.updatePublicDrop.selector;\n\n if (callSeaDropImplementation) {\n // For update calls, ensure the sender is only the owner\n // or configurer contract.\n if (requireOnlyOwnerOrConfigurer) {\n _onlyOwnerOrConfigurer();\n } else if (selector == ISeaDropToken.updateSigner.selector) {\n // For updateSigner, a signer can disallow themselves.\n // Get the signer parameter.\n address signer = address(bytes20(data[12:32]));\n // If the signer is not allowed, ensure sender is only owner\n // or configurer.\n if (\n msg.sender != signer ||\n (msg.sender == signer &&\n !ERC1155SeaDropContractOffererStorage\n .layout()\n ._allowedSigners[signer])\n ) {\n _onlyOwnerOrConfigurer();\n }\n }\n\n // Forward the call to the implementation contract.\n (bool success, bytes memory returnedData) = _CONFIGURER\n .delegatecall(msg.data);\n\n // Require that the call was successful.\n if (!success) {\n // Bubble up the revert reason.\n assembly {\n revert(add(32, returnedData), mload(returnedData))\n }\n }\n\n // If the call was to generateOrder, mint the tokens.\n if (selector == ContractOffererInterface.generateOrder.selector) {\n _mintOrder(data);\n }\n\n // Return the data from the delegate call.\n return returnedData;\n } else if (selector == IERC1155SeaDrop.getMintStats.selector) {\n // Get the minter and token id.\n (address minter, uint256 tokenId) = abi.decode(\n data,\n (address, uint256)\n );\n\n // Get the mint stats.\n (\n uint256 minterNumMinted,\n uint256 minterNumMintedForTokenId,\n uint256 totalMintedForTokenId,\n uint256 maxSupply\n ) = _getMintStats(minter, tokenId);\n\n // Encode the return data.\n return\n abi.encode(\n minterNumMinted,\n minterNumMintedForTokenId,\n totalMintedForTokenId,\n maxSupply\n );\n } else if (selector == ContractOffererInterface.ratifyOrder.selector) {\n // This function is a no-op, nothing additional needs to happen here.\n // Utilize assembly to efficiently return the ratifyOrder magic value.\n assembly {\n mstore(0, 0xf4dd92ce)\n return(0x1c, 32)\n }\n } else if (selector == ISeaDropToken.configurer.selector) {\n // Return the configurer contract.\n return abi.encode(_CONFIGURER);\n } else if (selector == IERC1155SeaDrop.multiConfigureMint.selector) {\n // Ensure only the owner or configurer can call this function.\n _onlyOwnerOrConfigurer();\n\n // Mint the tokens.\n _multiConfigureMint(data);\n } else {\n // Revert if the function selector is not supported.\n revert UnsupportedFunctionSelector(selector);\n }\n }\n\n /**\n * @notice Returns a set of mint stats for the address.\n * This assists in enforcing maxSupply, maxTotalMintableByWallet,\n * and maxTokenSupplyForStage checks.\n *\n * @dev NOTE: Implementing contracts should always update these numbers\n * before transferring any tokens with _safeMint() to mitigate\n * consequences of malicious onERC1155Received() hooks.\n *\n * @param minter The minter address.\n * @param tokenId The token id to return the stats for.\n */\n function _getMintStats(\n address minter,\n uint256 tokenId\n )\n internal\n view\n returns (\n uint256 minterNumMinted,\n uint256 minterNumMintedForTokenId,\n uint256 totalMintedForTokenId,\n uint256 maxSupply\n )\n {\n // Put the token supply on the stack.\n TokenSupply storage tokenSupply = _tokenSupply[tokenId];\n\n // Assign the return values.\n totalMintedForTokenId = tokenSupply.totalMinted;\n maxSupply = tokenSupply.maxSupply;\n minterNumMinted = _totalMintedByUser[minter];\n minterNumMintedForTokenId = _totalMintedByUserPerToken[minter][tokenId];\n }\n\n /**\n * @dev Handle ERC-1155 safeTransferFrom. If \"from\" is this contract,\n * the sender can only be Seaport or the conduit.\n *\n * @param from The address to transfer from.\n * @param to The address to transfer to.\n * @param id The token id to transfer.\n * @param amount The amount of tokens to transfer.\n * @param data The data to pass to the onERC1155Received hook.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) public virtual override {\n if (from == address(this)) {\n // Only Seaport or the conduit can use this function\n // when \"from\" is this contract.\n if (\n msg.sender != _CONDUIT &&\n !ERC1155SeaDropContractOffererStorage.layout()._allowedSeaport[\n msg.sender\n ]\n ) {\n revert InvalidCallerOnlyAllowedSeaport(msg.sender);\n }\n return;\n }\n\n ERC1155._safeTransfer(_by(), from, to, id, amount, data);\n }\n\n /**\n * @notice Returns whether the interface is supported.\n *\n * @param interfaceId The interface id to check against.\n */\n function supportsInterface(\n bytes4 interfaceId\n )\n public\n view\n virtual\n override(ERC1155ContractMetadataCloneable)\n returns (bool)\n {\n return\n interfaceId == type(IERC1155SeaDrop).interfaceId ||\n interfaceId == type(ContractOffererInterface).interfaceId ||\n interfaceId == 0x2e778efc || // SIP-5 (getSeaportMetadata)\n // ERC1155ContractMetadata returns supportsInterface true for\n // IERC1155ContractMetadata, ERC-4906, ERC-2981\n // ERC1155A returns supportsInterface true for\n // ERC165, ERC1155, ERC1155MetadataURI\n ERC1155ContractMetadataCloneable.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Internal function to mint tokens during a generateOrder call\n * from Seaport.\n *\n * @param data The original transaction calldata, without the selector.\n */\n function _mintOrder(bytes calldata data) internal {\n // Decode fulfiller, minimumReceived, and context from calldata.\n (\n address fulfiller,\n SpentItem[] memory minimumReceived,\n ,\n bytes memory context\n ) = abi.decode(data, (address, SpentItem[], SpentItem[], bytes));\n\n // Assign the minter from context[22:42]. We validate context has the\n // correct minimum length in the implementation's `_decodeOrder`.\n address minter;\n assembly {\n minter := shr(96, mload(add(add(context, 0x20), 22)))\n }\n\n // If the minter is the zero address, set it to the fulfiller.\n if (minter == address(0)) {\n minter = fulfiller;\n }\n\n // Set the token ids and quantities.\n uint256 minimumReceivedLength = minimumReceived.length;\n uint256[] memory tokenIds = new uint256[](minimumReceivedLength);\n uint256[] memory quantities = new uint256[](minimumReceivedLength);\n for (uint256 i = 0; i < minimumReceivedLength; ) {\n tokenIds[i] = minimumReceived[i].identifier;\n quantities[i] = minimumReceived[i].amount;\n unchecked {\n ++i;\n }\n }\n\n // Mint the tokens.\n _batchMint(minter, tokenIds, quantities, \"\");\n }\n\n /**\n * @dev Internal function to mint tokens during a multiConfigureMint call\n * from the configurer contract.\n *\n * @param data The original transaction calldata, without the selector.\n */\n function _multiConfigureMint(bytes calldata data) internal {\n // Decode the calldata.\n (\n address recipient,\n uint256[] memory tokenIds,\n uint256[] memory amounts\n ) = abi.decode(data, (address, uint256[], uint256[]));\n\n _batchMint(recipient, tokenIds, amounts, \"\");\n }\n}\n" }, "src/interfaces/IERC1155SeaDrop.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { ISeaDropToken } from \"./ISeaDropToken.sol\";\n\nimport { PublicDrop } from \"../lib/ERC1155SeaDropStructs.sol\";\n\n/**\n * @dev A helper interface to get and set parameters for ERC1155SeaDrop.\n * The token does not expose these methods as part of its external\n * interface to optimize contract size, but does implement them.\n */\ninterface IERC1155SeaDrop is ISeaDropToken {\n /**\n * @notice Update the SeaDrop public drop parameters at a given index.\n *\n * @param publicDrop The new public drop parameters.\n * @param index The public drop index.\n */\n function updatePublicDrop(\n PublicDrop calldata publicDrop,\n uint256 index\n ) external;\n\n /**\n * @notice Returns the public drop stage parameters at a given index.\n *\n * @param index The index of the public drop stage.\n */\n function getPublicDrop(\n uint256 index\n ) external view returns (PublicDrop memory);\n\n /**\n * @notice Returns the public drop indexes.\n */\n function getPublicDropIndexes() external view returns (uint256[] memory);\n\n /**\n * @notice Returns a set of mint stats for the address.\n * This assists SeaDrop in enforcing maxSupply,\n * maxTotalMintableByWallet, maxTotalMintableByWalletPerToken,\n * and maxTokenSupplyForStage checks.\n *\n * @dev NOTE: Implementing contracts should always update these numbers\n * before transferring any tokens with _safeMint() to mitigate\n * consequences of malicious onERC1155Received() hooks.\n *\n * @param minter The minter address.\n * @param tokenId The token id to return stats for.\n */\n function getMintStats(\n address minter,\n uint256 tokenId\n )\n external\n view\n returns (\n uint256 minterNumMinted,\n uint256 minterNumMintedForTokenId,\n uint256 totalMintedForTokenId,\n uint256 maxSupply\n );\n\n /**\n * @notice This function is only allowed to be called by the configurer\n * contract as a way to batch mints and configuration in one tx.\n *\n * @param recipient The address to receive the mints.\n * @param tokenIds The tokenIds to mint.\n * @param amounts The amounts to mint.\n */\n function multiConfigureMint(\n address recipient,\n uint256[] calldata tokenIds,\n uint256[] calldata amounts\n ) external;\n}\n" }, "src/interfaces/ISeaDropToken.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {\n ISeaDropTokenContractMetadata\n} from \"./ISeaDropTokenContractMetadata.sol\";\n\nimport { AllowListData, CreatorPayout } from \"../lib/SeaDropStructs.sol\";\n\n/**\n * @dev A helper base interface for IERC721SeaDrop and IERC1155SeaDrop.\n * The token does not expose these methods as part of its external\n * interface to optimize contract size, but does implement them.\n */\ninterface ISeaDropToken is ISeaDropTokenContractMetadata {\n /**\n * @notice Update the SeaDrop allowed Seaport contracts privileged to mint.\n * Only the owner can use this function.\n *\n * @param allowedSeaport The allowed Seaport addresses.\n */\n function updateAllowedSeaport(address[] calldata allowedSeaport) external;\n\n /**\n * @notice Update the SeaDrop allowed fee recipient.\n * Only the owner can use this function.\n *\n * @param feeRecipient The new fee recipient.\n * @param allowed Whether the fee recipient is allowed.\n */\n function updateAllowedFeeRecipient(\n address feeRecipient,\n bool allowed\n ) external;\n\n /**\n * @notice Update the SeaDrop creator payout addresses.\n * The total basis points must add up to exactly 10_000.\n * Only the owner can use this function.\n *\n * @param creatorPayouts The new creator payouts.\n */\n function updateCreatorPayouts(\n CreatorPayout[] calldata creatorPayouts\n ) external;\n\n /**\n * @notice Update the SeaDrop drop URI.\n * Only the owner can use this function.\n *\n * @param dropURI The new drop URI.\n */\n function updateDropURI(string calldata dropURI) external;\n\n /**\n * @notice Update the SeaDrop allow list data.\n * Only the owner can use this function.\n *\n * @param allowListData The new allow list data.\n */\n function updateAllowList(AllowListData calldata allowListData) external;\n\n /**\n * @notice Update the SeaDrop allowed payers.\n * Only the owner can use this function.\n *\n * @param payer The payer to update.\n * @param allowed Whether the payer is allowed.\n */\n function updatePayer(address payer, bool allowed) external;\n\n /**\n * @notice Update the SeaDrop allowed signer.\n * Only the owner can use this function.\n * An allowed signer can also disallow themselves.\n *\n * @param signer The signer to update.\n * @param allowed Whether the signer is allowed.\n */\n function updateSigner(address signer, bool allowed) external;\n\n /**\n * @notice Get the SeaDrop allowed Seaport contracts privileged to mint.\n */\n function getAllowedSeaport() external view returns (address[] memory);\n\n /**\n * @notice Returns the SeaDrop creator payouts.\n */\n function getCreatorPayouts() external view returns (CreatorPayout[] memory);\n\n /**\n * @notice Returns the SeaDrop allow list merkle root.\n */\n function getAllowListMerkleRoot() external view returns (bytes32);\n\n /**\n * @notice Returns the SeaDrop allowed fee recipients.\n */\n function getAllowedFeeRecipients() external view returns (address[] memory);\n\n /**\n * @notice Returns the SeaDrop allowed signers.\n */\n function getSigners() external view returns (address[] memory);\n\n /**\n * @notice Returns if the signed digest has been used.\n *\n * @param digest The digest hash.\n */\n function getDigestIsUsed(bytes32 digest) external view returns (bool);\n\n /**\n * @notice Returns the SeaDrop allowed payers.\n */\n function getPayers() external view returns (address[] memory);\n\n /**\n * @notice Returns the configurer contract.\n */\n function configurer() external view returns (address);\n}\n" }, "src/clones/ERC1155ContractMetadataCloneable.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {\n IERC1155ContractMetadata\n} from \"../interfaces/IERC1155ContractMetadata.sol\";\n\nimport {\n ERC1155ConduitPreapproved\n} from \"../lib/ERC1155ConduitPreapproved.sol\";\n\nimport {\n ICreatorToken,\n ILegacyCreatorToken\n} from \"../interfaces/ICreatorToken.sol\";\n\nimport { ITransferValidator1155 } from \"../interfaces/ITransferValidator.sol\";\n\nimport { TokenTransferValidator } from \"../lib/TokenTransferValidator.sol\";\n\nimport { ERC1155 } from \"solady/src/tokens/ERC1155.sol\";\n\nimport { ERC2981 } from \"solady/src/tokens/ERC2981.sol\";\n\nimport { Ownable } from \"solady/src/auth/Ownable.sol\";\n\nimport {\n Initializable\n} from \"@openzeppelin-upgradeable/contracts/proxy/utils/Initializable.sol\";\n\n/**\n * @title ERC1155ContractMetadataCloneable\n * @author James Wenzel (emo.eth)\n * @author Ryan Ghods (ralxz.eth)\n * @author Stephan Min (stephanm.eth)\n * @author Michael Cohen (notmichael.eth)\n * @notice A cloneable token contract that extends ERC-1155\n * with additional metadata and ownership capabilities.\n */\ncontract ERC1155ContractMetadataCloneable is\n ERC1155ConduitPreapproved,\n TokenTransferValidator,\n ERC2981,\n Ownable,\n IERC1155ContractMetadata,\n Initializable\n{\n /// @notice A struct containing the token supply info per token id.\n mapping(uint256 => TokenSupply) _tokenSupply;\n\n /// @notice The total number of tokens minted by address.\n mapping(address => uint256) _totalMintedByUser;\n\n /// @notice The total number of tokens minted per token id by address.\n mapping(address => mapping(uint256 => uint256)) _totalMintedByUserPerToken;\n\n /// @notice The name of the token.\n string internal _name;\n\n /// @notice The symbol of the token.\n string internal _symbol;\n\n /// @notice The base URI for token metadata.\n string internal _baseURI;\n\n /// @notice The contract URI for contract metadata.\n string internal _contractURI;\n\n /// @notice The provenance hash for guaranteeing metadata order\n /// for random reveals.\n bytes32 internal _provenanceHash;\n\n /// @notice The allowed contract that can configure SeaDrop parameters.\n address internal _CONFIGURER;\n\n /**\n * @dev Reverts if the sender is not the owner or the allowed\n * configurer contract.\n *\n * This is used as a function instead of a modifier\n * to save contract space when used multiple times.\n */\n function _onlyOwnerOrConfigurer() internal view {\n if (msg.sender != _CONFIGURER && msg.sender != owner()) {\n revert Unauthorized();\n }\n }\n\n /**\n * @notice Deploy the token contract.\n *\n * @param allowedConfigurer The address of the contract allowed to\n * configure parameters. Also contains SeaDrop\n * implementation code.\n * @param name_ The name of the token.\n * @param symbol_ The symbol of the token.\n */\n function __ERC1155ContractMetadataCloneable_init(\n address allowedConfigurer,\n string memory name_,\n string memory symbol_\n ) internal onlyInitializing {\n // Set the name of the token.\n _name = name_;\n\n // Set the symbol of the token.\n _symbol = symbol_;\n\n // Set the allowed configurer contract to interact with this contract.\n _CONFIGURER = allowedConfigurer;\n }\n\n /**\n * @notice Sets the base URI for the token metadata and emits an event.\n *\n * @param newBaseURI The new base URI to set.\n */\n function setBaseURI(string calldata newBaseURI) external override {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Set the new base URI.\n _baseURI = newBaseURI;\n\n // Emit an event with the update.\n emit BatchMetadataUpdate(0, type(uint256).max);\n }\n\n /**\n * @notice Sets the contract URI for contract metadata.\n *\n * @param newContractURI The new contract URI.\n */\n function setContractURI(string calldata newContractURI) external override {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Set the new contract URI.\n _contractURI = newContractURI;\n\n // Emit an event with the update.\n emit ContractURIUpdated(newContractURI);\n }\n\n /**\n * @notice Emit an event notifying metadata updates for\n * a range of token ids, according to EIP-4906.\n *\n * @param fromTokenId The start token id.\n * @param toTokenId The end token id.\n */\n function emitBatchMetadataUpdate(\n uint256 fromTokenId,\n uint256 toTokenId\n ) external {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Emit an event with the update.\n if (fromTokenId == toTokenId) {\n // If only one token is being updated, use the event\n // in the 1155 spec.\n emit URI(uri(fromTokenId), fromTokenId);\n } else {\n emit BatchMetadataUpdate(fromTokenId, toTokenId);\n }\n }\n\n /**\n * @notice Sets the max token supply and emits an event.\n *\n * @param tokenId The token id to set the max supply for.\n * @param newMaxSupply The new max supply to set.\n */\n function setMaxSupply(uint256 tokenId, uint256 newMaxSupply) external {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Ensure the max supply does not exceed the maximum value of uint64,\n // a limit due to the storage of bit-packed variables in TokenSupply,\n if (newMaxSupply > 2 ** 64 - 1) {\n revert CannotExceedMaxSupplyOfUint64(newMaxSupply);\n }\n\n // Set the new max supply.\n _tokenSupply[tokenId].maxSupply = uint64(newMaxSupply);\n\n // Emit an event with the update.\n emit MaxSupplyUpdated(tokenId, newMaxSupply);\n }\n\n /**\n * @notice Sets the provenance hash and emits an event.\n *\n * The provenance hash is used for random reveals, which\n * is a hash of the ordered metadata to show it has not been\n * modified after mint started.\n *\n * This function will revert if the provenance hash has already\n * been set, so be sure to carefully set it only once.\n *\n * @param newProvenanceHash The new provenance hash to set.\n */\n function setProvenanceHash(bytes32 newProvenanceHash) external {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Keep track of the old provenance hash for emitting with the event.\n bytes32 oldProvenanceHash = _provenanceHash;\n\n // Revert if the provenance hash has already been set.\n if (oldProvenanceHash != bytes32(0)) {\n revert ProvenanceHashCannotBeSetAfterAlreadyBeingSet();\n }\n\n // Set the new provenance hash.\n _provenanceHash = newProvenanceHash;\n\n // Emit an event with the update.\n emit ProvenanceHashUpdated(oldProvenanceHash, newProvenanceHash);\n }\n\n /**\n * @notice Sets the default royalty information.\n *\n * Requirements:\n *\n * - `receiver` cannot be the zero address.\n * - `feeNumerator` cannot be greater than the fee denominator of 10_000 basis points.\n */\n function setDefaultRoyalty(address receiver, uint96 feeNumerator) external {\n // Ensure the sender is only the owner or configurer contract.\n _onlyOwnerOrConfigurer();\n\n // Set the default royalty.\n // ERC2981 implementation ensures feeNumerator <= feeDenominator\n // and receiver != address(0).\n _setDefaultRoyalty(receiver, feeNumerator);\n\n // Emit an event with the updated params.\n emit RoyaltyInfoUpdated(receiver, feeNumerator);\n }\n\n /**\n * @notice Returns the name of the token.\n */\n function name() external view returns (string memory) {\n return _name;\n }\n\n /**\n * @notice Returns the symbol of the token.\n */\n function symbol() external view returns (string memory) {\n return _symbol;\n }\n\n /**\n * @notice Returns the base URI for token metadata.\n */\n function baseURI() external view override returns (string memory) {\n return _baseURI;\n }\n\n /**\n * @notice Returns the contract URI for contract metadata.\n */\n function contractURI() external view override returns (string memory) {\n return _contractURI;\n }\n\n /**\n * @notice Returns the max token supply for a token id.\n */\n function maxSupply(uint256 tokenId) external view returns (uint256) {\n return _tokenSupply[tokenId].maxSupply;\n }\n\n /**\n * @notice Returns the total supply for a token id.\n */\n function totalSupply(uint256 tokenId) external view returns (uint256) {\n return _tokenSupply[tokenId].totalSupply;\n }\n\n /**\n * @notice Returns the total minted for a token id.\n */\n function totalMinted(uint256 tokenId) external view returns (uint256) {\n return _tokenSupply[tokenId].totalMinted;\n }\n\n /**\n * @notice Returns the provenance hash.\n * The provenance hash is used for random reveals, which\n * is a hash of the ordered metadata to show it is unmodified\n * after mint has started.\n */\n function provenanceHash() external view override returns (bytes32) {\n return _provenanceHash;\n }\n\n /**\n * @notice Returns the URI for token metadata.\n *\n * This implementation returns the same URI for *all* token types.\n * It relies on the token type ID substitution mechanism defined\n * in the EIP to replace {id} with the token id.\n *\n * @custom:param tokenId The token id to get the URI for.\n */\n function uri(\n uint256 /* tokenId */\n ) public view virtual override returns (string memory) {\n // Return the base URI.\n return _baseURI;\n }\n\n /**\n * @notice Returns the transfer validation function used.\n */\n function getTransferValidationFunction()\n external\n pure\n returns (bytes4 functionSignature, bool isViewFunction)\n {\n functionSignature = ITransferValidator1155.validateTransfer.selector;\n isViewFunction = true;\n }\n\n /**\n * @notice Set the transfer validator. Only callable by the token owner.\n */\n function setTransferValidator(address newValidator) external onlyOwner {\n // Set the new transfer validator.\n _setTransferValidator(newValidator);\n }\n\n /// @dev Override this function to return true if `_beforeTokenTransfer` is used.\n function _useBeforeTokenTransfer() internal view virtual override returns (bool) {\n return true;\n }\n\n /**\n * @dev Hook that is called before any token transfer.\n * This includes minting and burning.\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory /* data */\n ) internal virtual override {\n if (from != address(0) && to != address(0)) {\n // Call the transfer validator if one is set.\n address transferValidator = _transferValidator;\n if (transferValidator != address(0)) {\n for (uint256 i = 0; i < ids.length; i++) {\n ITransferValidator1155(transferValidator).validateTransfer(\n msg.sender,\n from,\n to,\n ids[i],\n amounts[i]\n );\n }\n }\n }\n }\n\n /**\n * @notice Returns whether the interface is supported.\n *\n * @param interfaceId The interface id to check against.\n */\n function supportsInterface(\n bytes4 interfaceId\n ) public view virtual override(ERC1155, ERC2981) returns (bool) {\n return\n interfaceId == type(IERC1155ContractMetadata).interfaceId ||\n interfaceId == type(ICreatorToken).interfaceId ||\n interfaceId == type(ILegacyCreatorToken).interfaceId ||\n interfaceId == 0x49064906 || // ERC-4906 (MetadataUpdate)\n ERC2981.supportsInterface(interfaceId) ||\n // ERC1155 returns supportsInterface true for\n // ERC165, ERC1155, ERC1155MetadataURI\n ERC1155.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Adds to the internal counters for a mint.\n *\n * @param to The address to mint to.\n * @param id The token id to mint.\n * @param amount The quantity to mint.\n * @param data The data to pass if receiver is a contract.\n */\n function _mint(\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal virtual override {\n // Increment mint counts.\n _incrementMintCounts(to, id, amount);\n\n ERC1155._mint(to, id, amount, data);\n }\n\n /**\n * @dev Adds to the internal counters for a batch mint.\n *\n * @param to The address to mint to.\n * @param ids The token ids to mint.\n * @param amounts The quantities to mint.\n * @param data The data to pass if receiver is a contract.\n */\n function _batchMint(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual override {\n // Put ids length on the stack to save MLOADs.\n uint256 idsLength = ids.length;\n\n for (uint256 i = 0; i < idsLength; ) {\n // Increment mint counts.\n _incrementMintCounts(to, ids[i], amounts[i]);\n\n unchecked {\n ++i;\n }\n }\n\n ERC1155._batchMint(to, ids, amounts, data);\n }\n\n /**\n * @dev Subtracts from the internal counters for a burn.\n *\n * @param by The address calling the burn.\n * @param from The address to burn from.\n * @param id The token id to burn.\n * @param amount The amount to burn.\n */\n function _burn(\n address by,\n address from,\n uint256 id,\n uint256 amount\n ) internal virtual override {\n // Reduce the supply.\n _reduceSupplyOnBurn(id, amount);\n\n ERC1155._burn(by, from, id, amount);\n }\n\n /**\n * @dev Subtracts from the internal counters for a batch burn.\n *\n * @param by The address calling the burn.\n * @param from The address to burn from.\n * @param ids The token ids to burn.\n * @param amounts The amounts to burn.\n */\n function _batchBurn(\n address by,\n address from,\n uint256[] memory ids,\n uint256[] memory amounts\n ) internal virtual override {\n // Put ids length on the stack to save MLOADs.\n uint256 idsLength = ids.length;\n\n for (uint256 i = 0; i < idsLength; ) {\n // Reduce the supply.\n _reduceSupplyOnBurn(ids[i], amounts[i]);\n\n unchecked {\n ++i;\n }\n }\n\n ERC1155._batchBurn(by, from, ids, amounts);\n }\n\n function _reduceSupplyOnBurn(uint256 id, uint256 amount) internal {\n // Get the current token supply.\n TokenSupply storage tokenSupply = _tokenSupply[id];\n\n // Reduce the totalSupply.\n unchecked {\n tokenSupply.totalSupply -= uint64(amount);\n }\n }\n\n /**\n * @dev Internal function to increment mint counts.\n *\n * Note that this function does not check if the mint exceeds\n * maxSupply, which should be validated before this function is called.\n *\n * @param to The address to mint to.\n * @param id The token id to mint.\n * @param amount The quantity to mint.\n */\n function _incrementMintCounts(\n address to,\n uint256 id,\n uint256 amount\n ) internal {\n // Get the current token supply.\n TokenSupply storage tokenSupply = _tokenSupply[id];\n\n if (tokenSupply.totalMinted + amount > tokenSupply.maxSupply) {\n revert MintExceedsMaxSupply(\n tokenSupply.totalMinted + amount,\n tokenSupply.maxSupply\n );\n }\n\n // Increment supply and number minted.\n // Can be unchecked because maxSupply cannot be set to exceed uint64.\n unchecked {\n tokenSupply.totalSupply += uint64(amount);\n tokenSupply.totalMinted += uint64(amount);\n\n // Increment total minted by user.\n _totalMintedByUser[to] += amount;\n\n // Increment total minted by user per token.\n _totalMintedByUserPerToken[to][id] += amount;\n }\n }\n}\n" }, "src/lib/ERC1155SeaDropContractOffererStorage.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { PublicDrop } from \"./ERC1155SeaDropStructs.sol\";\n\nimport { CreatorPayout } from \"./SeaDropStructs.sol\";\n\nlibrary ERC1155SeaDropContractOffererStorage {\n struct Layout {\n /// @notice The allowed Seaport addresses that can mint.\n mapping(address => bool) _allowedSeaport;\n /// @notice The enumerated allowed Seaport addresses.\n address[] _enumeratedAllowedSeaport;\n /// @notice The public drop data.\n mapping(uint256 => PublicDrop) _publicDrops;\n /// @notice The enumerated public drop indexes.\n uint256[] _enumeratedPublicDropIndexes;\n /// @notice The creator payout addresses and basis points.\n CreatorPayout[] _creatorPayouts;\n /// @notice The allow list merkle root.\n bytes32 _allowListMerkleRoot;\n /// @notice The allowed fee recipients.\n mapping(address => bool) _allowedFeeRecipients;\n /// @notice The enumerated allowed fee recipients.\n address[] _enumeratedFeeRecipients;\n /// @notice The allowed server-side signers.\n mapping(address => bool) _allowedSigners;\n /// @notice The enumerated allowed signers.\n address[] _enumeratedSigners;\n /// @notice The used signature digests.\n mapping(bytes32 => bool) _usedDigests;\n /// @notice The allowed payers.\n mapping(address => bool) _allowedPayers;\n /// @notice The enumerated allowed payers.\n address[] _enumeratedPayers;\n }\n\n bytes32 internal constant STORAGE_SLOT =\n bytes32(\n uint256(\n keccak256(\"contracts.storage.ERC1155SeaDropContractOfferer\")\n ) - 1\n );\n\n function layout() internal pure returns (Layout storage l) {\n bytes32 slot = STORAGE_SLOT;\n assembly {\n l.slot := slot\n }\n }\n}\n" }, "src/lib/ERC1155SeaDropErrorsAndEvents.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { PublicDrop } from \"./ERC1155SeaDropStructs.sol\";\n\nimport { SeaDropErrorsAndEvents } from \"./SeaDropErrorsAndEvents.sol\";\n\ninterface ERC1155SeaDropErrorsAndEvents is SeaDropErrorsAndEvents {\n /**\n * @dev Revert with an error if an empty PublicDrop is provided\n * for an already-empty public drop.\n */\n error PublicDropStageNotPresent();\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the\n * max minted per wallet for a certain token id.\n */\n error MintQuantityExceedsMaxMintedPerWalletForTokenId(\n uint256 tokenId,\n uint256 total,\n uint256 allowed\n );\n\n /**\n * @dev Revert with an error if the target token id to mint is not within\n * the drop stage range.\n */\n error TokenIdNotWithinDropStageRange(\n uint256 tokenId,\n uint256 startTokenId,\n uint256 endTokenId\n );\n\n /**\n * @notice Revert with an error if the number of maxSupplyAmounts doesn't\n * match the number of maxSupplyTokenIds.\n */\n error MaxSupplyMismatch();\n\n /**\n * @notice Revert with an error if the number of mint tokenIds doesn't\n * match the number of mint amounts.\n */\n error MintAmountsMismatch();\n\n /**\n * @notice Revert with an error if the mint order offer contains\n * a duplicate tokenId.\n */\n error OfferContainsDuplicateTokenId(uint256 tokenId);\n\n /**\n * @dev Revert if the fromTokenId is greater than the toTokenId.\n */\n error InvalidFromAndToTokenId(uint256 fromTokenId, uint256 toTokenId);\n\n /**\n * @notice Revert with an error if the number of publicDropIndexes doesn't\n * match the number of publicDrops.\n */\n error PublicDropsMismatch();\n\n /**\n * @dev An event with updated public drop data.\n */\n event PublicDropUpdated(PublicDrop publicDrop, uint256 index);\n}\n" }, "src/lib/ERC1155SeaDropStructs.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { AllowListData, CreatorPayout } from \"./SeaDropStructs.sol\";\n\n/**\n * @notice A struct defining public drop data.\n * Designed to fit efficiently in two storage slots.\n *\n * @param startPrice The start price per token. (Up to 1.2m\n * of native token, e.g. ETH, MATIC)\n * @param endPrice The end price per token. If this differs\n * from startPrice, the current price will\n * be calculated based on the current time.\n * @param startTime The start time, ensure this is not zero.\n * @param endTime The end time, ensure this is not zero.\n * @param restrictFeeRecipients If false, allow any fee recipient;\n * if true, check fee recipient is allowed.\n * @param paymentToken The payment token address. Null for\n * native token.\n * @param fromTokenId The start token id for the stage.\n * @param toTokenId The end token id for the stage.\n * @param maxTotalMintableByWallet Maximum total number of mints a user is\n * allowed. (The limit for this field is\n * 2^16 - 1)\n * @param maxTotalMintableByWalletPerToken Maximum total number of mints a user\n * is allowed for the token id. (The limit for\n * this field is 2^16 - 1)\n * @param feeBps Fee out of 10_000 basis points to be\n * collected.\n */\nstruct PublicDrop {\n // slot 1\n uint80 startPrice; // 80/512 bits\n uint80 endPrice; // 160/512 bits\n uint40 startTime; // 200/512 bits\n uint40 endTime; // 240/512 bits\n bool restrictFeeRecipients; // 248/512 bits\n // uint8 unused;\n\n // slot 2\n address paymentToken; // 408/512 bits\n uint24 fromTokenId; // 432/512 bits\n uint24 toTokenId; // 456/512 bits\n uint16 maxTotalMintableByWallet; // 472/512 bits\n uint16 maxTotalMintableByWalletPerToken; // 488/512 bits\n uint16 feeBps; // 504/512 bits\n}\n\n/**\n * @notice A struct defining mint params for an allow list.\n * An allow list leaf will be composed of `msg.sender` and\n * the following params.\n *\n * Note: Since feeBps is encoded in the leaf, backend should ensure\n * that feeBps is acceptable before generating a proof.\n *\n * @param startPrice The start price per token. (Up to 1.2m\n * of native token, e.g. ETH, MATIC)\n * @param endPrice The end price per token. If this differs\n * from startPrice, the current price will\n * be calculated based on the current time.\n * @param startTime The start time, ensure this is not zero.\n * @param endTime The end time, ensure this is not zero.\n * @param paymentToken The payment token for the mint. Null for\n * native token.\n * @param fromTokenId The start token id for the stage.\n * @param toTokenId The end token id for the stage.\n * @param maxTotalMintableByWallet Maximum total number of mints a user is\n * allowed.\n * @param maxTotalMintableByWalletPerToken Maximum total number of mints a user\n * is allowed for the token id.\n * @param maxTokenSupplyForStage The limit of token supply this stage can\n * mint within.\n * @param dropStageIndex The drop stage index to emit with the event\n * for analytical purposes. This should be\n * non-zero since the public mint emits with\n * index zero.\n * @param feeBps Fee out of 10_000 basis points to be\n * collected.\n * @param restrictFeeRecipients If false, allow any fee recipient;\n * if true, check fee recipient is allowed.\n */\nstruct MintParams {\n uint256 startPrice;\n uint256 endPrice;\n uint256 startTime;\n uint256 endTime;\n address paymentToken;\n uint256 fromTokenId;\n uint256 toTokenId;\n uint256 maxTotalMintableByWallet;\n uint256 maxTotalMintableByWalletPerToken;\n uint256 maxTokenSupplyForStage;\n uint256 dropStageIndex; // non-zero\n uint256 feeBps;\n bool restrictFeeRecipients;\n}\n\n/**\n * @dev Struct containing internal SeaDrop implementation logic\n * mint details to avoid stack too deep.\n *\n * @param feeRecipient The fee recipient.\n * @param payer The payer of the mint.\n * @param minter The mint recipient.\n * @param tokenIds The tokenIds to mint.\n * @param quantities The number of tokens to mint per tokenId.\n * @param withEffects Whether to apply state changes of the mint.\n */\nstruct MintDetails {\n address feeRecipient;\n address payer;\n address minter;\n uint256[] tokenIds;\n uint256[] quantities;\n bool withEffects;\n}\n\n/**\n * @notice A struct to configure multiple contract options in one transaction.\n */\nstruct MultiConfigureStruct {\n uint256[] maxSupplyTokenIds;\n uint256[] maxSupplyAmounts;\n string baseURI;\n string contractURI;\n PublicDrop[] publicDrops;\n uint256[] publicDropsIndexes;\n string dropURI;\n AllowListData allowListData;\n CreatorPayout[] creatorPayouts;\n bytes32 provenanceHash;\n address[] allowedFeeRecipients;\n address[] disallowedFeeRecipients;\n address[] allowedPayers;\n address[] disallowedPayers;\n // Server-signed\n address[] allowedSigners;\n address[] disallowedSigners;\n // ERC-2981\n address royaltyReceiver;\n uint96 royaltyBps;\n // Mint\n address mintRecipient;\n uint256[] mintTokenIds;\n uint256[] mintAmounts;\n}\n" }, "src/lib/SeaDropStructs.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\n/**\n * @notice A struct defining a creator payout address and basis points.\n *\n * @param payoutAddress The payout address.\n * @param basisPoints The basis points to pay out to the creator.\n * The total creator payouts must equal 10_000 bps.\n */\nstruct CreatorPayout {\n address payoutAddress;\n uint16 basisPoints;\n}\n\n/**\n * @notice A struct defining allow list data (for minting an allow list).\n *\n * @param merkleRoot The merkle root for the allow list.\n * @param publicKeyURIs If the allowListURI is encrypted, a list of URIs\n * pointing to the public keys. Empty if unencrypted.\n * @param allowListURI The URI for the allow list.\n */\nstruct AllowListData {\n bytes32 merkleRoot;\n string[] publicKeyURIs;\n string allowListURI;\n}\n" }, "src/lib/ERC1155ConduitPreapproved.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { ERC1155 } from \"solady/src/tokens/ERC1155.sol\";\n\n/**\n * @title ERC1155ConduitPreapproved\n * @notice Solady's ERC1155 with the OpenSea conduit preapproved.\n */\nabstract contract ERC1155ConduitPreapproved is ERC1155 {\n /// @dev The canonical OpenSea conduit.\n address internal constant _CONDUIT =\n 0x1E0049783F008A0085193E00003D00cd54003c71;\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) public virtual override {\n _safeTransfer(_by(), from, to, id, amount, data);\n }\n\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) public virtual override {\n _safeBatchTransfer(_by(), from, to, ids, amounts, data);\n }\n\n function isApprovedForAll(\n address owner,\n address operator\n ) public view virtual override returns (bool) {\n if (operator == _CONDUIT) return true;\n return ERC1155.isApprovedForAll(owner, operator);\n }\n\n function _by() internal view virtual returns (address result) {\n assembly {\n // `msg.sender == _CONDUIT ? address(0) : msg.sender`.\n result := mul(iszero(eq(caller(), _CONDUIT)), caller())\n }\n }\n}\n" }, "lib/solady/src/tokens/ERC1155.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/// @notice Simple ERC1155 implementation.\n/// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC1155.sol)\n/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC1155.sol)\n/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/tree/master/contracts/token/ERC1155/ERC1155.sol)\n///\n/// @dev Note:\n/// The ERC1155 standard allows for self-approvals.\n/// For performance, this implementation WILL NOT revert for such actions.\n/// Please add any checks with overrides if desired.\nabstract contract ERC1155 {\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* CUSTOM ERRORS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The lengths of the input arrays are not the same.\n error ArrayLengthsMismatch();\n\n /// @dev Cannot mint or transfer to the zero address.\n error TransferToZeroAddress();\n\n /// @dev The recipient's balance has overflowed.\n error AccountBalanceOverflow();\n\n /// @dev Insufficient balance.\n error InsufficientBalance();\n\n /// @dev Only the token owner or an approved account can manage the tokens.\n error NotOwnerNorApproved();\n\n /// @dev Cannot safely transfer to a contract that does not implement\n /// the ERC1155Receiver interface.\n error TransferToNonERC1155ReceiverImplementer();\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* EVENTS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Emitted when `amount` of token `id` is transferred\n /// from `from` to `to` by `operator`.\n event TransferSingle(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256 id,\n uint256 amount\n );\n\n /// @dev Emitted when `amounts` of token `ids` are transferred\n /// from `from` to `to` by `operator`.\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] amounts\n );\n\n /// @dev Emitted when `owner` enables or disables `operator` to manage all of their tokens.\n event ApprovalForAll(address indexed owner, address indexed operator, bool isApproved);\n\n /// @dev Emitted when the Uniform Resource Identifier (URI) for token `id`\n /// is updated to `value`. This event is not used in the base contract.\n /// You may need to emit this event depending on your URI logic.\n ///\n /// See: https://eips.ethereum.org/EIPS/eip-1155#metadata\n event URI(string value, uint256 indexed id);\n\n /// @dev `keccak256(bytes(\"TransferSingle(address,address,address,uint256,uint256)\"))`.\n uint256 private constant _TRANSFER_SINGLE_EVENT_SIGNATURE =\n 0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62;\n\n /// @dev `keccak256(bytes(\"TransferBatch(address,address,address,uint256[],uint256[])\"))`.\n uint256 private constant _TRANSFER_BATCH_EVENT_SIGNATURE =\n 0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb;\n\n /// @dev `keccak256(bytes(\"ApprovalForAll(address,address,bool)\"))`.\n uint256 private constant _APPROVAL_FOR_ALL_EVENT_SIGNATURE =\n 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* STORAGE */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The `ownerSlotSeed` of a given owner is given by.\n /// ```\n /// let ownerSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, owner))\n /// ```\n ///\n /// The balance slot of `owner` is given by.\n /// ```\n /// mstore(0x20, ownerSlotSeed)\n /// mstore(0x00, id)\n /// let balanceSlot := keccak256(0x00, 0x40)\n /// ```\n ///\n /// The operator approval slot of `owner` is given by.\n /// ```\n /// mstore(0x20, ownerSlotSeed)\n /// mstore(0x00, operator)\n /// let operatorApprovalSlot := keccak256(0x0c, 0x34)\n /// ```\n uint256 private constant _ERC1155_MASTER_SLOT_SEED = 0x9a31110384e0b0c9;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* ERC1155 METADATA */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Returns the URI for token `id`.\n ///\n /// You can either return the same templated URI for all token IDs,\n /// (e.g. \"https://example.com/api/{id}.json\"),\n /// or return a unique URI for each `id`.\n ///\n /// See: https://eips.ethereum.org/EIPS/eip-1155#metadata\n function uri(uint256 id) public view virtual returns (string memory);\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* ERC1155 */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Returns the amount of `id` owned by `owner`.\n function balanceOf(address owner, uint256 id) public view virtual returns (uint256 result) {\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, owner)\n mstore(0x00, id)\n result := sload(keccak256(0x00, 0x40))\n }\n }\n\n /// @dev Returns whether `operator` is approved to manage the tokens of `owner`.\n function isApprovedForAll(address owner, address operator)\n public\n view\n virtual\n returns (bool result)\n {\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, owner)\n mstore(0x00, operator)\n result := sload(keccak256(0x0c, 0x34))\n }\n }\n\n /// @dev Sets whether `operator` is approved to manage the tokens of the caller.\n ///\n /// Emits a {ApprovalForAll} event.\n function setApprovalForAll(address operator, bool isApproved) public virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // Convert to 0 or 1.\n isApproved := iszero(iszero(isApproved))\n // Update the `isApproved` for (`msg.sender`, `operator`).\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, caller())\n mstore(0x00, operator)\n sstore(keccak256(0x0c, 0x34), isApproved)\n // Emit the {ApprovalForAll} event.\n mstore(0x00, isApproved)\n // forgefmt: disable-next-line\n log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, caller(), shr(96, shl(96, operator)))\n }\n }\n\n /// @dev Transfers `amount` of `id` from `from` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `from` must have at least `amount` of `id`.\n /// - If the caller is not `from`,\n /// it must be approved to manage the tokens of `from`.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155Reveived}, which is called upon a batch transfer.\n ///\n /// Emits a {Transfer} event.\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) public virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, to, _single(id), _single(amount), data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, from))\n let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, to))\n mstore(0x20, fromSlotSeed)\n // Clear the upper 96 bits.\n from := shr(96, fromSlotSeed)\n to := shr(96, toSlotSeed)\n // Revert if `to` is the zero address.\n if iszero(to) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n // If the caller is not `from`, do the authorization check.\n if iszero(eq(caller(), from)) {\n mstore(0x00, caller())\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Subtract and store the updated balance of `from`.\n {\n mstore(0x00, id)\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, toSlotSeed)\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n // Emit a {TransferSingle} event.\n mstore(0x20, amount)\n log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), from, to)\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, to, _single(id), _single(amount), data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n // Do the {onERC1155Received} check if `to` is a smart contract.\n if extcodesize(to) {\n // Prepare the calldata.\n let m := mload(0x40)\n // `onERC1155Received(address,address,uint256,uint256,bytes)`.\n mstore(m, 0xf23a6e61)\n mstore(add(m, 0x20), caller())\n mstore(add(m, 0x40), from)\n mstore(add(m, 0x60), id)\n mstore(add(m, 0x80), amount)\n mstore(add(m, 0xa0), 0xa0)\n calldatacopy(add(m, 0xc0), sub(data.offset, 0x20), add(0x20, data.length))\n // Revert if the call reverts.\n if iszero(call(gas(), to, 0, add(m, 0x1c), add(0xc4, data.length), m, 0x20)) {\n if returndatasize() {\n // Bubble up the revert if the call reverts.\n returndatacopy(0x00, 0x00, returndatasize())\n revert(0x00, returndatasize())\n }\n mstore(m, 0)\n }\n // Load the returndata and compare it with the function selector.\n if iszero(eq(mload(m), shl(224, 0xf23a6e61))) {\n mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.\n revert(0x1c, 0x04)\n }\n }\n }\n }\n\n /// @dev Transfers `amounts` of `ids` from `from` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `from` must have at least `amount` of `id`.\n /// - `ids` and `amounts` must have the same length.\n /// - If the caller is not `from`,\n /// it must be approved to manage the tokens of `from`.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155BatchReveived}, which is called upon a batch transfer.\n ///\n /// Emits a {TransferBatch} event.\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) public virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, to, ids, amounts, data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(ids.length, amounts.length)) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, from))\n let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, to))\n mstore(0x20, fromSlotSeed)\n // Clear the upper 96 bits.\n from := shr(96, fromSlotSeed)\n to := shr(96, toSlotSeed)\n // Revert if `to` is the zero address.\n if iszero(to) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n // If the caller is not `from`, do the authorization check.\n if iszero(eq(caller(), from)) {\n mstore(0x00, caller())\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Loop through all the `ids` and update the balances.\n {\n let end := shl(5, ids.length)\n for { let i := 0 } iszero(eq(i, end)) { i := add(i, 0x20) } {\n let amount := calldataload(add(amounts.offset, i))\n // Subtract and store the updated balance of `from`.\n {\n mstore(0x20, fromSlotSeed)\n mstore(0x00, calldataload(add(ids.offset, i)))\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, toSlotSeed)\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n }\n }\n // Emit a {TransferBatch} event.\n {\n let m := mload(0x40)\n // Copy the `ids`.\n mstore(m, 0x40)\n let n := add(0x20, shl(5, ids.length))\n let o := add(m, 0x40)\n calldatacopy(o, sub(ids.offset, 0x20), n)\n // Copy the `amounts`.\n mstore(add(m, 0x20), add(0x40, n))\n o := add(o, n)\n n := add(0x20, shl(5, amounts.length))\n calldatacopy(o, sub(amounts.offset, 0x20), n)\n n := sub(add(o, n), m)\n // Do the emit.\n log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), from, to)\n }\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransferCalldata(from, to, ids, amounts, data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n // Do the {onERC1155BatchReceived} check if `to` is a smart contract.\n if extcodesize(to) {\n let m := mload(0x40)\n // Prepare the calldata.\n // `onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)`.\n mstore(m, 0xbc197c81)\n mstore(add(m, 0x20), caller())\n mstore(add(m, 0x40), from)\n // Copy the `ids`.\n mstore(add(m, 0x60), 0xa0)\n let n := add(0x20, shl(5, ids.length))\n let o := add(m, 0xc0)\n calldatacopy(o, sub(ids.offset, 0x20), n)\n // Copy the `amounts`.\n let s := add(0xa0, n)\n mstore(add(m, 0x80), s)\n o := add(o, n)\n n := add(0x20, shl(5, amounts.length))\n calldatacopy(o, sub(amounts.offset, 0x20), n)\n // Copy the `data`.\n mstore(add(m, 0xa0), add(s, n))\n o := add(o, n)\n n := add(0x20, data.length)\n calldatacopy(o, sub(data.offset, 0x20), n)\n n := sub(add(o, n), add(m, 0x1c))\n // Revert if the call reverts.\n if iszero(call(gas(), to, 0, add(m, 0x1c), n, m, 0x20)) {\n if returndatasize() {\n // Bubble up the revert if the call reverts.\n returndatacopy(0x00, 0x00, returndatasize())\n revert(0x00, returndatasize())\n }\n mstore(m, 0)\n }\n // Load the returndata and compare it with the function selector.\n if iszero(eq(mload(m), shl(224, 0xbc197c81))) {\n mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.\n revert(0x1c, 0x04)\n }\n }\n }\n }\n\n /// @dev Returns the amounts of `ids` for `owners.\n ///\n /// Requirements:\n /// - `owners` and `ids` must have the same length.\n function balanceOfBatch(address[] calldata owners, uint256[] calldata ids)\n public\n view\n virtual\n returns (uint256[] memory balances)\n {\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(ids.length, owners.length)) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n balances := mload(0x40)\n mstore(balances, ids.length)\n let o := add(balances, 0x20)\n let end := shl(5, ids.length)\n mstore(0x40, add(end, o))\n // Loop through all the `ids` and load the balances.\n for { let i := 0 } iszero(eq(i, end)) { i := add(i, 0x20) } {\n let owner := calldataload(add(owners.offset, i))\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, shl(96, owner)))\n mstore(0x00, calldataload(add(ids.offset, i)))\n mstore(add(o, i), sload(keccak256(0x00, 0x40)))\n }\n }\n }\n\n /// @dev Returns true if this contract implements the interface defined by `interfaceId`.\n /// See: https://eips.ethereum.org/EIPS/eip-165\n /// This function call must use less than 30000 gas.\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) {\n /// @solidity memory-safe-assembly\n assembly {\n let s := shr(224, interfaceId)\n // ERC165: 0x01ffc9a7, ERC1155: 0xd9b67a26, ERC1155MetadataURI: 0x0e89341c.\n result := or(or(eq(s, 0x01ffc9a7), eq(s, 0xd9b67a26)), eq(s, 0x0e89341c))\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL MINT FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Mints `amount` of `id` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155Reveived}, which is called upon a batch transfer.\n ///\n /// Emits a {Transfer} event.\n function _mint(address to, uint256 id, uint256 amount, bytes memory data) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(address(0), to, _single(id), _single(amount), data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n let to_ := shl(96, to)\n // Revert if `to` is the zero address.\n if iszero(to_) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, to)\n mstore(0x00, id)\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n // Emit a {TransferSingle} event.\n mstore(0x00, id)\n mstore(0x20, amount)\n log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), 0, shr(96, to_))\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(address(0), to, _single(id), _single(amount), data);\n }\n if (_hasCode(to)) _checkOnERC1155Received(address(0), to, id, amount, data);\n }\n\n /// @dev Mints `amounts` of `ids` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `ids` and `amounts` must have the same length.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155BatchReveived}, which is called upon a batch transfer.\n ///\n /// Emits a {TransferBatch} event.\n function _batchMint(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(address(0), to, ids, amounts, data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(mload(ids), mload(amounts))) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n let to_ := shl(96, to)\n // Revert if `to` is the zero address.\n if iszero(to_) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n // Loop through all the `ids` and update the balances.\n {\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, to_))\n let end := shl(5, mload(ids))\n for { let i := 0 } iszero(eq(i, end)) {} {\n i := add(i, 0x20)\n let amount := mload(add(amounts, i))\n // Increase and store the updated balance of `to`.\n {\n mstore(0x00, mload(add(ids, i)))\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n }\n }\n // Emit a {TransferBatch} event.\n {\n let m := mload(0x40)\n // Copy the `ids`.\n mstore(m, 0x40)\n let n := add(0x20, shl(5, mload(ids)))\n let o := add(m, 0x40)\n pop(staticcall(gas(), 4, ids, n, o, n))\n // Copy the `amounts`.\n mstore(add(m, 0x20), add(0x40, returndatasize()))\n o := add(o, returndatasize())\n n := add(0x20, shl(5, mload(amounts)))\n pop(staticcall(gas(), 4, amounts, n, o, n))\n n := sub(add(o, returndatasize()), m)\n // Do the emit.\n log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), 0, shr(96, to_))\n }\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(address(0), to, ids, amounts, data);\n }\n if (_hasCode(to)) _checkOnERC1155BatchReceived(address(0), to, ids, amounts, data);\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL BURN FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Equivalent to `_burn(address(0), from, id, amount)`.\n function _burn(address from, uint256 id, uint256 amount) internal virtual {\n _burn(address(0), from, id, amount);\n }\n\n /// @dev Destroys `amount` of `id` from `from`.\n ///\n /// Requirements:\n /// - `from` must have at least `amount` of `id`.\n /// - If `by` is not the zero address, it must be either `from`,\n /// or approved to manage the tokens of `from`.\n ///\n /// Emits a {Transfer} event.\n function _burn(address by, address from, uint256 id, uint256 amount) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, address(0), _single(id), _single(amount), \"\");\n }\n /// @solidity memory-safe-assembly\n assembly {\n let from_ := shl(96, from)\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, from_))\n // If `by` is not the zero address, and not equal to `from`,\n // check if it is approved to manage all the tokens of `from`.\n if iszero(or(iszero(shl(96, by)), eq(shl(96, by), from_))) {\n mstore(0x00, by)\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Decrease and store the updated balance of `from`.\n {\n mstore(0x00, id)\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Emit a {TransferSingle} event.\n mstore(0x00, id)\n mstore(0x20, amount)\n log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), shr(96, from_), 0)\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, address(0), _single(id), _single(amount), \"\");\n }\n }\n\n /// @dev Equivalent to `_batchBurn(address(0), from, ids, amounts)`.\n function _batchBurn(address from, uint256[] memory ids, uint256[] memory amounts)\n internal\n virtual\n {\n _batchBurn(address(0), from, ids, amounts);\n }\n\n /// @dev Destroys `amounts` of `ids` from `from`.\n ///\n /// Requirements:\n /// - `ids` and `amounts` must have the same length.\n /// - `from` must have at least `amounts` of `ids`.\n /// - If `by` is not the zero address, it must be either `from`,\n /// or approved to manage the tokens of `from`.\n ///\n /// Emits a {TransferBatch} event.\n function _batchBurn(address by, address from, uint256[] memory ids, uint256[] memory amounts)\n internal\n virtual\n {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, address(0), ids, amounts, \"\");\n }\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(mload(ids), mload(amounts))) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n let from_ := shl(96, from)\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, from_))\n // If `by` is not the zero address, and not equal to `from`,\n // check if it is approved to manage all the tokens of `from`.\n let by_ := shl(96, by)\n if iszero(or(iszero(by_), eq(by_, from_))) {\n mstore(0x00, by)\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Loop through all the `ids` and update the balances.\n {\n let end := shl(5, mload(ids))\n for { let i := 0 } iszero(eq(i, end)) {} {\n i := add(i, 0x20)\n let amount := mload(add(amounts, i))\n // Decrease and store the updated balance of `to`.\n {\n mstore(0x00, mload(add(ids, i)))\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n }\n }\n // Emit a {TransferBatch} event.\n {\n let m := mload(0x40)\n // Copy the `ids`.\n mstore(m, 0x40)\n let n := add(0x20, shl(5, mload(ids)))\n let o := add(m, 0x40)\n pop(staticcall(gas(), 4, ids, n, o, n))\n // Copy the `amounts`.\n mstore(add(m, 0x20), add(0x40, returndatasize()))\n o := add(o, returndatasize())\n n := add(0x20, shl(5, mload(amounts)))\n pop(staticcall(gas(), 4, amounts, n, o, n))\n n := sub(add(o, returndatasize()), m)\n // Do the emit.\n log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), shr(96, from_), 0)\n }\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, address(0), ids, amounts, \"\");\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL APPROVAL FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Approve or remove the `operator` as an operator for `by`,\n /// without authorization checks.\n ///\n /// Emits a {ApprovalForAll} event.\n function _setApprovalForAll(address by, address operator, bool isApproved) internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // Convert to 0 or 1.\n isApproved := iszero(iszero(isApproved))\n // Update the `isApproved` for (`by`, `operator`).\n mstore(0x20, _ERC1155_MASTER_SLOT_SEED)\n mstore(0x14, by)\n mstore(0x00, operator)\n sstore(keccak256(0x0c, 0x34), isApproved)\n // Emit the {ApprovalForAll} event.\n mstore(0x00, isApproved)\n let m := shr(96, not(0))\n log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, and(m, by), and(m, operator))\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL TRANSFER FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Equivalent to `_safeTransfer(address(0), from, to, id, amount, data)`.\n function _safeTransfer(address from, address to, uint256 id, uint256 amount, bytes memory data)\n internal\n virtual\n {\n _safeTransfer(address(0), from, to, id, amount, data);\n }\n\n /// @dev Transfers `amount` of `id` from `from` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `from` must have at least `amount` of `id`.\n /// - If `by` is not the zero address, it must be either `from`,\n /// or approved to manage the tokens of `from`.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155Reveived}, which is called upon a batch transfer.\n ///\n /// Emits a {Transfer} event.\n function _safeTransfer(\n address by,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, to, _single(id), _single(amount), data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n let from_ := shl(96, from)\n let to_ := shl(96, to)\n // Revert if `to` is the zero address.\n if iszero(to_) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, from_))\n // If `by` is not the zero address, and not equal to `from`,\n // check if it is approved to manage all the tokens of `from`.\n let by_ := shl(96, by)\n if iszero(or(iszero(by_), eq(by_, from_))) {\n mstore(0x00, by)\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Subtract and store the updated balance of `from`.\n {\n mstore(0x00, id)\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, or(_ERC1155_MASTER_SLOT_SEED, to_))\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n // Emit a {TransferSingle} event.\n mstore(0x20, amount)\n // forgefmt: disable-next-line\n log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), shr(96, from_), shr(96, to_))\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, to, _single(id), _single(amount), data);\n }\n if (_hasCode(to)) _checkOnERC1155Received(from, to, id, amount, data);\n }\n\n /// @dev Equivalent to `_safeBatchTransfer(address(0), from, to, ids, amounts, data)`.\n function _safeBatchTransfer(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n _safeBatchTransfer(address(0), from, to, ids, amounts, data);\n }\n\n /// @dev Transfers `amounts` of `ids` from `from` to `to`.\n ///\n /// Requirements:\n /// - `to` cannot be the zero address.\n /// - `ids` and `amounts` must have the same length.\n /// - `from` must have at least `amounts` of `ids`.\n /// - If `by` is not the zero address, it must be either `from`,\n /// or approved to manage the tokens of `from`.\n /// - If `to` refers to a smart contract, it must implement\n /// {ERC1155-onERC1155BatchReveived}, which is called upon a batch transfer.\n ///\n /// Emits a {TransferBatch} event.\n function _safeBatchTransfer(\n address by,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n if (_useBeforeTokenTransfer()) {\n _beforeTokenTransfer(from, to, ids, amounts, data);\n }\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(eq(mload(ids), mload(amounts))) {\n mstore(0x00, 0x3b800a46) // `ArrayLengthsMismatch()`.\n revert(0x1c, 0x04)\n }\n let from_ := shl(96, from)\n let to_ := shl(96, to)\n // Revert if `to` is the zero address.\n if iszero(to_) {\n mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.\n revert(0x1c, 0x04)\n }\n let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, from_)\n let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, to_)\n mstore(0x20, fromSlotSeed)\n // If `by` is not the zero address, and not equal to `from`,\n // check if it is approved to manage all the tokens of `from`.\n let by_ := shl(96, by)\n if iszero(or(iszero(by_), eq(by_, from_))) {\n mstore(0x00, by)\n if iszero(sload(keccak256(0x0c, 0x34))) {\n mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.\n revert(0x1c, 0x04)\n }\n }\n // Loop through all the `ids` and update the balances.\n {\n let end := shl(5, mload(ids))\n for { let i := 0 } iszero(eq(i, end)) {} {\n i := add(i, 0x20)\n let amount := mload(add(amounts, i))\n // Subtract and store the updated balance of `from`.\n {\n mstore(0x20, fromSlotSeed)\n mstore(0x00, mload(add(ids, i)))\n let fromBalanceSlot := keccak256(0x00, 0x40)\n let fromBalance := sload(fromBalanceSlot)\n if gt(amount, fromBalance) {\n mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.\n revert(0x1c, 0x04)\n }\n sstore(fromBalanceSlot, sub(fromBalance, amount))\n }\n // Increase and store the updated balance of `to`.\n {\n mstore(0x20, toSlotSeed)\n let toBalanceSlot := keccak256(0x00, 0x40)\n let toBalanceBefore := sload(toBalanceSlot)\n let toBalanceAfter := add(toBalanceBefore, amount)\n if lt(toBalanceAfter, toBalanceBefore) {\n mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.\n revert(0x1c, 0x04)\n }\n sstore(toBalanceSlot, toBalanceAfter)\n }\n }\n }\n // Emit a {TransferBatch} event.\n {\n let m := mload(0x40)\n // Copy the `ids`.\n mstore(m, 0x40)\n let n := add(0x20, shl(5, mload(ids)))\n let o := add(m, 0x40)\n pop(staticcall(gas(), 4, ids, n, o, n))\n // Copy the `amounts`.\n mstore(add(m, 0x20), add(0x40, returndatasize()))\n o := add(o, returndatasize())\n n := add(0x20, shl(5, mload(amounts)))\n pop(staticcall(gas(), 4, amounts, n, o, n))\n n := sub(add(o, returndatasize()), m)\n // Do the emit.\n log4(m, n, _TRANSFER_BATCH_EVENT_SIGNATURE, caller(), shr(96, from_), shr(96, to_))\n }\n }\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, to, ids, amounts, data);\n }\n if (_hasCode(to)) _checkOnERC1155BatchReceived(from, to, ids, amounts, data);\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* HOOKS FOR OVERRIDING */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Override this function to return true if `_beforeTokenTransfer` is used.\n /// The is to help the compiler avoid producing dead bytecode.\n function _useBeforeTokenTransfer() internal view virtual returns (bool) {\n return false;\n }\n\n /// @dev Hook that is called before any token transfer.\n /// This includes minting and burning, as well as batched variants.\n ///\n /// The same hook is called on both single and batched variants.\n /// For single transfers, the length of the `id` and `amount` arrays are 1.\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {}\n\n /// @dev Override this function to return true if `_afterTokenTransfer` is used.\n /// The is to help the compiler avoid producing dead bytecode.\n function _useAfterTokenTransfer() internal view virtual returns (bool) {\n return false;\n }\n\n /// @dev Hook that is called after any token transfer.\n /// This includes minting and burning, as well as batched variants.\n ///\n /// The same hook is called on both single and batched variants.\n /// For single transfers, the length of the `id` and `amount` arrays are 1.\n function _afterTokenTransfer(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {}\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* PRIVATE HELPERS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Helper for calling the `_afterTokenTransfer` hook.\n /// The is to help the compiler avoid producing dead bytecode.\n function _afterTokenTransferCalldata(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) private {\n if (_useAfterTokenTransfer()) {\n _afterTokenTransfer(from, to, ids, amounts, data);\n }\n }\n\n /// @dev Returns if `a` has bytecode of non-zero length.\n function _hasCode(address a) private view returns (bool result) {\n /// @solidity memory-safe-assembly\n assembly {\n result := extcodesize(a) // Can handle dirty upper bits.\n }\n }\n\n /// @dev Perform a call to invoke {IERC1155Receiver-onERC1155Received} on `to`.\n /// Reverts if the target does not support the function correctly.\n function _checkOnERC1155Received(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n /// @solidity memory-safe-assembly\n assembly {\n // Prepare the calldata.\n let m := mload(0x40)\n // `onERC1155Received(address,address,uint256,uint256,bytes)`.\n mstore(m, 0xf23a6e61)\n mstore(add(m, 0x20), caller())\n mstore(add(m, 0x40), shr(96, shl(96, from)))\n mstore(add(m, 0x60), id)\n mstore(add(m, 0x80), amount)\n mstore(add(m, 0xa0), 0xa0)\n let n := mload(data)\n mstore(add(m, 0xc0), n)\n if n { pop(staticcall(gas(), 4, add(data, 0x20), n, add(m, 0xe0), n)) }\n // Revert if the call reverts.\n if iszero(call(gas(), to, 0, add(m, 0x1c), add(0xc4, n), m, 0x20)) {\n if returndatasize() {\n // Bubble up the revert if the call reverts.\n returndatacopy(0x00, 0x00, returndatasize())\n revert(0x00, returndatasize())\n }\n mstore(m, 0)\n }\n // Load the returndata and compare it with the function selector.\n if iszero(eq(mload(m), shl(224, 0xf23a6e61))) {\n mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.\n revert(0x1c, 0x04)\n }\n }\n }\n\n /// @dev Perform a call to invoke {IERC1155Receiver-onERC1155BatchReceived} on `to`.\n /// Reverts if the target does not support the function correctly.\n function _checkOnERC1155BatchReceived(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n /// @solidity memory-safe-assembly\n assembly {\n // Prepare the calldata.\n let m := mload(0x40)\n // `onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)`.\n mstore(m, 0xbc197c81)\n mstore(add(m, 0x20), caller())\n mstore(add(m, 0x40), shr(96, shl(96, from)))\n // Copy the `ids`.\n mstore(add(m, 0x60), 0xa0)\n let n := add(0x20, shl(5, mload(ids)))\n let o := add(m, 0xc0)\n pop(staticcall(gas(), 4, ids, n, o, n))\n // Copy the `amounts`.\n let s := add(0xa0, returndatasize())\n mstore(add(m, 0x80), s)\n o := add(o, returndatasize())\n n := add(0x20, shl(5, mload(amounts)))\n pop(staticcall(gas(), 4, amounts, n, o, n))\n // Copy the `data`.\n mstore(add(m, 0xa0), add(s, returndatasize()))\n o := add(o, returndatasize())\n n := add(0x20, mload(data))\n pop(staticcall(gas(), 4, data, n, o, n))\n n := sub(add(o, returndatasize()), add(m, 0x1c))\n // Revert if the call reverts.\n if iszero(call(gas(), to, 0, add(m, 0x1c), n, m, 0x20)) {\n if returndatasize() {\n // Bubble up the revert if the call reverts.\n returndatacopy(0x00, 0x00, returndatasize())\n revert(0x00, returndatasize())\n }\n mstore(m, 0)\n }\n // Load the returndata and compare it with the function selector.\n if iszero(eq(mload(m), shl(224, 0xbc197c81))) {\n mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.\n revert(0x1c, 0x04)\n }\n }\n }\n\n /// @dev Returns `x` in an array with a single element.\n function _single(uint256 x) private pure returns (uint256[] memory result) {\n assembly {\n result := mload(0x40)\n mstore(0x40, add(result, 0x40))\n mstore(result, 1)\n mstore(add(result, 0x20), x)\n }\n }\n}\n" }, "lib/seaport/lib/seaport-types/src/lib/ConsiderationStructs.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {\n BasicOrderType,\n ItemType,\n OrderType,\n Side\n} from \"./ConsiderationEnums.sol\";\n\nimport {\n CalldataPointer,\n MemoryPointer\n} from \"../helpers/PointerLibraries.sol\";\n\n/**\n * @dev An order contains eleven components: an offerer, a zone (or account that\n * can cancel the order or restrict who can fulfill the order depending on\n * the type), the order type (specifying partial fill support as well as\n * restricted order status), the start and end time, a hash that will be\n * provided to the zone when validating restricted orders, a salt, a key\n * corresponding to a given conduit, a counter, and an arbitrary number of\n * offer items that can be spent along with consideration items that must\n * be received by their respective recipient.\n */\nstruct OrderComponents {\n address offerer;\n address zone;\n OfferItem[] offer;\n ConsiderationItem[] consideration;\n OrderType orderType;\n uint256 startTime;\n uint256 endTime;\n bytes32 zoneHash;\n uint256 salt;\n bytes32 conduitKey;\n uint256 counter;\n}\n\n/**\n * @dev An offer item has five components: an item type (ETH or other native\n * tokens, ERC20, ERC721, and ERC1155, as well as criteria-based ERC721 and\n * ERC1155), a token address, a dual-purpose \"identifierOrCriteria\"\n * component that will either represent a tokenId or a merkle root\n * depending on the item type, and a start and end amount that support\n * increasing or decreasing amounts over the duration of the respective\n * order.\n */\nstruct OfferItem {\n ItemType itemType;\n address token;\n uint256 identifierOrCriteria;\n uint256 startAmount;\n uint256 endAmount;\n}\n\n/**\n * @dev A consideration item has the same five components as an offer item and\n * an additional sixth component designating the required recipient of the\n * item.\n */\nstruct ConsiderationItem {\n ItemType itemType;\n address token;\n uint256 identifierOrCriteria;\n uint256 startAmount;\n uint256 endAmount;\n address payable recipient;\n}\n\n/**\n * @dev A spent item is translated from a utilized offer item and has four\n * components: an item type (ETH or other native tokens, ERC20, ERC721, and\n * ERC1155), a token address, a tokenId, and an amount.\n */\nstruct SpentItem {\n ItemType itemType;\n address token;\n uint256 identifier;\n uint256 amount;\n}\n\n/**\n * @dev A received item is translated from a utilized consideration item and has\n * the same four components as a spent item, as well as an additional fifth\n * component designating the required recipient of the item.\n */\nstruct ReceivedItem {\n ItemType itemType;\n address token;\n uint256 identifier;\n uint256 amount;\n address payable recipient;\n}\n\n/**\n * @dev For basic orders involving ETH / native / ERC20 <=> ERC721 / ERC1155\n * matching, a group of six functions may be called that only requires a\n * subset of the usual order arguments. Note the use of a \"basicOrderType\"\n * enum; this represents both the usual order type as well as the \"route\"\n * of the basic order (a simple derivation function for the basic order\n * type is `basicOrderType = orderType + (4 * basicOrderRoute)`.)\n */\nstruct BasicOrderParameters {\n // calldata offset\n address considerationToken; // 0x24\n uint256 considerationIdentifier; // 0x44\n uint256 considerationAmount; // 0x64\n address payable offerer; // 0x84\n address zone; // 0xa4\n address offerToken; // 0xc4\n uint256 offerIdentifier; // 0xe4\n uint256 offerAmount; // 0x104\n BasicOrderType basicOrderType; // 0x124\n uint256 startTime; // 0x144\n uint256 endTime; // 0x164\n bytes32 zoneHash; // 0x184\n uint256 salt; // 0x1a4\n bytes32 offererConduitKey; // 0x1c4\n bytes32 fulfillerConduitKey; // 0x1e4\n uint256 totalOriginalAdditionalRecipients; // 0x204\n AdditionalRecipient[] additionalRecipients; // 0x224\n bytes signature; // 0x244\n // Total length, excluding dynamic array data: 0x264 (580)\n}\n\n/**\n * @dev Basic orders can supply any number of additional recipients, with the\n * implied assumption that they are supplied from the offered ETH (or other\n * native token) or ERC20 token for the order.\n */\nstruct AdditionalRecipient {\n uint256 amount;\n address payable recipient;\n}\n\n/**\n * @dev The full set of order components, with the exception of the counter,\n * must be supplied when fulfilling more sophisticated orders or groups of\n * orders. The total number of original consideration items must also be\n * supplied, as the caller may specify additional consideration items.\n */\nstruct OrderParameters {\n address offerer; // 0x00\n address zone; // 0x20\n OfferItem[] offer; // 0x40\n ConsiderationItem[] consideration; // 0x60\n OrderType orderType; // 0x80\n uint256 startTime; // 0xa0\n uint256 endTime; // 0xc0\n bytes32 zoneHash; // 0xe0\n uint256 salt; // 0x100\n bytes32 conduitKey; // 0x120\n uint256 totalOriginalConsiderationItems; // 0x140\n // offer.length // 0x160\n}\n\n/**\n * @dev Orders require a signature in addition to the other order parameters.\n */\nstruct Order {\n OrderParameters parameters;\n bytes signature;\n}\n\n/**\n * @dev Advanced orders include a numerator (i.e. a fraction to attempt to fill)\n * and a denominator (the total size of the order) in addition to the\n * signature and other order parameters. It also supports an optional field\n * for supplying extra data; this data will be provided to the zone if the\n * order type is restricted and the zone is not the caller, or will be\n * provided to the offerer as context for contract order types.\n */\nstruct AdvancedOrder {\n OrderParameters parameters;\n uint120 numerator;\n uint120 denominator;\n bytes signature;\n bytes extraData;\n}\n\n/**\n * @dev Orders can be validated (either explicitly via `validate`, or as a\n * consequence of a full or partial fill), specifically cancelled (they can\n * also be cancelled in bulk via incrementing a per-zone counter), and\n * partially or fully filled (with the fraction filled represented by a\n * numerator and denominator).\n */\nstruct OrderStatus {\n bool isValidated;\n bool isCancelled;\n uint120 numerator;\n uint120 denominator;\n}\n\n/**\n * @dev A criteria resolver specifies an order, side (offer vs. consideration),\n * and item index. It then provides a chosen identifier (i.e. tokenId)\n * alongside a merkle proof demonstrating the identifier meets the required\n * criteria.\n */\nstruct CriteriaResolver {\n uint256 orderIndex;\n Side side;\n uint256 index;\n uint256 identifier;\n bytes32[] criteriaProof;\n}\n\n/**\n * @dev A fulfillment is applied to a group of orders. It decrements a series of\n * offer and consideration items, then generates a single execution\n * element. A given fulfillment can be applied to as many offer and\n * consideration items as desired, but must contain at least one offer and\n * at least one consideration that match. The fulfillment must also remain\n * consistent on all key parameters across all offer items (same offerer,\n * token, type, tokenId, and conduit preference) as well as across all\n * consideration items (token, type, tokenId, and recipient).\n */\nstruct Fulfillment {\n FulfillmentComponent[] offerComponents;\n FulfillmentComponent[] considerationComponents;\n}\n\n/**\n * @dev Each fulfillment component contains one index referencing a specific\n * order and another referencing a specific offer or consideration item.\n */\nstruct FulfillmentComponent {\n uint256 orderIndex;\n uint256 itemIndex;\n}\n\n/**\n * @dev An execution is triggered once all consideration items have been zeroed\n * out. It sends the item in question from the offerer to the item's\n * recipient, optionally sourcing approvals from either this contract\n * directly or from the offerer's chosen conduit if one is specified. An\n * execution is not provided as an argument, but rather is derived via\n * orders, criteria resolvers, and fulfillments (where the total number of\n * executions will be less than or equal to the total number of indicated\n * fulfillments) and returned as part of `matchOrders`.\n */\nstruct Execution {\n ReceivedItem item;\n address offerer;\n bytes32 conduitKey;\n}\n\n/**\n * @dev Restricted orders are validated post-execution by calling validateOrder\n * on the zone. This struct provides context about the order fulfillment\n * and any supplied extraData, as well as all order hashes fulfilled in a\n * call to a match or fulfillAvailable method.\n */\nstruct ZoneParameters {\n bytes32 orderHash;\n address fulfiller;\n address offerer;\n SpentItem[] offer;\n ReceivedItem[] consideration;\n bytes extraData;\n bytes32[] orderHashes;\n uint256 startTime;\n uint256 endTime;\n bytes32 zoneHash;\n}\n\n/**\n * @dev Zones and contract offerers can communicate which schemas they implement\n * along with any associated metadata related to each schema.\n */\nstruct Schema {\n uint256 id;\n bytes metadata;\n}\n\nusing StructPointers for OrderComponents global;\nusing StructPointers for OfferItem global;\nusing StructPointers for ConsiderationItem global;\nusing StructPointers for SpentItem global;\nusing StructPointers for ReceivedItem global;\nusing StructPointers for BasicOrderParameters global;\nusing StructPointers for AdditionalRecipient global;\nusing StructPointers for OrderParameters global;\nusing StructPointers for Order global;\nusing StructPointers for AdvancedOrder global;\nusing StructPointers for OrderStatus global;\nusing StructPointers for CriteriaResolver global;\nusing StructPointers for Fulfillment global;\nusing StructPointers for FulfillmentComponent global;\nusing StructPointers for Execution global;\nusing StructPointers for ZoneParameters global;\n\n/**\n * @dev This library provides a set of functions for converting structs to\n * pointers.\n */\nlibrary StructPointers {\n /**\n * @dev Get a MemoryPointer from OrderComponents.\n *\n * @param obj The OrderComponents object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n OrderComponents memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from OrderComponents.\n *\n * @param obj The OrderComponents object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n OrderComponents calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from OfferItem.\n *\n * @param obj The OfferItem object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n OfferItem memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from OfferItem.\n *\n * @param obj The OfferItem object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n OfferItem calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from ConsiderationItem.\n *\n * @param obj The ConsiderationItem object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n ConsiderationItem memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from ConsiderationItem.\n *\n * @param obj The ConsiderationItem object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n ConsiderationItem calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from SpentItem.\n *\n * @param obj The SpentItem object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n SpentItem memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from SpentItem.\n *\n * @param obj The SpentItem object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n SpentItem calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from ReceivedItem.\n *\n * @param obj The ReceivedItem object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n ReceivedItem memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from ReceivedItem.\n *\n * @param obj The ReceivedItem object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n ReceivedItem calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from BasicOrderParameters.\n *\n * @param obj The BasicOrderParameters object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n BasicOrderParameters memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from BasicOrderParameters.\n *\n * @param obj The BasicOrderParameters object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n BasicOrderParameters calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from AdditionalRecipient.\n *\n * @param obj The AdditionalRecipient object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n AdditionalRecipient memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from AdditionalRecipient.\n *\n * @param obj The AdditionalRecipient object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n AdditionalRecipient calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from OrderParameters.\n *\n * @param obj The OrderParameters object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n OrderParameters memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from OrderParameters.\n *\n * @param obj The OrderParameters object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n OrderParameters calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from Order.\n *\n * @param obj The Order object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n Order memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from Order.\n *\n * @param obj The Order object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n Order calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from AdvancedOrder.\n *\n * @param obj The AdvancedOrder object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n AdvancedOrder memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from AdvancedOrder.\n *\n * @param obj The AdvancedOrder object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n AdvancedOrder calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from OrderStatus.\n *\n * @param obj The OrderStatus object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n OrderStatus memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from OrderStatus.\n *\n * @param obj The OrderStatus object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n OrderStatus calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from CriteriaResolver.\n *\n * @param obj The CriteriaResolver object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n CriteriaResolver memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from CriteriaResolver.\n *\n * @param obj The CriteriaResolver object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n CriteriaResolver calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from Fulfillment.\n *\n * @param obj The Fulfillment object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n Fulfillment memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from Fulfillment.\n *\n * @param obj The Fulfillment object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n Fulfillment calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from FulfillmentComponent.\n *\n * @param obj The FulfillmentComponent object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n FulfillmentComponent memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from FulfillmentComponent.\n *\n * @param obj The FulfillmentComponent object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n FulfillmentComponent calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from Execution.\n *\n * @param obj The Execution object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n Execution memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from Execution.\n *\n * @param obj The Execution object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n Execution calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a MemoryPointer from ZoneParameters.\n *\n * @param obj The ZoneParameters object.\n *\n * @return ptr The MemoryPointer.\n */\n function toMemoryPointer(\n ZoneParameters memory obj\n ) internal pure returns (MemoryPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n\n /**\n * @dev Get a CalldataPointer from ZoneParameters.\n *\n * @param obj The ZoneParameters object.\n *\n * @return ptr The CalldataPointer.\n */\n function toCalldataPointer(\n ZoneParameters calldata obj\n ) internal pure returns (CalldataPointer ptr) {\n assembly {\n ptr := obj\n }\n }\n}\n" }, "lib/seaport/lib/seaport-types/src/interfaces/ContractOffererInterface.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport {ReceivedItem, Schema, SpentItem} from \"../lib/ConsiderationStructs.sol\";\nimport {IERC165} from \"../interfaces/IERC165.sol\";\n\n/**\n * @title ContractOffererInterface\n * @notice Contains the minimum interfaces needed to interact with a contract\n * offerer.\n */\ninterface ContractOffererInterface is IERC165 {\n /**\n * @dev Generates an order with the specified minimum and maximum spent\n * items, and optional context (supplied as extraData).\n *\n * @param fulfiller The address of the fulfiller.\n * @param minimumReceived The minimum items that the caller is willing to\n * receive.\n * @param maximumSpent The maximum items the caller is willing to spend.\n * @param context Additional context of the order.\n *\n * @return offer A tuple containing the offer items.\n * @return consideration A tuple containing the consideration items.\n */\n function generateOrder(\n address fulfiller,\n SpentItem[] calldata minimumReceived,\n SpentItem[] calldata maximumSpent,\n bytes calldata context // encoded based on the schemaID\n ) external returns (SpentItem[] memory offer, ReceivedItem[] memory consideration);\n\n /**\n * @dev Ratifies an order with the specified offer, consideration, and\n * optional context (supplied as extraData).\n *\n * @param offer The offer items.\n * @param consideration The consideration items.\n * @param context Additional context of the order.\n * @param orderHashes The hashes to ratify.\n * @param contractNonce The nonce of the contract.\n *\n * @return ratifyOrderMagicValue The magic value returned by the contract\n * offerer.\n */\n function ratifyOrder(\n SpentItem[] calldata offer,\n ReceivedItem[] calldata consideration,\n bytes calldata context, // encoded based on the schemaID\n bytes32[] calldata orderHashes,\n uint256 contractNonce\n ) external returns (bytes4 ratifyOrderMagicValue);\n\n /**\n * @dev View function to preview an order generated in response to a minimum\n * set of received items, maximum set of spent items, and context\n * (supplied as extraData).\n *\n * @param caller The address of the caller (e.g. Seaport).\n * @param fulfiller The address of the fulfiller (e.g. the account\n * calling Seaport).\n * @param minimumReceived The minimum items that the caller is willing to\n * receive.\n * @param maximumSpent The maximum items the caller is willing to spend.\n * @param context Additional context of the order.\n *\n * @return offer A tuple containing the offer items.\n * @return consideration A tuple containing the consideration items.\n */\n function previewOrder(\n address caller,\n address fulfiller,\n SpentItem[] calldata minimumReceived,\n SpentItem[] calldata maximumSpent,\n bytes calldata context // encoded based on the schemaID\n ) external view returns (SpentItem[] memory offer, ReceivedItem[] memory consideration);\n\n /**\n * @dev Gets the metadata for this contract offerer.\n *\n * @return name The name of the contract offerer.\n * @return schemas The schemas supported by the contract offerer.\n */\n function getSeaportMetadata() external view returns (string memory name, Schema[] memory schemas); // map to Seaport Improvement Proposal IDs\n\n function supportsInterface(bytes4 interfaceId) external view override returns (bool);\n\n // Additional functions and/or events based on implemented schemaIDs\n}\n" }, "lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.19;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" }, "src/interfaces/ISeaDropTokenContractMetadata.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\ninterface ISeaDropTokenContractMetadata {\n /**\n * @dev Emit an event for token metadata reveals/updates,\n * according to EIP-4906.\n *\n * @param _fromTokenId The start token id.\n * @param _toTokenId The end token id.\n */\n event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId);\n\n /**\n * @dev Emit an event when the URI for the collection-level metadata\n * is updated.\n */\n event ContractURIUpdated(string newContractURI);\n\n /**\n * @dev Emit an event with the previous and new provenance hash after\n * being updated.\n */\n event ProvenanceHashUpdated(bytes32 previousHash, bytes32 newHash);\n\n /**\n * @dev Emit an event when the EIP-2981 royalty info is updated.\n */\n event RoyaltyInfoUpdated(address receiver, uint256 basisPoints);\n\n /**\n * @notice Throw if the max supply exceeds uint64, a limit\n * due to the storage of bit-packed variables.\n */\n error CannotExceedMaxSupplyOfUint64(uint256 got);\n\n /**\n * @dev Revert with an error when attempting to set the provenance\n * hash after the mint has started.\n */\n error ProvenanceHashCannotBeSetAfterMintStarted();\n\n /**\n * @dev Revert with an error when attempting to set the provenance\n * hash after it has already been set.\n */\n error ProvenanceHashCannotBeSetAfterAlreadyBeingSet();\n\n /**\n * @notice Sets the base URI for the token metadata and emits an event.\n *\n * @param tokenURI The new base URI to set.\n */\n function setBaseURI(string calldata tokenURI) external;\n\n /**\n * @notice Sets the contract URI for contract metadata.\n *\n * @param newContractURI The new contract URI.\n */\n function setContractURI(string calldata newContractURI) external;\n\n /**\n * @notice Sets the provenance hash and emits an event.\n *\n * The provenance hash is used for random reveals, which\n * is a hash of the ordered metadata to show it has not been\n * modified after mint started.\n *\n * This function will revert after the first item has been minted.\n *\n * @param newProvenanceHash The new provenance hash to set.\n */\n function setProvenanceHash(bytes32 newProvenanceHash) external;\n\n /**\n * @notice Sets the default royalty information.\n *\n * Requirements:\n *\n * - `receiver` cannot be the zero address.\n * - `feeNumerator` cannot be greater than the fee denominator of\n * 10_000 basis points.\n */\n function setDefaultRoyalty(address receiver, uint96 feeNumerator) external;\n\n /**\n * @notice Returns the base URI for token metadata.\n */\n function baseURI() external view returns (string memory);\n\n /**\n * @notice Returns the contract URI.\n */\n function contractURI() external view returns (string memory);\n\n /**\n * @notice Returns the provenance hash.\n * The provenance hash is used for random reveals, which\n * is a hash of the ordered metadata to show it is unmodified\n * after mint has started.\n */\n function provenanceHash() external view returns (bytes32);\n}\n" }, "src/interfaces/IERC1155ContractMetadata.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {\n ISeaDropTokenContractMetadata\n} from \"./ISeaDropTokenContractMetadata.sol\";\n\ninterface IERC1155ContractMetadata is ISeaDropTokenContractMetadata {\n /**\n * @dev A struct representing the supply info for a token id,\n * packed into one storage slot.\n *\n * @param maxSupply The max supply for the token id.\n * @param totalSupply The total token supply for the token id.\n * Subtracted when an item is burned.\n * @param totalMinted The total number of tokens minted for the token id.\n */\n struct TokenSupply {\n uint64 maxSupply; // 64/256 bits\n uint64 totalSupply; // 128/256 bits\n uint64 totalMinted; // 192/256 bits\n }\n\n /**\n * @dev Emit an event when the max token supply for a token id is updated.\n */\n event MaxSupplyUpdated(uint256 tokenId, uint256 newMaxSupply);\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the max token\n * supply.\n */\n error MintExceedsMaxSupply(uint256 total, uint256 maxSupply);\n\n /**\n * @notice Sets the max supply for a token id and emits an event.\n *\n * @param tokenId The token id to set the max supply for.\n * @param newMaxSupply The new max supply to set.\n */\n function setMaxSupply(uint256 tokenId, uint256 newMaxSupply) external;\n\n /**\n * @notice Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @notice Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @notice Returns the max token supply for a token id.\n */\n function maxSupply(uint256 tokenId) external view returns (uint256);\n\n /**\n * @notice Returns the total supply for a token id.\n */\n function totalSupply(uint256 tokenId) external view returns (uint256);\n\n /**\n * @notice Returns the total minted for a token id.\n */\n function totalMinted(uint256 tokenId) external view returns (uint256);\n}\n" }, "src/interfaces/ICreatorToken.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\ninterface ICreatorToken {\n event TransferValidatorUpdated(address oldValidator, address newValidator);\n\n function getTransferValidator() external view returns (address validator);\n\n function getTransferValidationFunction()\n external\n view\n returns (bytes4 functionSignature, bool isViewFunction);\n\n function setTransferValidator(address validator) external;\n}\n\ninterface ILegacyCreatorToken {\n event TransferValidatorUpdated(address oldValidator, address newValidator);\n\n function getTransferValidator() external view returns (address validator);\n\n function setTransferValidator(address validator) external;\n}\n" }, "src/interfaces/ITransferValidator.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\ninterface ITransferValidator721 {\n /// @notice Ensure that a transfer has been authorized for a specific tokenId\n function validateTransfer(\n address caller,\n address from,\n address to,\n uint256 tokenId\n ) external view;\n}\n\ninterface ITransferValidator1155 {\n /// @notice Ensure that a transfer has been authorized for a specific amount of a specific tokenId, and reduce the transferable amount remaining\n function validateTransfer(\n address caller,\n address from,\n address to,\n uint256 tokenId,\n uint256 amount\n ) external;\n}\n" }, "src/lib/TokenTransferValidator.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.17;\n\nimport { ICreatorToken } from \"../interfaces/ICreatorToken.sol\";\n\n/**\n * @title TokenTransferValidator\n * @notice Functionality to use a transfer validator.\n */\nabstract contract TokenTransferValidator is ICreatorToken {\n /// @dev Store the transfer validator. The null address means no transfer validator is set.\n address internal _transferValidator;\n\n /// @notice Revert with an error if the transfer validator is being set to the same address.\n error SameTransferValidator();\n\n /// @notice Returns the currently active transfer validator.\n /// The null address means no transfer validator is set.\n function getTransferValidator() external view returns (address) {\n return _transferValidator;\n }\n\n /// @notice Set the transfer validator.\n /// The external method that uses this must include access control.\n function _setTransferValidator(address newValidator) internal {\n address oldValidator = _transferValidator;\n if (oldValidator == newValidator) {\n revert SameTransferValidator();\n }\n _transferValidator = newValidator;\n emit TransferValidatorUpdated(oldValidator, newValidator);\n }\n}\n" }, "lib/solady/src/tokens/ERC2981.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/// @notice Simple ERC2981 NFT Royalty Standard implementation.\n/// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC2981.sol)\n/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/common/ERC2981.sol)\nabstract contract ERC2981 {\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* CUSTOM ERRORS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The royalty fee numerator exceeds the fee denominator.\n error RoyaltyOverflow();\n\n /// @dev The royalty receiver cannot be the zero address.\n error RoyaltyReceiverIsZeroAddress();\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* STORAGE */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The default royalty info is given by:\n /// ```\n /// let packed := sload(_ERC2981_MASTER_SLOT_SEED)\n /// let receiver := shr(96, packed)\n /// let royaltyFraction := xor(packed, shl(96, receiver))\n /// ```\n ///\n /// The per token royalty info is given by.\n /// ```\n /// mstore(0x00, tokenId)\n /// mstore(0x20, _ERC2981_MASTER_SLOT_SEED)\n /// let packed := sload(keccak256(0x00, 0x40))\n /// let receiver := shr(96, packed)\n /// let royaltyFraction := xor(packed, shl(96, receiver))\n /// ```\n uint256 private constant _ERC2981_MASTER_SLOT_SEED = 0xaa4ec00224afccfdb7;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* ERC2981 */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Checks that `_feeDenominator` is non-zero.\n constructor() {\n require(_feeDenominator() != 0, \"Fee denominator cannot be zero.\");\n }\n\n /// @dev Returns the denominator for the royalty amount.\n /// Defaults to 10000, which represents fees in basis points.\n /// Override this function to return a custom amount if needed.\n function _feeDenominator() internal pure virtual returns (uint96) {\n return 10000;\n }\n\n /// @dev Returns true if this contract implements the interface defined by `interfaceId`.\n /// See: https://eips.ethereum.org/EIPS/eip-165\n /// This function call must use less than 30000 gas.\n function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) {\n /// @solidity memory-safe-assembly\n assembly {\n let s := shr(224, interfaceId)\n // ERC165: 0x01ffc9a7, ERC2981: 0x2a55205a.\n result := or(eq(s, 0x01ffc9a7), eq(s, 0x2a55205a))\n }\n }\n\n /// @dev Returns the `receiver` and `royaltyAmount` for `tokenId` sold at `salePrice`.\n function royaltyInfo(uint256 tokenId, uint256 salePrice)\n public\n view\n virtual\n returns (address receiver, uint256 royaltyAmount)\n {\n uint256 feeDenominator = _feeDenominator();\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, tokenId)\n mstore(0x20, _ERC2981_MASTER_SLOT_SEED)\n let packed := sload(keccak256(0x00, 0x40))\n receiver := shr(96, packed)\n if iszero(receiver) {\n packed := sload(mload(0x20))\n receiver := shr(96, packed)\n }\n let x := salePrice\n let y := xor(packed, shl(96, receiver)) // `feeNumerator`.\n // Overflow check, equivalent to `require(y == 0 || x <= type(uint256).max / y)`.\n // Out-of-gas revert. Should not be triggered in practice, but included for safety.\n returndatacopy(returndatasize(), returndatasize(), mul(y, gt(x, div(not(0), y))))\n royaltyAmount := div(mul(x, y), feeDenominator)\n }\n }\n\n /// @dev Sets the default royalty `receiver` and `feeNumerator`.\n ///\n /// Requirements:\n /// - `receiver` must not be the zero address.\n /// - `feeNumerator` must not be greater than the fee denominator.\n function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {\n uint256 feeDenominator = _feeDenominator();\n /// @solidity memory-safe-assembly\n assembly {\n feeNumerator := shr(160, shl(160, feeNumerator))\n if gt(feeNumerator, feeDenominator) {\n mstore(0x00, 0x350a88b3) // `RoyaltyOverflow()`.\n revert(0x1c, 0x04)\n }\n let packed := shl(96, receiver)\n if iszero(packed) {\n mstore(0x00, 0xb4457eaa) // `RoyaltyReceiverIsZeroAddress()`.\n revert(0x1c, 0x04)\n }\n sstore(_ERC2981_MASTER_SLOT_SEED, or(packed, feeNumerator))\n }\n }\n\n /// @dev Sets the default royalty `receiver` and `feeNumerator` to zero.\n function _deleteDefaultRoyalty() internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n sstore(_ERC2981_MASTER_SLOT_SEED, 0)\n }\n }\n\n /// @dev Sets the royalty `receiver` and `feeNumerator` for `tokenId`.\n ///\n /// Requirements:\n /// - `receiver` must not be the zero address.\n /// - `feeNumerator` must not be greater than the fee denominator.\n function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator)\n internal\n virtual\n {\n uint256 feeDenominator = _feeDenominator();\n /// @solidity memory-safe-assembly\n assembly {\n feeNumerator := shr(160, shl(160, feeNumerator))\n if gt(feeNumerator, feeDenominator) {\n mstore(0x00, 0x350a88b3) // `RoyaltyOverflow()`.\n revert(0x1c, 0x04)\n }\n let packed := shl(96, receiver)\n if iszero(packed) {\n mstore(0x00, 0xb4457eaa) // `RoyaltyReceiverIsZeroAddress()`.\n revert(0x1c, 0x04)\n }\n mstore(0x00, tokenId)\n mstore(0x20, _ERC2981_MASTER_SLOT_SEED)\n sstore(keccak256(0x00, 0x40), or(packed, feeNumerator))\n }\n }\n\n /// @dev Sets the royalty `receiver` and `feeNumerator` for `tokenId` to zero.\n function _resetTokenRoyalty(uint256 tokenId) internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, tokenId)\n mstore(0x20, _ERC2981_MASTER_SLOT_SEED)\n sstore(keccak256(0x00, 0x40), 0)\n }\n }\n}\n" }, "lib/solady/src/auth/Ownable.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\n/// @notice Simple single owner authorization mixin.\n/// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol)\n/// @dev While the ownable portion follows\n/// [EIP-173](https://eips.ethereum.org/EIPS/eip-173) for compatibility,\n/// the nomenclature for the 2-step ownership handover may be unique to this codebase.\nabstract contract Ownable {\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* CUSTOM ERRORS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The caller is not authorized to call the function.\n error Unauthorized();\n\n /// @dev The `newOwner` cannot be the zero address.\n error NewOwnerIsZeroAddress();\n\n /// @dev The `pendingOwner` does not have a valid handover request.\n error NoHandoverRequest();\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* EVENTS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The ownership is transferred from `oldOwner` to `newOwner`.\n /// This event is intentionally kept the same as OpenZeppelin's Ownable to be\n /// compatible with indexers and [EIP-173](https://eips.ethereum.org/EIPS/eip-173),\n /// despite it not being as lightweight as a single argument event.\n event OwnershipTransferred(address indexed oldOwner, address indexed newOwner);\n\n /// @dev An ownership handover to `pendingOwner` has been requested.\n event OwnershipHandoverRequested(address indexed pendingOwner);\n\n /// @dev The ownership handover to `pendingOwner` has been canceled.\n event OwnershipHandoverCanceled(address indexed pendingOwner);\n\n /// @dev `keccak256(bytes(\"OwnershipTransferred(address,address)\"))`.\n uint256 private constant _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE =\n 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0;\n\n /// @dev `keccak256(bytes(\"OwnershipHandoverRequested(address)\"))`.\n uint256 private constant _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE =\n 0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d;\n\n /// @dev `keccak256(bytes(\"OwnershipHandoverCanceled(address)\"))`.\n uint256 private constant _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE =\n 0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* STORAGE */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev The owner slot is given by: `not(_OWNER_SLOT_NOT)`.\n /// It is intentionally chosen to be a high value\n /// to avoid collision with lower slots.\n /// The choice of manual storage layout is to enable compatibility\n /// with both regular and upgradeable contracts.\n uint256 private constant _OWNER_SLOT_NOT = 0x8b78c6d8;\n\n /// The ownership handover slot of `newOwner` is given by:\n /// ```\n /// mstore(0x00, or(shl(96, user), _HANDOVER_SLOT_SEED))\n /// let handoverSlot := keccak256(0x00, 0x20)\n /// ```\n /// It stores the expiry timestamp of the two-step ownership handover.\n uint256 private constant _HANDOVER_SLOT_SEED = 0x389a75e1;\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* INTERNAL FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Initializes the owner directly without authorization guard.\n /// This function must be called upon initialization,\n /// regardless of whether the contract is upgradeable or not.\n /// This is to enable generalization to both regular and upgradeable contracts,\n /// and to save gas in case the initial owner is not the caller.\n /// For performance reasons, this function will not check if there\n /// is an existing owner.\n function _initializeOwner(address newOwner) internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // Clean the upper 96 bits.\n newOwner := shr(96, shl(96, newOwner))\n // Store the new value.\n sstore(not(_OWNER_SLOT_NOT), newOwner)\n // Emit the {OwnershipTransferred} event.\n log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner)\n }\n }\n\n /// @dev Sets the owner directly without authorization guard.\n function _setOwner(address newOwner) internal virtual {\n /// @solidity memory-safe-assembly\n assembly {\n let ownerSlot := not(_OWNER_SLOT_NOT)\n // Clean the upper 96 bits.\n newOwner := shr(96, shl(96, newOwner))\n // Emit the {OwnershipTransferred} event.\n log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner)\n // Store the new value.\n sstore(ownerSlot, newOwner)\n }\n }\n\n /// @dev Throws if the sender is not the owner.\n function _checkOwner() internal view virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // If the caller is not the stored owner, revert.\n if iszero(eq(caller(), sload(not(_OWNER_SLOT_NOT)))) {\n mstore(0x00, 0x82b42900) // `Unauthorized()`.\n revert(0x1c, 0x04)\n }\n }\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* PUBLIC UPDATE FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Allows the owner to transfer the ownership to `newOwner`.\n function transferOwnership(address newOwner) public payable virtual onlyOwner {\n /// @solidity memory-safe-assembly\n assembly {\n if iszero(shl(96, newOwner)) {\n mstore(0x00, 0x7448fbae) // `NewOwnerIsZeroAddress()`.\n revert(0x1c, 0x04)\n }\n }\n _setOwner(newOwner);\n }\n\n /// @dev Allows the owner to renounce their ownership.\n function renounceOwnership() public payable virtual onlyOwner {\n _setOwner(address(0));\n }\n\n /// @dev Request a two-step ownership handover to the caller.\n /// The request will automatically expire in 48 hours (172800 seconds) by default.\n function requestOwnershipHandover() public payable virtual {\n unchecked {\n uint256 expires = block.timestamp + ownershipHandoverValidFor();\n /// @solidity memory-safe-assembly\n assembly {\n // Compute and set the handover slot to `expires`.\n mstore(0x0c, _HANDOVER_SLOT_SEED)\n mstore(0x00, caller())\n sstore(keccak256(0x0c, 0x20), expires)\n // Emit the {OwnershipHandoverRequested} event.\n log2(0, 0, _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE, caller())\n }\n }\n }\n\n /// @dev Cancels the two-step ownership handover to the caller, if any.\n function cancelOwnershipHandover() public payable virtual {\n /// @solidity memory-safe-assembly\n assembly {\n // Compute and set the handover slot to 0.\n mstore(0x0c, _HANDOVER_SLOT_SEED)\n mstore(0x00, caller())\n sstore(keccak256(0x0c, 0x20), 0)\n // Emit the {OwnershipHandoverCanceled} event.\n log2(0, 0, _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE, caller())\n }\n }\n\n /// @dev Allows the owner to complete the two-step ownership handover to `pendingOwner`.\n /// Reverts if there is no existing ownership handover requested by `pendingOwner`.\n function completeOwnershipHandover(address pendingOwner) public payable virtual onlyOwner {\n /// @solidity memory-safe-assembly\n assembly {\n // Compute and set the handover slot to 0.\n mstore(0x0c, _HANDOVER_SLOT_SEED)\n mstore(0x00, pendingOwner)\n let handoverSlot := keccak256(0x0c, 0x20)\n // If the handover does not exist, or has expired.\n if gt(timestamp(), sload(handoverSlot)) {\n mstore(0x00, 0x6f5e8818) // `NoHandoverRequest()`.\n revert(0x1c, 0x04)\n }\n // Set the handover slot to 0.\n sstore(handoverSlot, 0)\n }\n _setOwner(pendingOwner);\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* PUBLIC READ FUNCTIONS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Returns the owner of the contract.\n function owner() public view virtual returns (address result) {\n /// @solidity memory-safe-assembly\n assembly {\n result := sload(not(_OWNER_SLOT_NOT))\n }\n }\n\n /// @dev Returns the expiry timestamp for the two-step ownership handover to `pendingOwner`.\n function ownershipHandoverExpiresAt(address pendingOwner)\n public\n view\n virtual\n returns (uint256 result)\n {\n /// @solidity memory-safe-assembly\n assembly {\n // Compute the handover slot.\n mstore(0x0c, _HANDOVER_SLOT_SEED)\n mstore(0x00, pendingOwner)\n // Load the handover slot.\n result := sload(keccak256(0x0c, 0x20))\n }\n }\n\n /// @dev Returns how long a two-step ownership handover is valid for in seconds.\n function ownershipHandoverValidFor() public view virtual returns (uint64) {\n return 48 * 3600;\n }\n\n /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/\n /* MODIFIERS */\n /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/\n\n /// @dev Marks a function as only callable by the owner.\n modifier onlyOwner() virtual {\n _checkOwner();\n _;\n }\n}\n" }, "lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.19;\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 * ```solidity\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\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) || (address(this).code.length == 0 && _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" }, "src/lib/SeaDropErrorsAndEvents.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { CreatorPayout, PublicDrop } from \"./ERC721SeaDropStructs.sol\";\n\ninterface SeaDropErrorsAndEvents {\n /**\n * @notice The SeaDrop token types, emitted as part of\n * `event SeaDropTokenDeployed`.\n */\n enum SEADROP_TOKEN_TYPE {\n ERC721_STANDARD,\n ERC721_CLONE,\n ERC721_UPGRADEABLE,\n ERC1155_STANDARD,\n ERC1155_CLONE,\n ERC1155_UPGRADEABLE\n }\n\n /**\n * @notice An event to signify that a SeaDrop token contract was deployed.\n */\n event SeaDropTokenDeployed(SEADROP_TOKEN_TYPE tokenType);\n\n /**\n * @notice Revert with an error if the function selector is not supported.\n */\n error UnsupportedFunctionSelector(bytes4 selector);\n\n /**\n * @dev Revert with an error if the drop stage is not active.\n */\n error NotActive(\n uint256 currentTimestamp,\n uint256 startTimestamp,\n uint256 endTimestamp\n );\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the max allowed\n * to be minted per wallet.\n */\n error MintQuantityExceedsMaxMintedPerWallet(uint256 total, uint256 allowed);\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the max token\n * supply.\n */\n error MintQuantityExceedsMaxSupply(uint256 total, uint256 maxSupply);\n\n /**\n * @dev Revert with an error if the mint quantity exceeds the max token\n * supply for the stage.\n * Note: The `maxTokenSupplyForStage` for public mint is\n * always `type(uint).max`.\n */\n error MintQuantityExceedsMaxTokenSupplyForStage(\n uint256 total,\n uint256 maxTokenSupplyForStage\n );\n\n /**\n * @dev Revert if the fee recipient is the zero address.\n */\n error FeeRecipientCannotBeZeroAddress();\n\n /**\n * @dev Revert if the fee recipient is not already included.\n */\n error FeeRecipientNotPresent();\n\n /**\n * @dev Revert if the fee basis points is greater than 10_000.\n */\n error InvalidFeeBps(uint256 feeBps);\n\n /**\n * @dev Revert if the fee recipient is already included.\n */\n error DuplicateFeeRecipient();\n\n /**\n * @dev Revert if the fee recipient is restricted and not allowed.\n */\n error FeeRecipientNotAllowed(address got);\n\n /**\n * @dev Revert if the creator payout address is the zero address.\n */\n error CreatorPayoutAddressCannotBeZeroAddress();\n\n /**\n * @dev Revert if the creator payouts are not set.\n */\n error CreatorPayoutsNotSet();\n\n /**\n * @dev Revert if the creator payout basis points are zero.\n */\n error CreatorPayoutBasisPointsCannotBeZero();\n\n /**\n * @dev Revert if the total basis points for the creator payouts\n * don't equal exactly 10_000.\n */\n error InvalidCreatorPayoutTotalBasisPoints(\n uint256 totalReceivedBasisPoints\n );\n\n /**\n * @dev Revert if the creator payout basis points don't add up to 10_000.\n */\n error InvalidCreatorPayoutBasisPoints(uint256 totalReceivedBasisPoints);\n\n /**\n * @dev Revert with an error if the allow list proof is invalid.\n */\n error InvalidProof();\n\n /**\n * @dev Revert if a supplied signer address is the zero address.\n */\n error SignerCannotBeZeroAddress();\n\n /**\n * @dev Revert with an error if a signer is not included in\n * the enumeration when removing.\n */\n error SignerNotPresent();\n\n /**\n * @dev Revert with an error if a payer is not included in\n * the enumeration when removing.\n */\n error PayerNotPresent();\n\n /**\n * @dev Revert with an error if a payer is already included in mapping\n * when adding.\n */\n error DuplicatePayer();\n\n /**\n * @dev Revert with an error if a signer is already included in mapping\n * when adding.\n */\n error DuplicateSigner();\n\n /**\n * @dev Revert with an error if the payer is not allowed. The minter must\n * pay for their own mint.\n */\n error PayerNotAllowed(address got);\n\n /**\n * @dev Revert if a supplied payer address is the zero address.\n */\n error PayerCannotBeZeroAddress();\n\n /**\n * @dev Revert if the start time is greater than the end time.\n */\n error InvalidStartAndEndTime(uint256 startTime, uint256 endTime);\n\n /**\n * @dev Revert with an error if the signer payment token is not the same.\n */\n error InvalidSignedPaymentToken(address got, address want);\n\n /**\n * @dev Revert with an error if supplied signed mint price is less than\n * the minimum specified.\n */\n error InvalidSignedMintPrice(\n address paymentToken,\n uint256 got,\n uint256 minimum\n );\n\n /**\n * @dev Revert with an error if supplied signed maxTotalMintableByWallet\n * is greater than the maximum specified.\n */\n error InvalidSignedMaxTotalMintableByWallet(uint256 got, uint256 maximum);\n\n /**\n * @dev Revert with an error if supplied signed\n * maxTotalMintableByWalletPerToken is greater than the maximum\n * specified.\n */\n error InvalidSignedMaxTotalMintableByWalletPerToken(\n uint256 got,\n uint256 maximum\n );\n\n /**\n * @dev Revert with an error if the fromTokenId is not within range.\n */\n error InvalidSignedFromTokenId(uint256 got, uint256 minimum);\n\n /**\n * @dev Revert with an error if the toTokenId is not within range.\n */\n error InvalidSignedToTokenId(uint256 got, uint256 maximum);\n\n /**\n * @dev Revert with an error if supplied signed start time is less than\n * the minimum specified.\n */\n error InvalidSignedStartTime(uint256 got, uint256 minimum);\n\n /**\n * @dev Revert with an error if supplied signed end time is greater than\n * the maximum specified.\n */\n error InvalidSignedEndTime(uint256 got, uint256 maximum);\n\n /**\n * @dev Revert with an error if supplied signed maxTokenSupplyForStage\n * is greater than the maximum specified.\n */\n error InvalidSignedMaxTokenSupplyForStage(uint256 got, uint256 maximum);\n\n /**\n * @dev Revert with an error if supplied signed feeBps is greater than\n * the maximum specified, or less than the minimum.\n */\n error InvalidSignedFeeBps(uint256 got, uint256 minimumOrMaximum);\n\n /**\n * @dev Revert with an error if signed mint did not specify to restrict\n * fee recipients.\n */\n error SignedMintsMustRestrictFeeRecipients();\n\n /**\n * @dev Revert with an error if a signature for a signed mint has already\n * been used.\n */\n error SignatureAlreadyUsed();\n\n /**\n * @dev Revert with an error if the contract has no balance to withdraw.\n */\n error NoBalanceToWithdraw();\n\n /**\n * @dev Revert with an error if the caller is not an allowed Seaport.\n */\n error InvalidCallerOnlyAllowedSeaport(address caller);\n\n /**\n * @dev Revert with an error if the order does not have the ERC1155 magic\n * consideration item to signify a consecutive mint.\n */\n error MustSpecifyERC1155ConsiderationItemForSeaDropMint();\n\n /**\n * @dev Revert with an error if the extra data version is not supported.\n */\n error UnsupportedExtraDataVersion(uint8 version);\n\n /**\n * @dev Revert with an error if the extra data encoding is not supported.\n */\n error InvalidExtraDataEncoding(uint8 version);\n\n /**\n * @dev Revert with an error if the provided substandard is not supported.\n */\n error InvalidSubstandard(uint8 substandard);\n\n /**\n * @dev Revert with an error if the implementation contract is called without\n * delegatecall.\n */\n error OnlyDelegateCalled();\n\n /**\n * @dev Revert with an error if the provided allowed Seaport is the\n * zero address.\n */\n error AllowedSeaportCannotBeZeroAddress();\n\n /**\n * @dev Emit an event when allowed Seaport contracts are updated.\n */\n event AllowedSeaportUpdated(address[] allowedSeaport);\n\n /**\n * @dev An event with details of a SeaDrop mint, for analytical purposes.\n *\n * @param payer The address who payed for the tx.\n * @param dropStageIndex The drop stage index. Items minted through\n * public mint have dropStageIndex of 0\n */\n event SeaDropMint(address payer, uint256 dropStageIndex);\n\n /**\n * @dev An event with updated allow list data.\n *\n * @param previousMerkleRoot The previous allow list merkle root.\n * @param newMerkleRoot The new allow list merkle root.\n * @param publicKeyURI If the allow list is encrypted, the public key\n * URIs that can decrypt the list.\n * Empty if unencrypted.\n * @param allowListURI The URI for the allow list.\n */\n event AllowListUpdated(\n bytes32 indexed previousMerkleRoot,\n bytes32 indexed newMerkleRoot,\n string[] publicKeyURI,\n string allowListURI\n );\n\n /**\n * @dev An event with updated drop URI.\n */\n event DropURIUpdated(string newDropURI);\n\n /**\n * @dev An event with the updated creator payout address.\n */\n event CreatorPayoutsUpdated(CreatorPayout[] creatorPayouts);\n\n /**\n * @dev An event with the updated allowed fee recipient.\n */\n event AllowedFeeRecipientUpdated(\n address indexed feeRecipient,\n bool indexed allowed\n );\n\n /**\n * @dev An event with the updated signer.\n */\n event SignerUpdated(address indexed signer, bool indexed allowed);\n\n /**\n * @dev An event with the updated payer.\n */\n event PayerUpdated(address indexed payer, bool indexed allowed);\n}\n" }, "lib/seaport/lib/seaport-types/src/lib/ConsiderationEnums.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nenum OrderType {\n // 0: no partial fills, anyone can execute\n FULL_OPEN,\n\n // 1: partial fills supported, anyone can execute\n PARTIAL_OPEN,\n\n // 2: no partial fills, only offerer or zone can execute\n FULL_RESTRICTED,\n\n // 3: partial fills supported, only offerer or zone can execute\n PARTIAL_RESTRICTED,\n\n // 4: contract order type\n CONTRACT\n}\n\nenum BasicOrderType {\n // 0: no partial fills, anyone can execute\n ETH_TO_ERC721_FULL_OPEN,\n\n // 1: partial fills supported, anyone can execute\n ETH_TO_ERC721_PARTIAL_OPEN,\n\n // 2: no partial fills, only offerer or zone can execute\n ETH_TO_ERC721_FULL_RESTRICTED,\n\n // 3: partial fills supported, only offerer or zone can execute\n ETH_TO_ERC721_PARTIAL_RESTRICTED,\n\n // 4: no partial fills, anyone can execute\n ETH_TO_ERC1155_FULL_OPEN,\n\n // 5: partial fills supported, anyone can execute\n ETH_TO_ERC1155_PARTIAL_OPEN,\n\n // 6: no partial fills, only offerer or zone can execute\n ETH_TO_ERC1155_FULL_RESTRICTED,\n\n // 7: partial fills supported, only offerer or zone can execute\n ETH_TO_ERC1155_PARTIAL_RESTRICTED,\n\n // 8: no partial fills, anyone can execute\n ERC20_TO_ERC721_FULL_OPEN,\n\n // 9: partial fills supported, anyone can execute\n ERC20_TO_ERC721_PARTIAL_OPEN,\n\n // 10: no partial fills, only offerer or zone can execute\n ERC20_TO_ERC721_FULL_RESTRICTED,\n\n // 11: partial fills supported, only offerer or zone can execute\n ERC20_TO_ERC721_PARTIAL_RESTRICTED,\n\n // 12: no partial fills, anyone can execute\n ERC20_TO_ERC1155_FULL_OPEN,\n\n // 13: partial fills supported, anyone can execute\n ERC20_TO_ERC1155_PARTIAL_OPEN,\n\n // 14: no partial fills, only offerer or zone can execute\n ERC20_TO_ERC1155_FULL_RESTRICTED,\n\n // 15: partial fills supported, only offerer or zone can execute\n ERC20_TO_ERC1155_PARTIAL_RESTRICTED,\n\n // 16: no partial fills, anyone can execute\n ERC721_TO_ERC20_FULL_OPEN,\n\n // 17: partial fills supported, anyone can execute\n ERC721_TO_ERC20_PARTIAL_OPEN,\n\n // 18: no partial fills, only offerer or zone can execute\n ERC721_TO_ERC20_FULL_RESTRICTED,\n\n // 19: partial fills supported, only offerer or zone can execute\n ERC721_TO_ERC20_PARTIAL_RESTRICTED,\n\n // 20: no partial fills, anyone can execute\n ERC1155_TO_ERC20_FULL_OPEN,\n\n // 21: partial fills supported, anyone can execute\n ERC1155_TO_ERC20_PARTIAL_OPEN,\n\n // 22: no partial fills, only offerer or zone can execute\n ERC1155_TO_ERC20_FULL_RESTRICTED,\n\n // 23: partial fills supported, only offerer or zone can execute\n ERC1155_TO_ERC20_PARTIAL_RESTRICTED\n}\n\nenum BasicOrderRouteType {\n // 0: provide Ether (or other native token) to receive offered ERC721 item.\n ETH_TO_ERC721,\n\n // 1: provide Ether (or other native token) to receive offered ERC1155 item.\n ETH_TO_ERC1155,\n\n // 2: provide ERC20 item to receive offered ERC721 item.\n ERC20_TO_ERC721,\n\n // 3: provide ERC20 item to receive offered ERC1155 item.\n ERC20_TO_ERC1155,\n\n // 4: provide ERC721 item to receive offered ERC20 item.\n ERC721_TO_ERC20,\n\n // 5: provide ERC1155 item to receive offered ERC20 item.\n ERC1155_TO_ERC20\n}\n\nenum ItemType {\n // 0: ETH on mainnet, MATIC on polygon, etc.\n NATIVE,\n\n // 1: ERC20 items (ERC777 and ERC20 analogues could also technically work)\n ERC20,\n\n // 2: ERC721 items\n ERC721,\n\n // 3: ERC1155 items\n ERC1155,\n\n // 4: ERC721 items where a number of tokenIds are supported\n ERC721_WITH_CRITERIA,\n\n // 5: ERC1155 items where a number of ids are supported\n ERC1155_WITH_CRITERIA\n}\n\nenum Side {\n // 0: Items that can be spent\n OFFER,\n\n // 1: Items that must be received\n CONSIDERATION\n}\n" }, "lib/seaport/lib/seaport-types/src/helpers/PointerLibraries.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\ntype CalldataPointer is uint256;\n\ntype ReturndataPointer is uint256;\n\ntype MemoryPointer is uint256;\n\nusing CalldataPointerLib for CalldataPointer global;\nusing MemoryPointerLib for MemoryPointer global;\nusing ReturndataPointerLib for ReturndataPointer global;\n\nusing CalldataReaders for CalldataPointer global;\nusing ReturndataReaders for ReturndataPointer global;\nusing MemoryReaders for MemoryPointer global;\nusing MemoryWriters for MemoryPointer global;\n\nCalldataPointer constant CalldataStart = CalldataPointer.wrap(0x04);\nMemoryPointer constant FreeMemoryPPtr = MemoryPointer.wrap(0x40);\nuint256 constant IdentityPrecompileAddress = 0x4;\nuint256 constant OffsetOrLengthMask = 0xffffffff;\nuint256 constant _OneWord = 0x20;\nuint256 constant _FreeMemoryPointerSlot = 0x40;\n\n/// @dev Allocates `size` bytes in memory by increasing the free memory pointer\n/// and returns the memory pointer to the first byte of the allocated region.\n// (Free functions cannot have visibility.)\n// solhint-disable-next-line func-visibility\nfunction malloc(uint256 size) pure returns (MemoryPointer mPtr) {\n assembly {\n mPtr := mload(_FreeMemoryPointerSlot)\n mstore(_FreeMemoryPointerSlot, add(mPtr, size))\n }\n}\n\n// (Free functions cannot have visibility.)\n// solhint-disable-next-line func-visibility\nfunction getFreeMemoryPointer() pure returns (MemoryPointer mPtr) {\n mPtr = FreeMemoryPPtr.readMemoryPointer();\n}\n\n// (Free functions cannot have visibility.)\n// solhint-disable-next-line func-visibility\nfunction setFreeMemoryPointer(MemoryPointer mPtr) pure {\n FreeMemoryPPtr.write(mPtr);\n}\n\nlibrary CalldataPointerLib {\n function lt(\n CalldataPointer a,\n CalldataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := lt(a, b)\n }\n }\n\n function gt(\n CalldataPointer a,\n CalldataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := gt(a, b)\n }\n }\n\n function eq(\n CalldataPointer a,\n CalldataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := eq(a, b)\n }\n }\n\n function isNull(CalldataPointer a) internal pure returns (bool b) {\n assembly {\n b := iszero(a)\n }\n }\n\n /// @dev Resolves an offset stored at `cdPtr + headOffset` to a calldata.\n /// pointer `cdPtr` must point to some parent object with a dynamic\n /// type's head stored at `cdPtr + headOffset`.\n function pptr(\n CalldataPointer cdPtr,\n uint256 headOffset\n ) internal pure returns (CalldataPointer cdPtrChild) {\n cdPtrChild = cdPtr.offset(\n cdPtr.offset(headOffset).readUint256() & OffsetOrLengthMask\n );\n }\n\n /// @dev Resolves an offset stored at `cdPtr` to a calldata pointer.\n /// `cdPtr` must point to some parent object with a dynamic type as its\n /// first member, e.g. `struct { bytes data; }`\n function pptr(\n CalldataPointer cdPtr\n ) internal pure returns (CalldataPointer cdPtrChild) {\n cdPtrChild = cdPtr.offset(cdPtr.readUint256() & OffsetOrLengthMask);\n }\n\n /// @dev Returns the calldata pointer one word after `cdPtr`.\n function next(\n CalldataPointer cdPtr\n ) internal pure returns (CalldataPointer cdPtrNext) {\n assembly {\n cdPtrNext := add(cdPtr, _OneWord)\n }\n }\n\n /// @dev Returns the calldata pointer `_offset` bytes after `cdPtr`.\n function offset(\n CalldataPointer cdPtr,\n uint256 _offset\n ) internal pure returns (CalldataPointer cdPtrNext) {\n assembly {\n cdPtrNext := add(cdPtr, _offset)\n }\n }\n\n /// @dev Copies `size` bytes from calldata starting at `src` to memory at\n /// `dst`.\n function copy(\n CalldataPointer src,\n MemoryPointer dst,\n uint256 size\n ) internal pure {\n assembly {\n calldatacopy(dst, src, size)\n }\n }\n}\n\nlibrary ReturndataPointerLib {\n function lt(\n ReturndataPointer a,\n ReturndataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := lt(a, b)\n }\n }\n\n function gt(\n ReturndataPointer a,\n ReturndataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := gt(a, b)\n }\n }\n\n function eq(\n ReturndataPointer a,\n ReturndataPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := eq(a, b)\n }\n }\n\n function isNull(ReturndataPointer a) internal pure returns (bool b) {\n assembly {\n b := iszero(a)\n }\n }\n\n /// @dev Resolves an offset stored at `rdPtr + headOffset` to a returndata\n /// pointer. `rdPtr` must point to some parent object with a dynamic\n /// type's head stored at `rdPtr + headOffset`.\n function pptr(\n ReturndataPointer rdPtr,\n uint256 headOffset\n ) internal pure returns (ReturndataPointer rdPtrChild) {\n rdPtrChild = rdPtr.offset(\n rdPtr.offset(headOffset).readUint256() & OffsetOrLengthMask\n );\n }\n\n /// @dev Resolves an offset stored at `rdPtr` to a returndata pointer.\n /// `rdPtr` must point to some parent object with a dynamic type as its\n /// first member, e.g. `struct { bytes data; }`\n function pptr(\n ReturndataPointer rdPtr\n ) internal pure returns (ReturndataPointer rdPtrChild) {\n rdPtrChild = rdPtr.offset(rdPtr.readUint256() & OffsetOrLengthMask);\n }\n\n /// @dev Returns the returndata pointer one word after `cdPtr`.\n function next(\n ReturndataPointer rdPtr\n ) internal pure returns (ReturndataPointer rdPtrNext) {\n assembly {\n rdPtrNext := add(rdPtr, _OneWord)\n }\n }\n\n /// @dev Returns the returndata pointer `_offset` bytes after `cdPtr`.\n function offset(\n ReturndataPointer rdPtr,\n uint256 _offset\n ) internal pure returns (ReturndataPointer rdPtrNext) {\n assembly {\n rdPtrNext := add(rdPtr, _offset)\n }\n }\n\n /// @dev Copies `size` bytes from returndata starting at `src` to memory at\n /// `dst`.\n function copy(\n ReturndataPointer src,\n MemoryPointer dst,\n uint256 size\n ) internal pure {\n assembly {\n returndatacopy(dst, src, size)\n }\n }\n}\n\nlibrary MemoryPointerLib {\n function copy(\n MemoryPointer src,\n MemoryPointer dst,\n uint256 size\n ) internal view {\n assembly {\n let success := staticcall(\n gas(),\n IdentityPrecompileAddress,\n src,\n size,\n dst,\n size\n )\n if or(iszero(returndatasize()), iszero(success)) {\n revert(0, 0)\n }\n }\n }\n\n function lt(\n MemoryPointer a,\n MemoryPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := lt(a, b)\n }\n }\n\n function gt(\n MemoryPointer a,\n MemoryPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := gt(a, b)\n }\n }\n\n function eq(\n MemoryPointer a,\n MemoryPointer b\n ) internal pure returns (bool c) {\n assembly {\n c := eq(a, b)\n }\n }\n\n function isNull(MemoryPointer a) internal pure returns (bool b) {\n assembly {\n b := iszero(a)\n }\n }\n\n function hash(\n MemoryPointer ptr,\n uint256 length\n ) internal pure returns (bytes32 _hash) {\n assembly {\n _hash := keccak256(ptr, length)\n }\n }\n\n /// @dev Returns the memory pointer one word after `mPtr`.\n function next(\n MemoryPointer mPtr\n ) internal pure returns (MemoryPointer mPtrNext) {\n assembly {\n mPtrNext := add(mPtr, _OneWord)\n }\n }\n\n /// @dev Returns the memory pointer `_offset` bytes after `mPtr`.\n function offset(\n MemoryPointer mPtr,\n uint256 _offset\n ) internal pure returns (MemoryPointer mPtrNext) {\n assembly {\n mPtrNext := add(mPtr, _offset)\n }\n }\n\n /// @dev Resolves a pointer at `mPtr + headOffset` to a memory\n /// pointer. `mPtr` must point to some parent object with a dynamic\n /// type's pointer stored at `mPtr + headOffset`.\n function pptr(\n MemoryPointer mPtr,\n uint256 headOffset\n ) internal pure returns (MemoryPointer mPtrChild) {\n mPtrChild = mPtr.offset(headOffset).readMemoryPointer();\n }\n\n /// @dev Resolves a pointer stored at `mPtr` to a memory pointer.\n /// `mPtr` must point to some parent object with a dynamic type as its\n /// first member, e.g. `struct { bytes data; }`\n function pptr(\n MemoryPointer mPtr\n ) internal pure returns (MemoryPointer mPtrChild) {\n mPtrChild = mPtr.readMemoryPointer();\n }\n}\n\nlibrary CalldataReaders {\n /// @dev Reads the value at `cdPtr` and applies a mask to return only the\n /// last 4 bytes.\n function readMaskedUint256(\n CalldataPointer cdPtr\n ) internal pure returns (uint256 value) {\n value = cdPtr.readUint256() & OffsetOrLengthMask;\n }\n\n /// @dev Reads the bool at `cdPtr` in calldata.\n function readBool(\n CalldataPointer cdPtr\n ) internal pure returns (bool value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the address at `cdPtr` in calldata.\n function readAddress(\n CalldataPointer cdPtr\n ) internal pure returns (address value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes1 at `cdPtr` in calldata.\n function readBytes1(\n CalldataPointer cdPtr\n ) internal pure returns (bytes1 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes2 at `cdPtr` in calldata.\n function readBytes2(\n CalldataPointer cdPtr\n ) internal pure returns (bytes2 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes3 at `cdPtr` in calldata.\n function readBytes3(\n CalldataPointer cdPtr\n ) internal pure returns (bytes3 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes4 at `cdPtr` in calldata.\n function readBytes4(\n CalldataPointer cdPtr\n ) internal pure returns (bytes4 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes5 at `cdPtr` in calldata.\n function readBytes5(\n CalldataPointer cdPtr\n ) internal pure returns (bytes5 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes6 at `cdPtr` in calldata.\n function readBytes6(\n CalldataPointer cdPtr\n ) internal pure returns (bytes6 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes7 at `cdPtr` in calldata.\n function readBytes7(\n CalldataPointer cdPtr\n ) internal pure returns (bytes7 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes8 at `cdPtr` in calldata.\n function readBytes8(\n CalldataPointer cdPtr\n ) internal pure returns (bytes8 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes9 at `cdPtr` in calldata.\n function readBytes9(\n CalldataPointer cdPtr\n ) internal pure returns (bytes9 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes10 at `cdPtr` in calldata.\n function readBytes10(\n CalldataPointer cdPtr\n ) internal pure returns (bytes10 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes11 at `cdPtr` in calldata.\n function readBytes11(\n CalldataPointer cdPtr\n ) internal pure returns (bytes11 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes12 at `cdPtr` in calldata.\n function readBytes12(\n CalldataPointer cdPtr\n ) internal pure returns (bytes12 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes13 at `cdPtr` in calldata.\n function readBytes13(\n CalldataPointer cdPtr\n ) internal pure returns (bytes13 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes14 at `cdPtr` in calldata.\n function readBytes14(\n CalldataPointer cdPtr\n ) internal pure returns (bytes14 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes15 at `cdPtr` in calldata.\n function readBytes15(\n CalldataPointer cdPtr\n ) internal pure returns (bytes15 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes16 at `cdPtr` in calldata.\n function readBytes16(\n CalldataPointer cdPtr\n ) internal pure returns (bytes16 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes17 at `cdPtr` in calldata.\n function readBytes17(\n CalldataPointer cdPtr\n ) internal pure returns (bytes17 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes18 at `cdPtr` in calldata.\n function readBytes18(\n CalldataPointer cdPtr\n ) internal pure returns (bytes18 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes19 at `cdPtr` in calldata.\n function readBytes19(\n CalldataPointer cdPtr\n ) internal pure returns (bytes19 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes20 at `cdPtr` in calldata.\n function readBytes20(\n CalldataPointer cdPtr\n ) internal pure returns (bytes20 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes21 at `cdPtr` in calldata.\n function readBytes21(\n CalldataPointer cdPtr\n ) internal pure returns (bytes21 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes22 at `cdPtr` in calldata.\n function readBytes22(\n CalldataPointer cdPtr\n ) internal pure returns (bytes22 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes23 at `cdPtr` in calldata.\n function readBytes23(\n CalldataPointer cdPtr\n ) internal pure returns (bytes23 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes24 at `cdPtr` in calldata.\n function readBytes24(\n CalldataPointer cdPtr\n ) internal pure returns (bytes24 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes25 at `cdPtr` in calldata.\n function readBytes25(\n CalldataPointer cdPtr\n ) internal pure returns (bytes25 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes26 at `cdPtr` in calldata.\n function readBytes26(\n CalldataPointer cdPtr\n ) internal pure returns (bytes26 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes27 at `cdPtr` in calldata.\n function readBytes27(\n CalldataPointer cdPtr\n ) internal pure returns (bytes27 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes28 at `cdPtr` in calldata.\n function readBytes28(\n CalldataPointer cdPtr\n ) internal pure returns (bytes28 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes29 at `cdPtr` in calldata.\n function readBytes29(\n CalldataPointer cdPtr\n ) internal pure returns (bytes29 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes30 at `cdPtr` in calldata.\n function readBytes30(\n CalldataPointer cdPtr\n ) internal pure returns (bytes30 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes31 at `cdPtr` in calldata.\n function readBytes31(\n CalldataPointer cdPtr\n ) internal pure returns (bytes31 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the bytes32 at `cdPtr` in calldata.\n function readBytes32(\n CalldataPointer cdPtr\n ) internal pure returns (bytes32 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint8 at `cdPtr` in calldata.\n function readUint8(\n CalldataPointer cdPtr\n ) internal pure returns (uint8 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint16 at `cdPtr` in calldata.\n function readUint16(\n CalldataPointer cdPtr\n ) internal pure returns (uint16 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint24 at `cdPtr` in calldata.\n function readUint24(\n CalldataPointer cdPtr\n ) internal pure returns (uint24 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint32 at `cdPtr` in calldata.\n function readUint32(\n CalldataPointer cdPtr\n ) internal pure returns (uint32 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint40 at `cdPtr` in calldata.\n function readUint40(\n CalldataPointer cdPtr\n ) internal pure returns (uint40 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint48 at `cdPtr` in calldata.\n function readUint48(\n CalldataPointer cdPtr\n ) internal pure returns (uint48 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint56 at `cdPtr` in calldata.\n function readUint56(\n CalldataPointer cdPtr\n ) internal pure returns (uint56 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint64 at `cdPtr` in calldata.\n function readUint64(\n CalldataPointer cdPtr\n ) internal pure returns (uint64 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint72 at `cdPtr` in calldata.\n function readUint72(\n CalldataPointer cdPtr\n ) internal pure returns (uint72 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint80 at `cdPtr` in calldata.\n function readUint80(\n CalldataPointer cdPtr\n ) internal pure returns (uint80 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint88 at `cdPtr` in calldata.\n function readUint88(\n CalldataPointer cdPtr\n ) internal pure returns (uint88 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint96 at `cdPtr` in calldata.\n function readUint96(\n CalldataPointer cdPtr\n ) internal pure returns (uint96 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint104 at `cdPtr` in calldata.\n function readUint104(\n CalldataPointer cdPtr\n ) internal pure returns (uint104 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint112 at `cdPtr` in calldata.\n function readUint112(\n CalldataPointer cdPtr\n ) internal pure returns (uint112 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint120 at `cdPtr` in calldata.\n function readUint120(\n CalldataPointer cdPtr\n ) internal pure returns (uint120 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint128 at `cdPtr` in calldata.\n function readUint128(\n CalldataPointer cdPtr\n ) internal pure returns (uint128 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint136 at `cdPtr` in calldata.\n function readUint136(\n CalldataPointer cdPtr\n ) internal pure returns (uint136 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint144 at `cdPtr` in calldata.\n function readUint144(\n CalldataPointer cdPtr\n ) internal pure returns (uint144 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint152 at `cdPtr` in calldata.\n function readUint152(\n CalldataPointer cdPtr\n ) internal pure returns (uint152 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint160 at `cdPtr` in calldata.\n function readUint160(\n CalldataPointer cdPtr\n ) internal pure returns (uint160 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint168 at `cdPtr` in calldata.\n function readUint168(\n CalldataPointer cdPtr\n ) internal pure returns (uint168 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint176 at `cdPtr` in calldata.\n function readUint176(\n CalldataPointer cdPtr\n ) internal pure returns (uint176 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint184 at `cdPtr` in calldata.\n function readUint184(\n CalldataPointer cdPtr\n ) internal pure returns (uint184 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint192 at `cdPtr` in calldata.\n function readUint192(\n CalldataPointer cdPtr\n ) internal pure returns (uint192 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint200 at `cdPtr` in calldata.\n function readUint200(\n CalldataPointer cdPtr\n ) internal pure returns (uint200 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint208 at `cdPtr` in calldata.\n function readUint208(\n CalldataPointer cdPtr\n ) internal pure returns (uint208 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint216 at `cdPtr` in calldata.\n function readUint216(\n CalldataPointer cdPtr\n ) internal pure returns (uint216 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint224 at `cdPtr` in calldata.\n function readUint224(\n CalldataPointer cdPtr\n ) internal pure returns (uint224 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint232 at `cdPtr` in calldata.\n function readUint232(\n CalldataPointer cdPtr\n ) internal pure returns (uint232 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint240 at `cdPtr` in calldata.\n function readUint240(\n CalldataPointer cdPtr\n ) internal pure returns (uint240 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint248 at `cdPtr` in calldata.\n function readUint248(\n CalldataPointer cdPtr\n ) internal pure returns (uint248 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the uint256 at `cdPtr` in calldata.\n function readUint256(\n CalldataPointer cdPtr\n ) internal pure returns (uint256 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int8 at `cdPtr` in calldata.\n function readInt8(\n CalldataPointer cdPtr\n ) internal pure returns (int8 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int16 at `cdPtr` in calldata.\n function readInt16(\n CalldataPointer cdPtr\n ) internal pure returns (int16 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int24 at `cdPtr` in calldata.\n function readInt24(\n CalldataPointer cdPtr\n ) internal pure returns (int24 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int32 at `cdPtr` in calldata.\n function readInt32(\n CalldataPointer cdPtr\n ) internal pure returns (int32 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int40 at `cdPtr` in calldata.\n function readInt40(\n CalldataPointer cdPtr\n ) internal pure returns (int40 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int48 at `cdPtr` in calldata.\n function readInt48(\n CalldataPointer cdPtr\n ) internal pure returns (int48 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int56 at `cdPtr` in calldata.\n function readInt56(\n CalldataPointer cdPtr\n ) internal pure returns (int56 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int64 at `cdPtr` in calldata.\n function readInt64(\n CalldataPointer cdPtr\n ) internal pure returns (int64 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int72 at `cdPtr` in calldata.\n function readInt72(\n CalldataPointer cdPtr\n ) internal pure returns (int72 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int80 at `cdPtr` in calldata.\n function readInt80(\n CalldataPointer cdPtr\n ) internal pure returns (int80 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int88 at `cdPtr` in calldata.\n function readInt88(\n CalldataPointer cdPtr\n ) internal pure returns (int88 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int96 at `cdPtr` in calldata.\n function readInt96(\n CalldataPointer cdPtr\n ) internal pure returns (int96 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int104 at `cdPtr` in calldata.\n function readInt104(\n CalldataPointer cdPtr\n ) internal pure returns (int104 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int112 at `cdPtr` in calldata.\n function readInt112(\n CalldataPointer cdPtr\n ) internal pure returns (int112 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int120 at `cdPtr` in calldata.\n function readInt120(\n CalldataPointer cdPtr\n ) internal pure returns (int120 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int128 at `cdPtr` in calldata.\n function readInt128(\n CalldataPointer cdPtr\n ) internal pure returns (int128 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int136 at `cdPtr` in calldata.\n function readInt136(\n CalldataPointer cdPtr\n ) internal pure returns (int136 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int144 at `cdPtr` in calldata.\n function readInt144(\n CalldataPointer cdPtr\n ) internal pure returns (int144 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int152 at `cdPtr` in calldata.\n function readInt152(\n CalldataPointer cdPtr\n ) internal pure returns (int152 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int160 at `cdPtr` in calldata.\n function readInt160(\n CalldataPointer cdPtr\n ) internal pure returns (int160 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int168 at `cdPtr` in calldata.\n function readInt168(\n CalldataPointer cdPtr\n ) internal pure returns (int168 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int176 at `cdPtr` in calldata.\n function readInt176(\n CalldataPointer cdPtr\n ) internal pure returns (int176 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int184 at `cdPtr` in calldata.\n function readInt184(\n CalldataPointer cdPtr\n ) internal pure returns (int184 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int192 at `cdPtr` in calldata.\n function readInt192(\n CalldataPointer cdPtr\n ) internal pure returns (int192 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int200 at `cdPtr` in calldata.\n function readInt200(\n CalldataPointer cdPtr\n ) internal pure returns (int200 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int208 at `cdPtr` in calldata.\n function readInt208(\n CalldataPointer cdPtr\n ) internal pure returns (int208 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int216 at `cdPtr` in calldata.\n function readInt216(\n CalldataPointer cdPtr\n ) internal pure returns (int216 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int224 at `cdPtr` in calldata.\n function readInt224(\n CalldataPointer cdPtr\n ) internal pure returns (int224 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int232 at `cdPtr` in calldata.\n function readInt232(\n CalldataPointer cdPtr\n ) internal pure returns (int232 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int240 at `cdPtr` in calldata.\n function readInt240(\n CalldataPointer cdPtr\n ) internal pure returns (int240 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int248 at `cdPtr` in calldata.\n function readInt248(\n CalldataPointer cdPtr\n ) internal pure returns (int248 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n\n /// @dev Reads the int256 at `cdPtr` in calldata.\n function readInt256(\n CalldataPointer cdPtr\n ) internal pure returns (int256 value) {\n assembly {\n value := calldataload(cdPtr)\n }\n }\n}\n\nlibrary ReturndataReaders {\n /// @dev Reads value at `rdPtr` & applies a mask to return only last 4 bytes\n function readMaskedUint256(\n ReturndataPointer rdPtr\n ) internal pure returns (uint256 value) {\n value = rdPtr.readUint256() & OffsetOrLengthMask;\n }\n\n /// @dev Reads the bool at `rdPtr` in returndata.\n function readBool(\n ReturndataPointer rdPtr\n ) internal pure returns (bool value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the address at `rdPtr` in returndata.\n function readAddress(\n ReturndataPointer rdPtr\n ) internal pure returns (address value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes1 at `rdPtr` in returndata.\n function readBytes1(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes1 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes2 at `rdPtr` in returndata.\n function readBytes2(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes2 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes3 at `rdPtr` in returndata.\n function readBytes3(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes3 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes4 at `rdPtr` in returndata.\n function readBytes4(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes4 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes5 at `rdPtr` in returndata.\n function readBytes5(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes5 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes6 at `rdPtr` in returndata.\n function readBytes6(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes6 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes7 at `rdPtr` in returndata.\n function readBytes7(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes7 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes8 at `rdPtr` in returndata.\n function readBytes8(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes8 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes9 at `rdPtr` in returndata.\n function readBytes9(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes9 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes10 at `rdPtr` in returndata.\n function readBytes10(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes10 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes11 at `rdPtr` in returndata.\n function readBytes11(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes11 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes12 at `rdPtr` in returndata.\n function readBytes12(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes12 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes13 at `rdPtr` in returndata.\n function readBytes13(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes13 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes14 at `rdPtr` in returndata.\n function readBytes14(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes14 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes15 at `rdPtr` in returndata.\n function readBytes15(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes15 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes16 at `rdPtr` in returndata.\n function readBytes16(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes16 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes17 at `rdPtr` in returndata.\n function readBytes17(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes17 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes18 at `rdPtr` in returndata.\n function readBytes18(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes18 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes19 at `rdPtr` in returndata.\n function readBytes19(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes19 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes20 at `rdPtr` in returndata.\n function readBytes20(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes20 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes21 at `rdPtr` in returndata.\n function readBytes21(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes21 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes22 at `rdPtr` in returndata.\n function readBytes22(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes22 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes23 at `rdPtr` in returndata.\n function readBytes23(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes23 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes24 at `rdPtr` in returndata.\n function readBytes24(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes24 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes25 at `rdPtr` in returndata.\n function readBytes25(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes25 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes26 at `rdPtr` in returndata.\n function readBytes26(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes26 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes27 at `rdPtr` in returndata.\n function readBytes27(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes27 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes28 at `rdPtr` in returndata.\n function readBytes28(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes28 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes29 at `rdPtr` in returndata.\n function readBytes29(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes29 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes30 at `rdPtr` in returndata.\n function readBytes30(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes30 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes31 at `rdPtr` in returndata.\n function readBytes31(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes31 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the bytes32 at `rdPtr` in returndata.\n function readBytes32(\n ReturndataPointer rdPtr\n ) internal pure returns (bytes32 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint8 at `rdPtr` in returndata.\n function readUint8(\n ReturndataPointer rdPtr\n ) internal pure returns (uint8 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint16 at `rdPtr` in returndata.\n function readUint16(\n ReturndataPointer rdPtr\n ) internal pure returns (uint16 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint24 at `rdPtr` in returndata.\n function readUint24(\n ReturndataPointer rdPtr\n ) internal pure returns (uint24 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint32 at `rdPtr` in returndata.\n function readUint32(\n ReturndataPointer rdPtr\n ) internal pure returns (uint32 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint40 at `rdPtr` in returndata.\n function readUint40(\n ReturndataPointer rdPtr\n ) internal pure returns (uint40 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint48 at `rdPtr` in returndata.\n function readUint48(\n ReturndataPointer rdPtr\n ) internal pure returns (uint48 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint56 at `rdPtr` in returndata.\n function readUint56(\n ReturndataPointer rdPtr\n ) internal pure returns (uint56 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint64 at `rdPtr` in returndata.\n function readUint64(\n ReturndataPointer rdPtr\n ) internal pure returns (uint64 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint72 at `rdPtr` in returndata.\n function readUint72(\n ReturndataPointer rdPtr\n ) internal pure returns (uint72 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint80 at `rdPtr` in returndata.\n function readUint80(\n ReturndataPointer rdPtr\n ) internal pure returns (uint80 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint88 at `rdPtr` in returndata.\n function readUint88(\n ReturndataPointer rdPtr\n ) internal pure returns (uint88 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint96 at `rdPtr` in returndata.\n function readUint96(\n ReturndataPointer rdPtr\n ) internal pure returns (uint96 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint104 at `rdPtr` in returndata.\n function readUint104(\n ReturndataPointer rdPtr\n ) internal pure returns (uint104 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint112 at `rdPtr` in returndata.\n function readUint112(\n ReturndataPointer rdPtr\n ) internal pure returns (uint112 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint120 at `rdPtr` in returndata.\n function readUint120(\n ReturndataPointer rdPtr\n ) internal pure returns (uint120 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint128 at `rdPtr` in returndata.\n function readUint128(\n ReturndataPointer rdPtr\n ) internal pure returns (uint128 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint136 at `rdPtr` in returndata.\n function readUint136(\n ReturndataPointer rdPtr\n ) internal pure returns (uint136 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint144 at `rdPtr` in returndata.\n function readUint144(\n ReturndataPointer rdPtr\n ) internal pure returns (uint144 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint152 at `rdPtr` in returndata.\n function readUint152(\n ReturndataPointer rdPtr\n ) internal pure returns (uint152 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint160 at `rdPtr` in returndata.\n function readUint160(\n ReturndataPointer rdPtr\n ) internal pure returns (uint160 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint168 at `rdPtr` in returndata.\n function readUint168(\n ReturndataPointer rdPtr\n ) internal pure returns (uint168 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint176 at `rdPtr` in returndata.\n function readUint176(\n ReturndataPointer rdPtr\n ) internal pure returns (uint176 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint184 at `rdPtr` in returndata.\n function readUint184(\n ReturndataPointer rdPtr\n ) internal pure returns (uint184 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint192 at `rdPtr` in returndata.\n function readUint192(\n ReturndataPointer rdPtr\n ) internal pure returns (uint192 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint200 at `rdPtr` in returndata.\n function readUint200(\n ReturndataPointer rdPtr\n ) internal pure returns (uint200 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint208 at `rdPtr` in returndata.\n function readUint208(\n ReturndataPointer rdPtr\n ) internal pure returns (uint208 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint216 at `rdPtr` in returndata.\n function readUint216(\n ReturndataPointer rdPtr\n ) internal pure returns (uint216 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint224 at `rdPtr` in returndata.\n function readUint224(\n ReturndataPointer rdPtr\n ) internal pure returns (uint224 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint232 at `rdPtr` in returndata.\n function readUint232(\n ReturndataPointer rdPtr\n ) internal pure returns (uint232 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint240 at `rdPtr` in returndata.\n function readUint240(\n ReturndataPointer rdPtr\n ) internal pure returns (uint240 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint248 at `rdPtr` in returndata.\n function readUint248(\n ReturndataPointer rdPtr\n ) internal pure returns (uint248 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the uint256 at `rdPtr` in returndata.\n function readUint256(\n ReturndataPointer rdPtr\n ) internal pure returns (uint256 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int8 at `rdPtr` in returndata.\n function readInt8(\n ReturndataPointer rdPtr\n ) internal pure returns (int8 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int16 at `rdPtr` in returndata.\n function readInt16(\n ReturndataPointer rdPtr\n ) internal pure returns (int16 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int24 at `rdPtr` in returndata.\n function readInt24(\n ReturndataPointer rdPtr\n ) internal pure returns (int24 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int32 at `rdPtr` in returndata.\n function readInt32(\n ReturndataPointer rdPtr\n ) internal pure returns (int32 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int40 at `rdPtr` in returndata.\n function readInt40(\n ReturndataPointer rdPtr\n ) internal pure returns (int40 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int48 at `rdPtr` in returndata.\n function readInt48(\n ReturndataPointer rdPtr\n ) internal pure returns (int48 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int56 at `rdPtr` in returndata.\n function readInt56(\n ReturndataPointer rdPtr\n ) internal pure returns (int56 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int64 at `rdPtr` in returndata.\n function readInt64(\n ReturndataPointer rdPtr\n ) internal pure returns (int64 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int72 at `rdPtr` in returndata.\n function readInt72(\n ReturndataPointer rdPtr\n ) internal pure returns (int72 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int80 at `rdPtr` in returndata.\n function readInt80(\n ReturndataPointer rdPtr\n ) internal pure returns (int80 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int88 at `rdPtr` in returndata.\n function readInt88(\n ReturndataPointer rdPtr\n ) internal pure returns (int88 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int96 at `rdPtr` in returndata.\n function readInt96(\n ReturndataPointer rdPtr\n ) internal pure returns (int96 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int104 at `rdPtr` in returndata.\n function readInt104(\n ReturndataPointer rdPtr\n ) internal pure returns (int104 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int112 at `rdPtr` in returndata.\n function readInt112(\n ReturndataPointer rdPtr\n ) internal pure returns (int112 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int120 at `rdPtr` in returndata.\n function readInt120(\n ReturndataPointer rdPtr\n ) internal pure returns (int120 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int128 at `rdPtr` in returndata.\n function readInt128(\n ReturndataPointer rdPtr\n ) internal pure returns (int128 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int136 at `rdPtr` in returndata.\n function readInt136(\n ReturndataPointer rdPtr\n ) internal pure returns (int136 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int144 at `rdPtr` in returndata.\n function readInt144(\n ReturndataPointer rdPtr\n ) internal pure returns (int144 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int152 at `rdPtr` in returndata.\n function readInt152(\n ReturndataPointer rdPtr\n ) internal pure returns (int152 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int160 at `rdPtr` in returndata.\n function readInt160(\n ReturndataPointer rdPtr\n ) internal pure returns (int160 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int168 at `rdPtr` in returndata.\n function readInt168(\n ReturndataPointer rdPtr\n ) internal pure returns (int168 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int176 at `rdPtr` in returndata.\n function readInt176(\n ReturndataPointer rdPtr\n ) internal pure returns (int176 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int184 at `rdPtr` in returndata.\n function readInt184(\n ReturndataPointer rdPtr\n ) internal pure returns (int184 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int192 at `rdPtr` in returndata.\n function readInt192(\n ReturndataPointer rdPtr\n ) internal pure returns (int192 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int200 at `rdPtr` in returndata.\n function readInt200(\n ReturndataPointer rdPtr\n ) internal pure returns (int200 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int208 at `rdPtr` in returndata.\n function readInt208(\n ReturndataPointer rdPtr\n ) internal pure returns (int208 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int216 at `rdPtr` in returndata.\n function readInt216(\n ReturndataPointer rdPtr\n ) internal pure returns (int216 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int224 at `rdPtr` in returndata.\n function readInt224(\n ReturndataPointer rdPtr\n ) internal pure returns (int224 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int232 at `rdPtr` in returndata.\n function readInt232(\n ReturndataPointer rdPtr\n ) internal pure returns (int232 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int240 at `rdPtr` in returndata.\n function readInt240(\n ReturndataPointer rdPtr\n ) internal pure returns (int240 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int248 at `rdPtr` in returndata.\n function readInt248(\n ReturndataPointer rdPtr\n ) internal pure returns (int248 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n\n /// @dev Reads the int256 at `rdPtr` in returndata.\n function readInt256(\n ReturndataPointer rdPtr\n ) internal pure returns (int256 value) {\n assembly {\n returndatacopy(0, rdPtr, _OneWord)\n value := mload(0)\n }\n }\n}\n\nlibrary MemoryReaders {\n /// @dev Reads the memory pointer at `mPtr` in memory.\n function readMemoryPointer(\n MemoryPointer mPtr\n ) internal pure returns (MemoryPointer value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads value at `mPtr` & applies a mask to return only last 4 bytes\n function readMaskedUint256(\n MemoryPointer mPtr\n ) internal pure returns (uint256 value) {\n value = mPtr.readUint256() & OffsetOrLengthMask;\n }\n\n /// @dev Reads the bool at `mPtr` in memory.\n function readBool(MemoryPointer mPtr) internal pure returns (bool value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the address at `mPtr` in memory.\n function readAddress(\n MemoryPointer mPtr\n ) internal pure returns (address value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes1 at `mPtr` in memory.\n function readBytes1(\n MemoryPointer mPtr\n ) internal pure returns (bytes1 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes2 at `mPtr` in memory.\n function readBytes2(\n MemoryPointer mPtr\n ) internal pure returns (bytes2 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes3 at `mPtr` in memory.\n function readBytes3(\n MemoryPointer mPtr\n ) internal pure returns (bytes3 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes4 at `mPtr` in memory.\n function readBytes4(\n MemoryPointer mPtr\n ) internal pure returns (bytes4 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes5 at `mPtr` in memory.\n function readBytes5(\n MemoryPointer mPtr\n ) internal pure returns (bytes5 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes6 at `mPtr` in memory.\n function readBytes6(\n MemoryPointer mPtr\n ) internal pure returns (bytes6 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes7 at `mPtr` in memory.\n function readBytes7(\n MemoryPointer mPtr\n ) internal pure returns (bytes7 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes8 at `mPtr` in memory.\n function readBytes8(\n MemoryPointer mPtr\n ) internal pure returns (bytes8 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes9 at `mPtr` in memory.\n function readBytes9(\n MemoryPointer mPtr\n ) internal pure returns (bytes9 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes10 at `mPtr` in memory.\n function readBytes10(\n MemoryPointer mPtr\n ) internal pure returns (bytes10 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes11 at `mPtr` in memory.\n function readBytes11(\n MemoryPointer mPtr\n ) internal pure returns (bytes11 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes12 at `mPtr` in memory.\n function readBytes12(\n MemoryPointer mPtr\n ) internal pure returns (bytes12 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes13 at `mPtr` in memory.\n function readBytes13(\n MemoryPointer mPtr\n ) internal pure returns (bytes13 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes14 at `mPtr` in memory.\n function readBytes14(\n MemoryPointer mPtr\n ) internal pure returns (bytes14 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes15 at `mPtr` in memory.\n function readBytes15(\n MemoryPointer mPtr\n ) internal pure returns (bytes15 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes16 at `mPtr` in memory.\n function readBytes16(\n MemoryPointer mPtr\n ) internal pure returns (bytes16 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes17 at `mPtr` in memory.\n function readBytes17(\n MemoryPointer mPtr\n ) internal pure returns (bytes17 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes18 at `mPtr` in memory.\n function readBytes18(\n MemoryPointer mPtr\n ) internal pure returns (bytes18 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes19 at `mPtr` in memory.\n function readBytes19(\n MemoryPointer mPtr\n ) internal pure returns (bytes19 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes20 at `mPtr` in memory.\n function readBytes20(\n MemoryPointer mPtr\n ) internal pure returns (bytes20 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes21 at `mPtr` in memory.\n function readBytes21(\n MemoryPointer mPtr\n ) internal pure returns (bytes21 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes22 at `mPtr` in memory.\n function readBytes22(\n MemoryPointer mPtr\n ) internal pure returns (bytes22 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes23 at `mPtr` in memory.\n function readBytes23(\n MemoryPointer mPtr\n ) internal pure returns (bytes23 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes24 at `mPtr` in memory.\n function readBytes24(\n MemoryPointer mPtr\n ) internal pure returns (bytes24 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes25 at `mPtr` in memory.\n function readBytes25(\n MemoryPointer mPtr\n ) internal pure returns (bytes25 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes26 at `mPtr` in memory.\n function readBytes26(\n MemoryPointer mPtr\n ) internal pure returns (bytes26 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes27 at `mPtr` in memory.\n function readBytes27(\n MemoryPointer mPtr\n ) internal pure returns (bytes27 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes28 at `mPtr` in memory.\n function readBytes28(\n MemoryPointer mPtr\n ) internal pure returns (bytes28 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes29 at `mPtr` in memory.\n function readBytes29(\n MemoryPointer mPtr\n ) internal pure returns (bytes29 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes30 at `mPtr` in memory.\n function readBytes30(\n MemoryPointer mPtr\n ) internal pure returns (bytes30 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes31 at `mPtr` in memory.\n function readBytes31(\n MemoryPointer mPtr\n ) internal pure returns (bytes31 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the bytes32 at `mPtr` in memory.\n function readBytes32(\n MemoryPointer mPtr\n ) internal pure returns (bytes32 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint8 at `mPtr` in memory.\n function readUint8(MemoryPointer mPtr) internal pure returns (uint8 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint16 at `mPtr` in memory.\n function readUint16(\n MemoryPointer mPtr\n ) internal pure returns (uint16 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint24 at `mPtr` in memory.\n function readUint24(\n MemoryPointer mPtr\n ) internal pure returns (uint24 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint32 at `mPtr` in memory.\n function readUint32(\n MemoryPointer mPtr\n ) internal pure returns (uint32 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint40 at `mPtr` in memory.\n function readUint40(\n MemoryPointer mPtr\n ) internal pure returns (uint40 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint48 at `mPtr` in memory.\n function readUint48(\n MemoryPointer mPtr\n ) internal pure returns (uint48 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint56 at `mPtr` in memory.\n function readUint56(\n MemoryPointer mPtr\n ) internal pure returns (uint56 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint64 at `mPtr` in memory.\n function readUint64(\n MemoryPointer mPtr\n ) internal pure returns (uint64 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint72 at `mPtr` in memory.\n function readUint72(\n MemoryPointer mPtr\n ) internal pure returns (uint72 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint80 at `mPtr` in memory.\n function readUint80(\n MemoryPointer mPtr\n ) internal pure returns (uint80 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint88 at `mPtr` in memory.\n function readUint88(\n MemoryPointer mPtr\n ) internal pure returns (uint88 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint96 at `mPtr` in memory.\n function readUint96(\n MemoryPointer mPtr\n ) internal pure returns (uint96 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint104 at `mPtr` in memory.\n function readUint104(\n MemoryPointer mPtr\n ) internal pure returns (uint104 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint112 at `mPtr` in memory.\n function readUint112(\n MemoryPointer mPtr\n ) internal pure returns (uint112 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint120 at `mPtr` in memory.\n function readUint120(\n MemoryPointer mPtr\n ) internal pure returns (uint120 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint128 at `mPtr` in memory.\n function readUint128(\n MemoryPointer mPtr\n ) internal pure returns (uint128 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint136 at `mPtr` in memory.\n function readUint136(\n MemoryPointer mPtr\n ) internal pure returns (uint136 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint144 at `mPtr` in memory.\n function readUint144(\n MemoryPointer mPtr\n ) internal pure returns (uint144 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint152 at `mPtr` in memory.\n function readUint152(\n MemoryPointer mPtr\n ) internal pure returns (uint152 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint160 at `mPtr` in memory.\n function readUint160(\n MemoryPointer mPtr\n ) internal pure returns (uint160 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint168 at `mPtr` in memory.\n function readUint168(\n MemoryPointer mPtr\n ) internal pure returns (uint168 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint176 at `mPtr` in memory.\n function readUint176(\n MemoryPointer mPtr\n ) internal pure returns (uint176 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint184 at `mPtr` in memory.\n function readUint184(\n MemoryPointer mPtr\n ) internal pure returns (uint184 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint192 at `mPtr` in memory.\n function readUint192(\n MemoryPointer mPtr\n ) internal pure returns (uint192 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint200 at `mPtr` in memory.\n function readUint200(\n MemoryPointer mPtr\n ) internal pure returns (uint200 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint208 at `mPtr` in memory.\n function readUint208(\n MemoryPointer mPtr\n ) internal pure returns (uint208 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint216 at `mPtr` in memory.\n function readUint216(\n MemoryPointer mPtr\n ) internal pure returns (uint216 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint224 at `mPtr` in memory.\n function readUint224(\n MemoryPointer mPtr\n ) internal pure returns (uint224 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint232 at `mPtr` in memory.\n function readUint232(\n MemoryPointer mPtr\n ) internal pure returns (uint232 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint240 at `mPtr` in memory.\n function readUint240(\n MemoryPointer mPtr\n ) internal pure returns (uint240 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint248 at `mPtr` in memory.\n function readUint248(\n MemoryPointer mPtr\n ) internal pure returns (uint248 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the uint256 at `mPtr` in memory.\n function readUint256(\n MemoryPointer mPtr\n ) internal pure returns (uint256 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int8 at `mPtr` in memory.\n function readInt8(MemoryPointer mPtr) internal pure returns (int8 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int16 at `mPtr` in memory.\n function readInt16(MemoryPointer mPtr) internal pure returns (int16 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int24 at `mPtr` in memory.\n function readInt24(MemoryPointer mPtr) internal pure returns (int24 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int32 at `mPtr` in memory.\n function readInt32(MemoryPointer mPtr) internal pure returns (int32 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int40 at `mPtr` in memory.\n function readInt40(MemoryPointer mPtr) internal pure returns (int40 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int48 at `mPtr` in memory.\n function readInt48(MemoryPointer mPtr) internal pure returns (int48 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int56 at `mPtr` in memory.\n function readInt56(MemoryPointer mPtr) internal pure returns (int56 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int64 at `mPtr` in memory.\n function readInt64(MemoryPointer mPtr) internal pure returns (int64 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int72 at `mPtr` in memory.\n function readInt72(MemoryPointer mPtr) internal pure returns (int72 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int80 at `mPtr` in memory.\n function readInt80(MemoryPointer mPtr) internal pure returns (int80 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int88 at `mPtr` in memory.\n function readInt88(MemoryPointer mPtr) internal pure returns (int88 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int96 at `mPtr` in memory.\n function readInt96(MemoryPointer mPtr) internal pure returns (int96 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int104 at `mPtr` in memory.\n function readInt104(\n MemoryPointer mPtr\n ) internal pure returns (int104 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int112 at `mPtr` in memory.\n function readInt112(\n MemoryPointer mPtr\n ) internal pure returns (int112 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int120 at `mPtr` in memory.\n function readInt120(\n MemoryPointer mPtr\n ) internal pure returns (int120 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int128 at `mPtr` in memory.\n function readInt128(\n MemoryPointer mPtr\n ) internal pure returns (int128 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int136 at `mPtr` in memory.\n function readInt136(\n MemoryPointer mPtr\n ) internal pure returns (int136 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int144 at `mPtr` in memory.\n function readInt144(\n MemoryPointer mPtr\n ) internal pure returns (int144 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int152 at `mPtr` in memory.\n function readInt152(\n MemoryPointer mPtr\n ) internal pure returns (int152 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int160 at `mPtr` in memory.\n function readInt160(\n MemoryPointer mPtr\n ) internal pure returns (int160 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int168 at `mPtr` in memory.\n function readInt168(\n MemoryPointer mPtr\n ) internal pure returns (int168 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int176 at `mPtr` in memory.\n function readInt176(\n MemoryPointer mPtr\n ) internal pure returns (int176 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int184 at `mPtr` in memory.\n function readInt184(\n MemoryPointer mPtr\n ) internal pure returns (int184 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int192 at `mPtr` in memory.\n function readInt192(\n MemoryPointer mPtr\n ) internal pure returns (int192 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int200 at `mPtr` in memory.\n function readInt200(\n MemoryPointer mPtr\n ) internal pure returns (int200 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int208 at `mPtr` in memory.\n function readInt208(\n MemoryPointer mPtr\n ) internal pure returns (int208 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int216 at `mPtr` in memory.\n function readInt216(\n MemoryPointer mPtr\n ) internal pure returns (int216 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int224 at `mPtr` in memory.\n function readInt224(\n MemoryPointer mPtr\n ) internal pure returns (int224 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int232 at `mPtr` in memory.\n function readInt232(\n MemoryPointer mPtr\n ) internal pure returns (int232 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int240 at `mPtr` in memory.\n function readInt240(\n MemoryPointer mPtr\n ) internal pure returns (int240 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int248 at `mPtr` in memory.\n function readInt248(\n MemoryPointer mPtr\n ) internal pure returns (int248 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n\n /// @dev Reads the int256 at `mPtr` in memory.\n function readInt256(\n MemoryPointer mPtr\n ) internal pure returns (int256 value) {\n assembly {\n value := mload(mPtr)\n }\n }\n}\n\nlibrary MemoryWriters {\n /// @dev Writes `valuePtr` to memory at `mPtr`.\n function write(MemoryPointer mPtr, MemoryPointer valuePtr) internal pure {\n assembly {\n mstore(mPtr, valuePtr)\n }\n }\n\n /// @dev Writes a boolean `value` to `mPtr` in memory.\n function write(MemoryPointer mPtr, bool value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n\n /// @dev Writes an address `value` to `mPtr` in memory.\n function write(MemoryPointer mPtr, address value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n\n /// @dev Writes a bytes32 `value` to `mPtr` in memory.\n /// Separate name to disambiguate literal write parameters.\n function writeBytes32(MemoryPointer mPtr, bytes32 value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n\n /// @dev Writes a uint256 `value` to `mPtr` in memory.\n function write(MemoryPointer mPtr, uint256 value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n\n /// @dev Writes an int256 `value` to `mPtr` in memory.\n /// Separate name to disambiguate literal write parameters.\n function writeInt(MemoryPointer mPtr, int256 value) internal pure {\n assembly {\n mstore(mPtr, value)\n }\n }\n}\n" }, "lib/seaport/lib/seaport-types/src/interfaces/IERC165.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.7;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" }, "lib/openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.19;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\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://consensys.net/diligence/blog/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.8.0/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(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\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 if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(target.code.length > 0, \"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" }, "src/lib/ERC721SeaDropStructs.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport { AllowListData, CreatorPayout } from \"./SeaDropStructs.sol\";\n\n/**\n * @notice A struct defining public drop data.\n * Designed to fit efficiently in two storage slots.\n *\n * @param startPrice The start price per token. (Up to 1.2m\n * of native token, e.g. ETH, MATIC)\n * @param endPrice The end price per token. If this differs\n * from startPrice, the current price will\n * be calculated based on the current time.\n * @param startTime The start time, ensure this is not zero.\n * @param endTime The end time, ensure this is not zero.\n * @param paymentToken The payment token address. Null for\n * native token.\n * @param maxTotalMintableByWallet Maximum total number of mints a user is\n * allowed. (The limit for this field is\n * 2^16 - 1)\n * @param feeBps Fee out of 10_000 basis points to be\n * collected.\n * @param restrictFeeRecipients If false, allow any fee recipient;\n * if true, check fee recipient is allowed.\n */\nstruct PublicDrop {\n uint80 startPrice; // 80/512 bits\n uint80 endPrice; // 160/512 bits\n uint40 startTime; // 200/512 bits\n uint40 endTime; // 240/512 bits\n address paymentToken; // 400/512 bits\n uint16 maxTotalMintableByWallet; // 416/512 bits\n uint16 feeBps; // 432/512 bits\n bool restrictFeeRecipients; // 440/512 bits\n}\n\n/**\n * @notice A struct defining mint params for an allow list.\n * An allow list leaf will be composed of `msg.sender` and\n * the following params.\n *\n * Note: Since feeBps is encoded in the leaf, backend should ensure\n * that feeBps is acceptable before generating a proof.\n *\n * @param startPrice The start price per token. (Up to 1.2m\n * of native token, e.g. ETH, MATIC)\n * @param endPrice The end price per token. If this differs\n * from startPrice, the current price will\n * be calculated based on the current time.\n * @param startTime The start time, ensure this is not zero.\n * @param endTime The end time, ensure this is not zero.\n * @param paymentToken The payment token for the mint. Null for\n * native token.\n * @param maxTotalMintableByWallet Maximum total number of mints a user is\n * allowed.\n * @param maxTokenSupplyForStage The limit of token supply this stage can\n * mint within.\n * @param dropStageIndex The drop stage index to emit with the event\n * for analytical purposes. This should be\n * non-zero since the public mint emits with\n * index zero.\n * @param feeBps Fee out of 10_000 basis points to be\n * collected.\n * @param restrictFeeRecipients If false, allow any fee recipient;\n * if true, check fee recipient is allowed.\n */\nstruct MintParams {\n uint256 startPrice;\n uint256 endPrice;\n uint256 startTime;\n uint256 endTime;\n address paymentToken;\n uint256 maxTotalMintableByWallet;\n uint256 maxTokenSupplyForStage;\n uint256 dropStageIndex; // non-zero\n uint256 feeBps;\n bool restrictFeeRecipients;\n}\n\n/**\n * @dev Struct containing internal SeaDrop implementation logic\n * mint details to avoid stack too deep.\n *\n * @param feeRecipient The fee recipient.\n * @param payer The payer of the mint.\n * @param minter The mint recipient.\n * @param quantity The number of tokens to mint.\n * @param withEffects Whether to apply state changes of the mint.\n */\nstruct MintDetails {\n address feeRecipient;\n address payer;\n address minter;\n uint256 quantity;\n bool withEffects;\n}\n\n/**\n * @notice A struct to configure multiple contract options in one transaction.\n */\nstruct MultiConfigureStruct {\n uint256 maxSupply;\n string baseURI;\n string contractURI;\n PublicDrop publicDrop;\n string dropURI;\n AllowListData allowListData;\n CreatorPayout[] creatorPayouts;\n bytes32 provenanceHash;\n address[] allowedFeeRecipients;\n address[] disallowedFeeRecipients;\n address[] allowedPayers;\n address[] disallowedPayers;\n // Server-signed\n address[] allowedSigners;\n address[] disallowedSigners;\n // ERC-2981\n address royaltyReceiver;\n uint96 royaltyBps;\n // Mint\n address mintRecipient;\n uint256 mintQuantity;\n}\n" } }, "settings": { "remappings": [ "forge-std/=lib/forge-std/src/", "ds-test/=lib/forge-std/lib/ds-test/src/", "ERC721A/=lib/ERC721A/contracts/", "ERC721A-Upgradeable/=lib/ERC721A-Upgradeable/contracts/", "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "@openzeppelin-upgradeable/contracts/=lib/openzeppelin-contracts-upgradeable/contracts/", "@rari-capital/solmate/=lib/seaport/lib/solmate/", "murky/=lib/murky/src/", "create2-scripts/=lib/create2-helpers/script/", "seadrop/=src/", "seaport-sol/=lib/seaport/lib/seaport-sol/", "seaport-types/=lib/seaport/lib/seaport-types/", "seaport-core/=lib/seaport/lib/seaport-core/", "seaport-test-utils/=lib/seaport/test/foundry/utils/", "solady/=lib/solady/" ], "optimizer": { "enabled": true, "runs": 100000 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "none", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "viaIR": false, "libraries": {} } }}
1
20,290,569
3c36925b07ab4c98e9f99612c0a1768717c590ddec04c822d42a9ac6c5d38be6
44e8e70cdbe5d1b71eee7a03181bff5c47ab5cd057d1f27c9f79364fc800a204
a7fb5ca286fc3fd67525629048a4de3ba24cba2e
c77ad0a71008d7094a62cfbd250a2eb2afdf2776
e6592cc5e34b032c4d925393ca44ab8052697a04
608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe
1
20,290,570
ec04d1f9045773d2f2a90f8e0a28bcb79613fe33b816d6cf7392f5f77a960ae7
9a6271ac4470bc5388ae7ce43028977774d25abc8269030af4df77b726cbc0a2
8caba39c9864a28d349d80cc262f88583b326003
b4ea9a0c1edd5c41585cd3715a1269b9dd3105a5
bab6a95ed313e3ef2e9cdf86857ed7e43842bfa1
3d602d80600a3d3981f3363d3d373d3d3d363d7316c93bc86d02ccfcab53dde2431f2e52b6271fd15af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7316c93bc86d02ccfcab53dde2431f2e52b6271fd15af43d82803e903d91602b57fd5bf3
{{ "language": "Solidity", "sources": { "./contracts/erc-721/CreatorCollection.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721URIStorageUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721BurnableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol\";\nimport \"../royalties/Royalties.sol\";\n\n// Version: 5.0\ncontract CreatorCollection is\n Initializable,\n ERC721Upgradeable,\n ERC721EnumerableUpgradeable,\n ERC721URIStorageUpgradeable,\n ERC721BurnableUpgradeable,\n AccessControlEnumerableUpgradeable,\n Royalties\n{\n bytes32 private constant _DOMAIN_TYPEHASH =\n keccak256(\n \"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract,bytes32 salt)\"\n );\n\n bytes32 private constant _MINT_SIGNED_TYPEHASH =\n keccak256(\n \"MintNFT(address sender,address to,string tokenURI,bytes32 tokenNonce,\"\n \"address[] royaltyReceivers,uint256[] royaltyBasisPoints)\"\n );\n\n bytes32 private constant _MINT_EDITIONS_SIGNED_TYPEHASH =\n keccak256(\n \"MintNFTEditions(address sender,address to,string[] tokenURIs,bytes32 tokenNonce,\"\n \"address[] royaltyReceivers,uint256[] royaltyBasisPoints)\"\n );\n\n bytes32 private _eip712DomainSeparator;\n\n function initialize(\n string calldata baseURI,\n string calldata contractName,\n string calldata tokenSymbol,\n address _owner\n ) public initializer {\n __ERC721_init(contractName, tokenSymbol);\n __ERC721Enumerable_init();\n __ERC721URIStorage_init();\n __ERC721Burnable_init();\n __AccessControlEnumerable_init();\n\n _baseURIValue = baseURI;\n\n _setupRole(DEFAULT_ADMIN_ROLE, _owner);\n _setupRole(MINTER_ROLE, _owner);\n\n _eip712DomainSeparator = keccak256(\n abi.encode(\n _DOMAIN_TYPEHASH,\n keccak256(\"Verisart\"),\n keccak256(\"1\"),\n block.chainid,\n address(this),\n 0x44e13add1946dd1b4565b9603989e9703cc27e2501bfaf4720de9b71b4fd81de\n )\n );\n\n _allowSignedMinting = true;\n }\n\n using CountersUpgradeable for CountersUpgradeable.Counter;\n\n CountersUpgradeable.Counter private _tokenIdCounter;\n CountersUpgradeable.Counter private _editionCounter;\n string private _baseURIValue;\n uint256 private constant _MAX_SINGLES = 100000000;\n mapping(bytes32 => bool) private _signedMints;\n\n /*\n * @dev allows the owner (and potentially other 3rd parties) permission to mint\n * on behalf of the owner\n */\n bytes32 public constant MINTER_ROLE = keccak256(\"MINTER_ROLE\");\n\n /**\n * @dev Allows minting via signed mint (an off-chain signature from a `MINTER_ROLE` user is still required).\n * This is defaulted to true on deployment, but can be disabled by the contract admin.\n */\n bool private _allowSignedMinting;\n\n function allowSignedMinting() external view returns (bool) {\n return _allowSignedMinting;\n }\n\n function setAllowSignedMinting(bool val) external onlyAdmin {\n _allowSignedMinting = val;\n }\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() {\n _disableInitializers();\n }\n\n function _baseURI() internal view override returns (string memory) {\n return _baseURIValue;\n }\n\n /**\n * Required to allow the owner to administrate the contract on OpenSea.\n * Note if there are many addresses with the DEFAULT_ADMIN_ROLE, the one which is returned may be arbitrary.\n */\n function owner() public view virtual returns (address) {\n return _getPrimaryAdmin();\n }\n\n function _getPrimaryAdmin() internal view virtual returns (address) {\n if (getRoleMemberCount(DEFAULT_ADMIN_ROLE) == 0) {\n return address(0x0);\n }\n return getRoleMember(DEFAULT_ADMIN_ROLE, 0);\n }\n\n /**\n * @dev Throws if called by any account other than an approved minter.\n */\n modifier onlyMinter() {\n require(\n hasRole(MINTER_ROLE, msg.sender),\n \"Restricted to approved minters\"\n );\n _;\n }\n\n modifier onlyAdmin() {\n require(\n hasRole(DEFAULT_ADMIN_ROLE, msg.sender),\n \"Restricted to admins\"\n );\n _;\n }\n\n function mintAndTransfer(\n address to,\n string calldata _tokenURI,\n address payable[] calldata royaltyReceivers,\n uint256[] calldata royaltyBasisPoints\n ) external onlyMinter {\n uint256 newestToken = getNextTokenId();\n _mintNoPermission(\n msg.sender,\n _tokenURI,\n royaltyReceivers,\n royaltyBasisPoints\n );\n safeTransferFrom(msg.sender, to, newestToken);\n }\n\n function _mintNoPermission(\n address to,\n string calldata _tokenURI,\n address payable[] calldata royaltyReceivers,\n uint256[] calldata royaltyBasisPoints\n ) private {\n uint256 tokenId = getNextTokenId();\n require(\n tokenId < _MAX_SINGLES,\n \"Maximum number of single tokens exceeded\"\n );\n\n _mintSingle(\n to,\n tokenId,\n _tokenURI,\n royaltyReceivers,\n royaltyBasisPoints\n );\n _tokenIdCounter.increment();\n }\n\n function mint(\n address to,\n string calldata _tokenURI,\n address payable[] calldata royaltyReceivers,\n uint256[] calldata royaltyBasisPoints\n ) external onlyMinter {\n _mintNoPermission(to, _tokenURI, royaltyReceivers, royaltyBasisPoints);\n }\n\n function mintSigned(\n address to,\n string calldata _tokenURI,\n bytes32 tokenNonce,\n address payable[] calldata royaltyReceivers,\n uint256[] calldata royaltyBasisPoints,\n bytes calldata signature\n ) external {\n bytes memory args = abi.encode(\n _MINT_SIGNED_TYPEHASH,\n msg.sender,\n to,\n keccak256(abi.encodePacked(_tokenURI)),\n tokenNonce,\n keccak256(abi.encodePacked(royaltyReceivers)),\n keccak256(abi.encodePacked(royaltyBasisPoints))\n );\n _checkSigned(args, tokenNonce, signature);\n _mintNoPermission(to, _tokenURI, royaltyReceivers, royaltyBasisPoints);\n }\n\n function _mintEditionsNoPermission(\n address to,\n string[] calldata _tokenURIs,\n address payable[] calldata royaltyReceivers,\n uint256[] calldata royaltyBasisPoints\n ) private {\n require(_tokenURIs.length > 1, \"Must be more than 1 token per edition\");\n\n uint256 tokenId = getNextEditionId();\n _mintEditions(\n to,\n tokenId,\n _tokenURIs,\n royaltyReceivers,\n royaltyBasisPoints\n );\n _editionCounter.increment();\n }\n\n function mintEditions(\n address to,\n string[] calldata _tokenURIs,\n address payable[] calldata royaltyReceivers,\n uint256[] calldata royaltyBasisPoints\n ) external onlyMinter {\n _mintEditionsNoPermission(\n to,\n _tokenURIs,\n royaltyReceivers,\n royaltyBasisPoints\n );\n }\n\n function mintEditionsSigned(\n address to,\n string[] calldata _tokenURIs,\n bytes32 tokenNonce,\n address payable[] calldata royaltyReceivers,\n uint256[] calldata royaltyBasisPoints,\n bytes calldata signature\n ) external {\n bytes memory args = abi.encode(\n _MINT_EDITIONS_SIGNED_TYPEHASH,\n msg.sender,\n to,\n keccak256(abi.encodePacked(_hashStringArray(_tokenURIs))),\n tokenNonce,\n keccak256(abi.encodePacked(royaltyReceivers)),\n keccak256(abi.encodePacked(royaltyBasisPoints))\n );\n _checkSigned(args, tokenNonce, signature);\n _mintEditionsNoPermission(\n to,\n _tokenURIs,\n royaltyReceivers,\n royaltyBasisPoints\n );\n }\n\n function _mintEditions(\n address to,\n uint256 tokenId,\n string[] calldata _tokenURIs,\n address payable[] calldata royaltyReceivers,\n uint256[] calldata royaltyBasisPoints\n ) private {\n for (uint256 i = 0; i < _tokenURIs.length; i++) {\n _mintSingle(\n to,\n tokenId + i,\n _tokenURIs[i],\n royaltyReceivers,\n royaltyBasisPoints\n );\n }\n }\n\n function _mintSingle(\n address to,\n uint256 tokenId,\n string calldata _tokenURI,\n address payable[] calldata royaltyReceivers,\n uint256[] calldata royaltyBasisPoints\n ) private {\n _safeMint(to, tokenId);\n _setTokenURI(tokenId, _tokenURI);\n _setTokenRoyaltiesOnMint(tokenId, royaltyReceivers, royaltyBasisPoints);\n }\n\n function setTokenRoyalties(\n uint256 tokenId,\n address payable[] calldata royaltyReceivers,\n uint256[] calldata royaltyBasisPoints\n ) external onlyAdmin {\n _setTokenRoyaltiesAfterMint(\n tokenId,\n royaltyReceivers,\n royaltyBasisPoints\n );\n }\n\n function setDefaultRoyalties(\n address payable[] calldata royaltyReceivers,\n uint256[] calldata royaltyBasisPoints\n ) external onlyAdmin {\n _setDefaultRoyalties(royaltyReceivers, royaltyBasisPoints);\n }\n\n function _checkSigned(\n bytes memory args,\n bytes32 tokenNonce,\n bytes calldata signature\n ) private {\n // Check global flag\n require(\n _allowSignedMinting == true,\n \"Global signed minting must be turned on\"\n );\n\n // Recover signature\n bytes32 digest = keccak256(\n abi.encodePacked(\n \"\\x19\\x01\",\n _eip712DomainSeparator,\n keccak256(args)\n )\n );\n address authorizer = ECDSAUpgradeable.recover(digest, signature);\n\n // Check signer can mint on this contract\n require(\n hasRole(MINTER_ROLE, authorizer),\n \"Signature doesn't match minter\"\n );\n\n // Check nonce hasn't been redeemed already\n require(\n _signedMints[tokenNonce] == false,\n \"Signed mint already redeemed\"\n );\n\n // Mark the nonce as redeemed\n _signedMints[tokenNonce] = true;\n }\n\n // In EIP-712 arrays of dynamically-sized types need each element hashed first\n function _hashStringArray(\n string[] calldata data\n ) private pure returns (bytes32[] memory) {\n bytes32[] memory keccakData = new bytes32[](data.length);\n for (uint256 i = 0; i < data.length; i++) {\n keccakData[i] = keccak256(bytes(data[i]));\n }\n return keccakData;\n }\n\n function getNextTokenId() public view returns (uint256) {\n return _tokenIdCounter.current() + 1;\n }\n\n function getNextEditionId() public view returns (uint256) {\n return ((_editionCounter.current() + 1) * _MAX_SINGLES) + 1;\n }\n\n function isTokenNonceRedeemed(\n bytes32 tokenNonce\n ) external view returns (bool) {\n return _signedMints[tokenNonce];\n }\n\n // The following functions are overrides required by Solidity.\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal override(ERC721Upgradeable, ERC721EnumerableUpgradeable) {\n super._beforeTokenTransfer(from, to, tokenId);\n }\n\n function _burn(\n uint256 tokenId\n ) internal override(ERC721Upgradeable, ERC721URIStorageUpgradeable) {\n super._burn(tokenId);\n }\n\n function tokenURI(\n uint256 tokenId\n )\n public\n view\n override(ERC721Upgradeable, ERC721URIStorageUpgradeable)\n returns (string memory)\n {\n return super.tokenURI(tokenId);\n }\n\n function _existsRoyalties(\n uint256 tokenId\n ) internal view virtual override(Royalties) returns (bool) {\n return super._exists(tokenId);\n }\n\n function supportsInterface(\n bytes4 interfaceId\n )\n public\n view\n override(\n ERC721Upgradeable,\n ERC721EnumerableUpgradeable,\n AccessControlEnumerableUpgradeable\n )\n returns (bool)\n {\n return\n super.supportsInterface(interfaceId) ||\n _supportsRoyaltyInterfaces(interfaceId);\n }\n}\n" }, "./contracts/royalties/Royalties.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\n\nabstract contract Royalties {\n event RoyaltiesUpdated(\n uint256 indexed tokenId,\n address payable[] receivers,\n uint256[] basisPoints\n );\n\n event DefaultRoyaltiesUpdated(\n address payable[] receivers,\n uint256[] basisPoints\n );\n\n struct RoyaltyConfig {\n address payable receiver;\n uint16 bps;\n }\n\n mapping(uint256 => RoyaltyConfig[]) private _tokenRoyalties;\n RoyaltyConfig[] private _defaultRoyalties;\n\n function _existsRoyalties(\n uint256 tokenId\n ) internal view virtual returns (bool);\n\n /**\n * @dev CreatorCore\n *\n * bytes4(keccak256('getRoyalties(uint256)')) == 0xbb3bafd6\n *\n * => 0xbb3bafd6 = 0xbb3bafd6\n */\n bytes4 private constant _INTERFACE_ID_ROYALTIES_CREATORCORE = 0xbb3bafd6;\n\n /**\n * @dev Rarible: RoyaltiesV1\n *\n * bytes4(keccak256('getFeeRecipients(uint256)')) == 0xb9c4d9fb\n * bytes4(keccak256('getFeeBps(uint256)')) == 0x0ebd4c7f\n *\n * => 0xb9c4d9fb ^ 0x0ebd4c7f = 0xb7799584\n */\n bytes4 private constant _INTERFACE_ID_ROYALTIES_RARIBLE = 0xb7799584;\n\n /**\n * @dev Foundation\n *\n * bytes4(keccak256('getFees(uint256)')) == 0xd5a06d4c\n *\n * => 0xd5a06d4c = 0xd5a06d4c\n */\n bytes4 private constant _INTERFACE_ID_ROYALTIES_FOUNDATION = 0xd5a06d4c;\n\n /**\n * @dev EIP-2981\n *\n * bytes4(keccak256(\"royaltyInfo(uint256,uint256)\")) == 0x2a55205a\n *\n * => 0x2a55205a = 0x2a55205a\n */\n bytes4 private constant _INTERFACE_ID_ROYALTIES_EIP2981 = 0x2a55205a;\n\n function _setTokenRoyaltiesOnMint(\n uint256 tokenId,\n address payable[] calldata receivers,\n uint256[] calldata basisPoints\n ) internal {\n _checkRoyalties(receivers, basisPoints);\n // No delete necessary because the token will not have existed before this point\n _setRoyalties(receivers, basisPoints, _tokenRoyalties[tokenId]);\n }\n\n function _setTokenRoyaltiesAfterMint(\n uint256 tokenId,\n address payable[] calldata receivers,\n uint256[] calldata basisPoints\n ) internal {\n _checkRoyalties(receivers, basisPoints);\n delete _tokenRoyalties[tokenId];\n _setRoyalties(receivers, basisPoints, _tokenRoyalties[tokenId]);\n\n emit RoyaltiesUpdated(tokenId, receivers, basisPoints);\n }\n\n function _setDefaultRoyalties(\n address payable[] calldata receivers,\n uint256[] calldata basisPoints\n ) internal {\n _checkRoyalties(receivers, basisPoints);\n delete _defaultRoyalties;\n _setRoyalties(receivers, basisPoints, _defaultRoyalties);\n\n emit DefaultRoyaltiesUpdated(receivers, basisPoints);\n }\n\n function _checkRoyalties(\n address payable[] calldata receivers,\n uint256[] calldata basisPoints\n ) private pure {\n require(\n receivers.length == basisPoints.length,\n \"Mismatch in array lengths\"\n );\n uint256 totalBasisPoints;\n for (uint256 i; i < basisPoints.length; ) {\n totalBasisPoints += basisPoints[i];\n unchecked {\n ++i;\n }\n }\n require(totalBasisPoints < 10000, \"Invalid total royalties\");\n }\n\n function _setRoyalties(\n address payable[] calldata receivers,\n uint256[] calldata basisPoints,\n RoyaltyConfig[] storage royalties\n ) private {\n for (uint256 i; i < basisPoints.length; ) {\n royalties.push(\n RoyaltyConfig({\n receiver: receivers[i],\n bps: uint16(basisPoints[i])\n })\n );\n unchecked {\n ++i;\n }\n }\n }\n\n function _getRoyalties(\n uint256 tokenId\n )\n private\n view\n returns (address payable[] memory receivers, uint256[] memory bps)\n {\n // Get token level royalties\n RoyaltyConfig[] memory royalties = _tokenRoyalties[tokenId];\n\n if (royalties.length == 0) {\n // Get the default royalty\n royalties = _defaultRoyalties;\n }\n\n if (royalties.length > 0) {\n receivers = new address payable[](royalties.length);\n bps = new uint256[](royalties.length);\n for (uint i; i < royalties.length; ) {\n receivers[i] = royalties[i].receiver;\n bps[i] = royalties[i].bps;\n unchecked {\n ++i;\n }\n }\n }\n }\n\n /**\n * Manifold CreatorCore\n */\n function getRoyalties(\n uint256 tokenId\n )\n external\n view\n virtual\n returns (address payable[] memory, uint256[] memory)\n {\n require(_existsRoyalties(tokenId), \"Nonexistent token\");\n return _getRoyalties(tokenId);\n }\n\n /**\n * @dev IFoundation\n */\n function getFees(\n uint256 tokenId\n )\n external\n view\n virtual\n returns (address payable[] memory, uint256[] memory)\n {\n require(_existsRoyalties(tokenId), \"Nonexistent token\");\n return _getRoyalties(tokenId);\n }\n\n /**\n * @dev IRaribleV1\n */\n function getFeeRecipients(\n uint256 tokenId\n ) external view virtual returns (address payable[] memory) {\n require(_existsRoyalties(tokenId), \"Nonexistent token\");\n\n address payable[] memory receivers;\n uint256[] memory bps;\n (receivers, bps) = _getRoyalties(tokenId);\n return receivers;\n }\n\n function getFeeBps(\n uint256 tokenId\n ) external view virtual returns (uint256[] memory) {\n require(_existsRoyalties(tokenId), \"Nonexistent token\");\n\n address payable[] memory receivers;\n uint256[] memory bps;\n (receivers, bps) = _getRoyalties(tokenId);\n return bps;\n }\n\n /**\n * @dev EIP-2981\n */\n function royaltyInfo(\n uint256 tokenId,\n uint256 value\n ) external view virtual returns (address, uint256) {\n require(_existsRoyalties(tokenId), \"Nonexistent token\");\n\n address payable[] memory receivers;\n uint256[] memory bps;\n\n (receivers, bps) = _getRoyalties(tokenId);\n\n require(receivers.length <= 1, \"More than 1 royalties found\");\n\n if (receivers.length == 0) {\n return (address(0x0), 0);\n }\n\n return (receivers[0], (bps[0] * value) / 10000);\n }\n\n function _supportsRoyaltyInterfaces(\n bytes4 interfaceId\n ) internal pure returns (bool) {\n return\n interfaceId == _INTERFACE_ID_ROYALTIES_CREATORCORE ||\n interfaceId == _INTERFACE_ID_ROYALTIES_RARIBLE ||\n interfaceId == _INTERFACE_ID_ROYALTIES_FOUNDATION ||\n interfaceId == _INTERFACE_ID_ROYALTIES_EIP2981;\n }\n}\n" }, "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721Upgradeable.sol\";\nimport \"./IERC721ReceiverUpgradeable.sol\";\nimport \"./extensions/IERC721MetadataUpgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../utils/StringsUpgradeable.sol\";\nimport \"../../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\n using AddressUpgradeable for address;\n using StringsUpgradeable for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __ERC721_init_unchained(name_, symbol_);\n }\n\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n return\n interfaceId == type(IERC721Upgradeable).interfaceId ||\n interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _owners[tokenId];\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner nor approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner nor approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner nor approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _owners[tokenId] != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId);\n\n _balances[to] += 1;\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId);\n\n // Clear approvals\n _approve(address(0), tokenId);\n\n _balances[owner] -= 1;\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId);\n\n // Clear approvals from the previous owner\n _approve(address(0), tokenId);\n\n _balances[from] -= 1;\n _balances[to] += 1;\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting\n * and burning.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\n * transferred to `to`.\n * - When `from` is zero, `tokenId` will be minted for `to`.\n * - When `to` is zero, ``from``'s `tokenId` 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 tokenId\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.\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 tokenId\n ) 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[44] private __gap;\n}\n" }, "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721Upgradeable is IERC165Upgradeable {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" }, "@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165Upgradeable {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" }, "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721ReceiverUpgradeable {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" }, "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721Upgradeable.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721MetadataUpgradeable is IERC721Upgradeable {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" }, "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.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 functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\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 require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason 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 // 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}\n" }, "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\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.7.0) (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. Equivalent to `reinitializer(1)`.\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 * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\n * initialization step. This is essential to configure modules that are added through upgrades and that require\n * initialization.\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 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 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" }, "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _HEX_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 // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\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 if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\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] = _HEX_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-upgradeable/utils/introspection/ERC165Upgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\n function __ERC165_init() internal onlyInitializing {\n }\n\n function __ERC165_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165Upgradeable).interfaceId;\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/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC721Upgradeable.sol\";\nimport \"./IERC721EnumerableUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev This implements an optional extension of {ERC721} defined in the EIP that adds\n * enumerability of all the token ids in the contract as well as all token ids owned by each\n * account.\n */\nabstract contract ERC721EnumerableUpgradeable is Initializable, ERC721Upgradeable, IERC721EnumerableUpgradeable {\n function __ERC721Enumerable_init() internal onlyInitializing {\n }\n\n function __ERC721Enumerable_init_unchained() internal onlyInitializing {\n }\n // Mapping from owner to list of owned token IDs\n mapping(address => mapping(uint256 => uint256)) private _ownedTokens;\n\n // Mapping from token ID to index of the owner tokens list\n mapping(uint256 => uint256) private _ownedTokensIndex;\n\n // Array with all token ids, used for enumeration\n uint256[] private _allTokens;\n\n // Mapping from token id to position in the allTokens array\n mapping(uint256 => uint256) private _allTokensIndex;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165Upgradeable, ERC721Upgradeable) returns (bool) {\n return interfaceId == type(IERC721EnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.\n */\n function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {\n require(index < ERC721Upgradeable.balanceOf(owner), \"ERC721Enumerable: owner index out of bounds\");\n return _ownedTokens[owner][index];\n }\n\n /**\n * @dev See {IERC721Enumerable-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _allTokens.length;\n }\n\n /**\n * @dev See {IERC721Enumerable-tokenByIndex}.\n */\n function tokenByIndex(uint256 index) public view virtual override returns (uint256) {\n require(index < ERC721EnumerableUpgradeable.totalSupply(), \"ERC721Enumerable: global index out of bounds\");\n return _allTokens[index];\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting\n * and burning.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\n * transferred to `to`.\n * - When `from` is zero, `tokenId` will be minted for `to`.\n * - When `to` is zero, ``from``'s `tokenId` will be burned.\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\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 tokenId\n ) internal virtual override {\n super._beforeTokenTransfer(from, to, tokenId);\n\n if (from == address(0)) {\n _addTokenToAllTokensEnumeration(tokenId);\n } else if (from != to) {\n _removeTokenFromOwnerEnumeration(from, tokenId);\n }\n if (to == address(0)) {\n _removeTokenFromAllTokensEnumeration(tokenId);\n } else if (to != from) {\n _addTokenToOwnerEnumeration(to, tokenId);\n }\n }\n\n /**\n * @dev Private function to add a token to this extension's ownership-tracking data structures.\n * @param to address representing the new owner of the given token ID\n * @param tokenId uint256 ID of the token to be added to the tokens list of the given address\n */\n function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {\n uint256 length = ERC721Upgradeable.balanceOf(to);\n _ownedTokens[to][length] = tokenId;\n _ownedTokensIndex[tokenId] = length;\n }\n\n /**\n * @dev Private function to add a token to this extension's token tracking data structures.\n * @param tokenId uint256 ID of the token to be added to the tokens list\n */\n function _addTokenToAllTokensEnumeration(uint256 tokenId) private {\n _allTokensIndex[tokenId] = _allTokens.length;\n _allTokens.push(tokenId);\n }\n\n /**\n * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that\n * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for\n * gas optimizations e.g. when performing a transfer operation (avoiding double writes).\n * This has O(1) time complexity, but alters the order of the _ownedTokens array.\n * @param from address representing the previous owner of the given token ID\n * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address\n */\n function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {\n // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and\n // then delete the last slot (swap and pop).\n\n uint256 lastTokenIndex = ERC721Upgradeable.balanceOf(from) - 1;\n uint256 tokenIndex = _ownedTokensIndex[tokenId];\n\n // When the token to delete is the last token, the swap operation is unnecessary\n if (tokenIndex != lastTokenIndex) {\n uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];\n\n _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\n _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\n }\n\n // This also deletes the contents at the last position of the array\n delete _ownedTokensIndex[tokenId];\n delete _ownedTokens[from][lastTokenIndex];\n }\n\n /**\n * @dev Private function to remove a token from this extension's token tracking data structures.\n * This has O(1) time complexity, but alters the order of the _allTokens array.\n * @param tokenId uint256 ID of the token to be removed from the tokens list\n */\n function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {\n // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and\n // then delete the last slot (swap and pop).\n\n uint256 lastTokenIndex = _allTokens.length - 1;\n uint256 tokenIndex = _allTokensIndex[tokenId];\n\n // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so\n // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding\n // an 'if' statement (like in _removeTokenFromOwnerEnumeration)\n uint256 lastTokenId = _allTokens[lastTokenIndex];\n\n _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\n _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\n\n // This also deletes the contents at the last position of the array\n delete _allTokensIndex[tokenId];\n _allTokens.pop();\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[46] private __gap;\n}\n" }, "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721EnumerableUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721Upgradeable.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721EnumerableUpgradeable is IERC721Upgradeable {\n /**\n * @dev Returns the total amount of tokens stored by the contract.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns a token ID owned by `owner` at a given `index` of its token list.\n * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.\n */\n function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);\n\n /**\n * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.\n * Use along with {totalSupply} to enumerate all tokens.\n */\n function tokenByIndex(uint256 index) external view returns (uint256);\n}\n" }, "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721URIStorageUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/extensions/ERC721URIStorage.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC721Upgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev ERC721 token with storage based token URI management.\n */\nabstract contract ERC721URIStorageUpgradeable is Initializable, ERC721Upgradeable {\n function __ERC721URIStorage_init() internal onlyInitializing {\n }\n\n function __ERC721URIStorage_init_unchained() internal onlyInitializing {\n }\n using StringsUpgradeable for uint256;\n\n // Optional mapping for token URIs\n mapping(uint256 => string) private _tokenURIs;\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory _tokenURI = _tokenURIs[tokenId];\n string memory base = _baseURI();\n\n // If there is no base URI, return the token URI.\n if (bytes(base).length == 0) {\n return _tokenURI;\n }\n // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).\n if (bytes(_tokenURI).length > 0) {\n return string(abi.encodePacked(base, _tokenURI));\n }\n\n return super.tokenURI(tokenId);\n }\n\n /**\n * @dev Sets `_tokenURI` as the tokenURI of `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {\n require(_exists(tokenId), \"ERC721URIStorage: URI set of nonexistent token\");\n _tokenURIs[tokenId] = _tokenURI;\n }\n\n /**\n * @dev See {ERC721-_burn}. This override additionally checks to see if a\n * token-specific URI was set for the token, and if so, it deletes the token URI from\n * the storage mapping.\n */\n function _burn(uint256 tokenId) internal virtual override {\n super._burn(tokenId);\n\n if (bytes(_tokenURIs[tokenId]).length != 0) {\n delete _tokenURIs[tokenId];\n }\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/ERC721/extensions/ERC721BurnableUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/extensions/ERC721Burnable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC721Upgradeable.sol\";\nimport \"../../../utils/ContextUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @title ERC721 Burnable Token\n * @dev ERC721 Token that can be burned (destroyed).\n */\nabstract contract ERC721BurnableUpgradeable is Initializable, ContextUpgradeable, ERC721Upgradeable {\n function __ERC721Burnable_init() internal onlyInitializing {\n }\n\n function __ERC721Burnable_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev Burns `tokenId`. See {ERC721-_burn}.\n *\n * Requirements:\n *\n * - The caller must own `tokenId` or be an approved operator.\n */\n function burn(uint256 tokenId) public virtual {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner nor approved\");\n _burn(tokenId);\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/utils/CountersUpgradeable.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 CountersUpgradeable {\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-upgradeable/access/AccessControlEnumerableUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControlEnumerableUpgradeable.sol\";\nimport \"./AccessControlUpgradeable.sol\";\nimport \"../utils/structs/EnumerableSetUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerableUpgradeable is Initializable, IAccessControlEnumerableUpgradeable, AccessControlUpgradeable {\n function __AccessControlEnumerable_init() internal onlyInitializing {\n }\n\n function __AccessControlEnumerable_init_unchained() internal onlyInitializing {\n }\n using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet;\n\n mapping(bytes32 => EnumerableSetUpgradeable.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override {\n super._grantRole(role, account);\n _roleMembers[role].add(account);\n }\n\n /**\n * @dev Overload {_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override {\n super._revokeRole(role, account);\n _roleMembers[role].remove(account);\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/access/IAccessControlEnumerableUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControlUpgradeable.sol\";\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerableUpgradeable is IAccessControlUpgradeable {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n" }, "@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControlUpgradeable {\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 {AccessControl-_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 Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) external view returns (bool);\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 {AccessControl-_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\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;\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;\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}\n" }, "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControlUpgradeable.sol\";\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../utils/StringsUpgradeable.sol\";\nimport \"../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev 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 */\nabstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {\n function __AccessControl_init() internal onlyInitializing {\n }\n\n function __AccessControl_init_unchained() internal onlyInitializing {\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 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]{40}) is missing role (0x[0-9a-f]{64})$/\n *\n * _Available since v4.1._\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\n return _roles[role].members[account];\n }\n\n /**\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\n * Overriding this function changes the behavior of the {onlyRole} modifier.\n *\n * Format of the revert message is described in {_checkRole}.\n *\n * _Available since v4.6._\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\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]{40}) is missing role (0x[0-9a-f]{64})$/\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\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 virtual override 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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual override 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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual override 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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address account) public virtual override {\n require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\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 * May emit a {RoleGranted} event.\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 * NOTE: This function is deprecated in favor of {_grantRole}.\n */\n function _setupRole(bytes32 role, address account) internal virtual {\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 virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n emit RoleGranted(role, account, _msgSender());\n }\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n }\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/structs/EnumerableSetUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSetUpgradeable {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastValue;\n // Update the index for the moved value\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n return _values(set._inner);\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n" }, "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.3) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../StringsUpgradeable.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 ECDSAUpgradeable {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV\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 } else if (error == RecoverError.InvalidSignatureV) {\n revert(\"ECDSA: invalid signature 'v' 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 if (v != 27 && v != 28) {\n return (address(0), RecoverError.InvalidSignatureV);\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\", StringsUpgradeable.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/introspection/ERC165.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" }, "@openzeppelin/contracts/utils/introspection/IERC165.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" }, "@openzeppelin/contracts/token/ERC721/ERC721.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _owners[tokenId];\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner nor approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner nor approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner nor approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _owners[tokenId] != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId);\n\n _balances[to] += 1;\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId);\n\n // Clear approvals\n _approve(address(0), tokenId);\n\n _balances[owner] -= 1;\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId);\n\n // Clear approvals from the previous owner\n _approve(address(0), tokenId);\n\n _balances[from] -= 1;\n _balances[to] += 1;\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting\n * and burning.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\n * transferred to `to`.\n * - When `from` is zero, `tokenId` will be minted for `to`.\n * - When `to` is zero, ``from``'s `tokenId` 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 tokenId\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.\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 tokenId\n ) internal virtual {}\n}\n" }, "@openzeppelin/contracts/token/ERC721/IERC721.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" }, "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" }, "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" }, "@openzeppelin/contracts/utils/Address.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.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 functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\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 require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason 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 // 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}\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/Strings.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _HEX_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 // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\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 if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\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] = _HEX_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" } }, "settings": { "metadata": { "useLiteralContent": true }, "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } } } }}
1
20,290,570
ec04d1f9045773d2f2a90f8e0a28bcb79613fe33b816d6cf7392f5f77a960ae7
3de8c7225ec44e2e7af9eeca01f360460553344ddf18ca7058be5f14b5f68048
7f3e9325427957a148329e3663b3b314360aa74a
a6b71e26c5e0845f74c812102ca7114b6a896ab2
8da8a4383b043f0a73854b3ad5e297834d709a00
608060405234801561001057600080fd5b506040516101e63803806101e68339818101604052602081101561003357600080fd5b8101908080519060200190929190505050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156100ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806101c46022913960400191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505060ab806101196000396000f3fe608060405273ffffffffffffffffffffffffffffffffffffffff600054167fa619486e0000000000000000000000000000000000000000000000000000000060003514156050578060005260206000f35b3660008037600080366000845af43d6000803e60008114156070573d6000fd5b3d6000f3fea2646970667358221220d1429297349653a4918076d650332de1a1068c5f3e07c5c82360c277770b955264736f6c63430007060033496e76616c69642073696e676c65746f6e20616464726573732070726f7669646564000000000000000000000000d9db270c1b5e3bd161e8c8503c55ceabee709552
608060405273ffffffffffffffffffffffffffffffffffffffff600054167fa619486e0000000000000000000000000000000000000000000000000000000060003514156050578060005260206000f35b3660008037600080366000845af43d6000803e60008114156070573d6000fd5b3d6000f3fea2646970667358221220d1429297349653a4918076d650332de1a1068c5f3e07c5c82360c277770b955264736f6c63430007060033
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.7.0 <0.9.0; /// @title IProxy - Helper interface to access masterCopy of the Proxy on-chain /// @author Richard Meissner - <[email protected]> interface IProxy { function masterCopy() external view returns (address); } /// @title GnosisSafeProxy - Generic proxy contract allows to execute all transactions applying the code of a master contract. /// @author Stefan George - <[email protected]> /// @author Richard Meissner - <[email protected]> contract GnosisSafeProxy { // singleton always needs to be first declared variable, to ensure that it is at the same location in the contracts to which calls are delegated. // To reduce deployment costs this variable is internal and needs to be retrieved via `getStorageAt` address internal singleton; /// @dev Constructor function sets address of singleton contract. /// @param _singleton Singleton address. constructor(address _singleton) { require(_singleton != address(0), "Invalid singleton address provided"); singleton = _singleton; } /// @dev Fallback function forwards all transactions and returns all received return data. fallback() external payable { // solhint-disable-next-line no-inline-assembly assembly { let _singleton := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff) // 0xa619486e == keccak("masterCopy()"). The value is right padded to 32-bytes with 0s if eq(calldataload(0), 0xa619486e00000000000000000000000000000000000000000000000000000000) { mstore(0, _singleton) return(0, 0x20) } calldatacopy(0, 0, calldatasize()) let success := delegatecall(gas(), _singleton, 0, calldatasize(), 0, 0) returndatacopy(0, 0, returndatasize()) if eq(success, 0) { revert(0, returndatasize()) } return(0, returndatasize()) } } } /// @title Proxy Factory - Allows to create new proxy contact and execute a message call to the new proxy within one transaction. /// @author Stefan George - <[email protected]> contract GnosisSafeProxyFactory { event ProxyCreation(GnosisSafeProxy proxy, address singleton); /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction. /// @param singleton Address of singleton contract. /// @param data Payload for message call sent to new proxy contract. function createProxy(address singleton, bytes memory data) public returns (GnosisSafeProxy proxy) { proxy = new GnosisSafeProxy(singleton); if (data.length > 0) // solhint-disable-next-line no-inline-assembly assembly { if eq(call(gas(), proxy, 0, add(data, 0x20), mload(data), 0, 0), 0) { revert(0, 0) } } emit ProxyCreation(proxy, singleton); } /// @dev Allows to retrieve the runtime code of a deployed Proxy. This can be used to check that the expected Proxy was deployed. function proxyRuntimeCode() public pure returns (bytes memory) { return type(GnosisSafeProxy).runtimeCode; } /// @dev Allows to retrieve the creation code used for the Proxy deployment. With this it is easily possible to calculate predicted address. function proxyCreationCode() public pure returns (bytes memory) { return type(GnosisSafeProxy).creationCode; } /// @dev Allows to create new proxy contact using CREATE2 but it doesn't run the initializer. /// This method is only meant as an utility to be called from other methods /// @param _singleton Address of singleton contract. /// @param initializer Payload for message call sent to new proxy contract. /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. function deployProxyWithNonce( address _singleton, bytes memory initializer, uint256 saltNonce ) internal returns (GnosisSafeProxy proxy) { // If the initializer changes the proxy address should change too. Hashing the initializer data is cheaper than just concatinating it bytes32 salt = keccak256(abi.encodePacked(keccak256(initializer), saltNonce)); bytes memory deploymentData = abi.encodePacked(type(GnosisSafeProxy).creationCode, uint256(uint160(_singleton))); // solhint-disable-next-line no-inline-assembly assembly { proxy := create2(0x0, add(0x20, deploymentData), mload(deploymentData), salt) } require(address(proxy) != address(0), "Create2 call failed"); } /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction. /// @param _singleton Address of singleton contract. /// @param initializer Payload for message call sent to new proxy contract. /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. function createProxyWithNonce( address _singleton, bytes memory initializer, uint256 saltNonce ) public returns (GnosisSafeProxy proxy) { proxy = deployProxyWithNonce(_singleton, initializer, saltNonce); if (initializer.length > 0) // solhint-disable-next-line no-inline-assembly assembly { if eq(call(gas(), proxy, 0, add(initializer, 0x20), mload(initializer), 0, 0), 0) { revert(0, 0) } } emit ProxyCreation(proxy, _singleton); } /// @dev Allows to create new proxy contact, execute a message call to the new proxy and call a specified callback within one transaction /// @param _singleton Address of singleton contract. /// @param initializer Payload for message call sent to new proxy contract. /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. /// @param callback Callback that will be invoced after the new proxy contract has been successfully deployed and initialized. function createProxyWithCallback( address _singleton, bytes memory initializer, uint256 saltNonce, IProxyCreationCallback callback ) public returns (GnosisSafeProxy proxy) { uint256 saltNonceWithCallback = uint256(keccak256(abi.encodePacked(saltNonce, callback))); proxy = createProxyWithNonce(_singleton, initializer, saltNonceWithCallback); if (address(callback) != address(0)) callback.proxyCreated(proxy, _singleton, initializer, saltNonce); } /// @dev Allows to get the address for a new proxy contact created via `createProxyWithNonce` /// This method is only meant for address calculation purpose when you use an initializer that would revert, /// therefore the response is returned with a revert. When calling this method set `from` to the address of the proxy factory. /// @param _singleton Address of singleton contract. /// @param initializer Payload for message call sent to new proxy contract. /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. function calculateCreateProxyWithNonceAddress( address _singleton, bytes calldata initializer, uint256 saltNonce ) external returns (GnosisSafeProxy proxy) { proxy = deployProxyWithNonce(_singleton, initializer, saltNonce); revert(string(abi.encodePacked(proxy))); } } interface IProxyCreationCallback { function proxyCreated( GnosisSafeProxy proxy, address _singleton, bytes calldata initializer, uint256 saltNonce ) external; }
1
20,290,576
85ebe7be7497fcea42eeec3cfdb71478daa7e97f4cd33c2c82aafb454342304f
c0a66b5ea262407cb576043050c5044310cc462c5c00eadaa90d0c088cfa9b1c
f7bd34dd44b92fb2f9c3d2e31aaad06570a853a6
6a8cbed756804b16e05e741edabd5cb544ae21bf
b73527615c25ac2d226db2581525f69968926caf
615c335150346109c2576020615ddc5f395f516020602082615ddc015f395f51116109c2576020602082615ddc015f395f51018082615ddc0160803950506020615dfc5f395f51600a602082615ddc015f395f51116109c2576020602082615ddc015f395f51018082615ddc0160c03950506020615e9c5f395f516008602082615ddc015f395f51116109c257602081615ddc015f395f515f81600881116109c25780156100d857905b60208160051b6020860101615ddc015f395f518060a01c6109c2578160051b61012001526001018181186100a9575b5050806101005250506020615ebc5f395f516008602082615ddc015f395f51116109c257602081615ddc015f395f5160208160051b018083615ddc01610220395050506020615edc5f395f516008602082615ddc015f395f51116109c257602081615ddc015f395f515f81600881116109c257801561018257905b60208160051b6020860101615ddc015f395f518060081c6109c2578160051b6103600152600101818118610153575b5050806103405250506020615efc5f395f516008602082615ddc015f395f51116109c257602081615ddc015f395f515f81600881116109c25780156101f257905b60208160051b6020860101615ddc015f395f518060201b6109c2578160051b61048001526001018181186101c3575b5050806104605250506020615f1c5f395f516008602082615ddc015f395f51116109c257602081615ddc015f395f515f81600881116109c257801561026257905b60208160051b6020860101615ddc015f395f518060a01c6109c2578160051b6105a00152600101818118610233575b5050806105805250506101005160208160051b015f81601f0160051c600981116109c25780156102ae57905b8060051b61010001518160051b6060016153f3015260010181811861028e575b505050506103405160208160051b015f81601f0160051c600981116109c25780156102f657905b8060051b61034001518160051b610180016153f301526001018181186102d5575b505050505f6106a0525f61557351600881116109c257801561033e57905b60028160051b6101a0016153f30151186103335760016106a05261033e565b600101818118610314575b50506106a05161569352610100516106a0526106a0516153f3526106a05180607f1c6109c257615413526102205160208160051b015f81601f0160051c600981116109c25780156103ac57905b8060051b61022001518160051b6102c0016153f3015260010181811861038b575b50505050336154335260646020615e1c5f395f51026106c0526106c051600c556106c051600d556020615e3c5f395f51600a556020615e5c5f395f51600b556020615e7c5f395f51156109c2576020615e7c5f395f5160235561f374602455426040524260605261041e6106e0610981565b6106e0516025555f6106e0525f610800525f610920525f61541351600881116109c257801561070a57905b80610a4052615413516001810380600f0b81186109c2579050610a405112156104ac57601954600781116109c257670de0b6b3a7640000604052670de0b6b3a764000060605261049a610a60610981565b610a605181601a015560018101601955505b61092051600781116109c257610a4051610580518110156109c25760051b6105a00151610a4051610460518110156109c25760051b61048001518060e01c90508060e01b818160e01c186109c2579050178160051b6109400152600181016109205250600154600781116109c2575f81600201556001810160015550601054600781116109c2575f816011015560018101601055506003610a4051610340518110156109c25760051b6103600151186106c0576106e051600781116109c257610a4051610100518110156109c25760051b610120015163313ce567610a60526020610a606004610a7c845afa6105a4573d5f5f3e3d5ffd5b60203d106109c257610a60518060081c6109c257610aa052610aa0905051604d81116109c25780600a0a90508160051b6107000152600181016106e05250610a4051610100518110156109c25760051b61012001516338d52e0f610a80526020610a806004610a9c845afa61061b573d5f5f3e3d5ffd5b60203d106109c257610a80518060a01c6109c257610ac052610ac0905051610a605261080051600781116109c257610a605163313ce567610a80526020610a806004610a9c845afa61066f573d5f5f3e3d5ffd5b60203d106109c257610a80518060081c6109c257610ac052610ac090505180601203601281116109c2579050604d81116109c25780600a0a90508160051b61082001526001810161080052506106ff565b6106e051600781116109c2575f8160051b6107000152600181016106e0525061080051600781116109c2575f8160051b61082001526001810161080052505b600101818118610449575b50506106e05160208160051b015f81601f0160051c600981116109c257801561075057905b8060051b6106e001518160051b610500016153f3015260010181811861072f575b505050506108005160208160051b015f81601f0160051c600981116109c257801561079857905b8060051b61080001518160051b610620016153f30152600101818118610777575b505050506109205160208160051b015f81601f0160051c600981116109c25780156107e057905b8060051b61092001518160051b6103e0016153f301526001018181186107bf575b505050506020608051015f81601f0160051c600281116109c257801561082257905b8060051b608001518160051b610740016153f30152600101818118610802575b505050602060c051015f81601f0160051c600281116109c257801561086357905b8060051b60c001518160051b6107a0016153f30152600101818118610843575b5050506020615b3351015f81601f0160051c600381116109c25780156108a657905b8060051b610740016153f301518160051b610a400152600101818118610885575b505050610a40805160208201209050615bd3526001430340615c135246615bf3527fd87cd6ef79d4e2b95e15ce8abf732db51ec771f1ca2edccf22a46c729ac56472610a6052615bd351610a80527f1c54f243822e0e9a0a377610b81577e771b3efe79964e76636b0d5d10247950d610aa05246610ac05230610ae052615c1351610b005260c0610a4052610a40805160208201209050615c3352335f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef5f610a40526020610a40a36153f36109c661000039615c53610000f35b6fffffffffffffffffffffffffffffffff604051116109c2576fffffffffffffffffffffffffffffffff606051116109c25760605160801b60405117815250565b5f80fd5f3560e01c60056005600683060261522a01601b395f51600760078260ff16848460181c0260181c06028260081c61ffff1601601939505f51818160181c14600336111661004c5761294e565b8060fe16361034826001160217615226578060081c61ffff16565b60206153f360403960206040f35b602060043560206154535f395f518110156152265760051b6080016153f30160403960206040f35b600a5460405260206040f35b600b5460405260206040f35b64012a05f20060405260206040f35b600c5460405260206040f35b600d5460405260206040f35b600e5460405260206040f35b600f5460405260206040f35b600435601054811015615226576011015460405260206040f35b60235460405260206040f35b60245460405260206040f35b60255460405260206040f35b6020806040528060400160206020615b335f395f510180615b338339508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f35b6020806040528060400160206020615b935f395f510180615b938339508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f35b601260405260206040f35b60208060805260066040527f76372e302e30000000000000000000000000000000000000000000000000000060605260408160800181518152602082015160208201528051806020830101601f825f03163682375050601f19601f8251602001011690509050810190506080f35b6004358060a01c6152265760405260266040516020525f5260405f205460605260206060f35b6004358060a01c615226576040526024358060a01c6152265760605260276040516020525f5260405f20806060516020525f5260405f2090505460805260206080f35b6004358060a01c6152265760405260296040516020525f5260405f205460605260206060f35b6020615c1360403960206040f35b33611360526102ee565b6084358060a01c61522657611360525b60043580600f0b8118615226576113205260243580600f0b811861522657611340525f546002146152265760025f55602033610dc05261132051610de05261134051610e005260406044610e203761136051610e60525f610e8052610354611380614466565b61138060035f55f35b3361136052610377565b6084358060a01c61522657611360525b60043580600f0b8118615226576113205260243580600f0b811861522657611340525f546002146152265760025f5560206156935f395f5161522657602033610dc05261132051610de05261134051610e005260406044610e203761136051610e60526001610e80526103eb611380614466565b61138060035f55f35b33610a805261040e565b6044358060a01c61522657610a80525b600435600401600881351161522657803560208160051b018083610960375050505f546002146152265760025f55610a80511561522657610450610ac061323c565b610ac051610aa052610463610be0613055565b610be0805160208160051b0180610ac0828560045afa50505050610488610d00612d26565b610d00805160208160051b0180610be0828560045afa50505050610be05160208160051b01806103c082610be060045afa505050610ac05160208160051b01806104e082610ac060045afa505050610aa051610600526104e9610d20614714565b610d2051610d0052602854610d2052610ac05160208160051b0180610d4082610ac060045afa5050505f60206154135f395f51600881116152265780156105c857905b80610e6052610e6051610960518110156152265760051b6109800151156105b357610e6051610d40518110156152265760051b610d60018051610e6051604052610e6051610960518110156152265760051b6109800151606052336080525f60a052610599610e80612993565b610e805180820182811061522657905090508152506105bd565b610d205115615226575b60010181811861052c575b5050610be05160208160051b01806103c082610be060045afa505050610d405160208160051b01806104e082610d4060045afa505050610aa05161060052610611610e80614714565b610e8051610e6052610d0051610e60511115615226575f610e80525f610fa052610d2051156109a857606036610fc03760206153f35f395f51610d0051610e60518082018281106152265790509050046110205260403661104037600160206153f35f395f510360021b60206153f35f395f51600a540204611080525f60206154135f395f51600881116152265780156108ad57905b806110a052610e60516110a051610ac0518110156152265760051b610ae001518082028115838383041417156152265790509050610d005180156152265780820490509050610fc0525f610fe0526110a051610d40518110156152265760051b610d6001516110005261100051610fc0511161072f57610fc0516110005103610fe05261073d565b61100051610fc05103610fe0525b670de0b6b3a76400006110a051610be0518110156152265760051b610c0001516110a051610ac0518110156152265760051b610ae00151611000518082018281106152265790509050808202811583838304141715615226579050905004611040526110405160405261102051606052611080516080526107bf6110c06138c4565b6110c05161106052610e805160078111615226576402540be40061106051610fe0518082028115838383041417156152265790509050048160051b610ea0015260018101610e8052506110a0516010548110156152265760110180546402540be4006110a051610e80518110156152265760051b610ea0015164012a05f20081028164012a05f2008204186152265790500480820182811061522657905090508155506110a051610d40518110156152265760051b610d600180516110a051610e80518110156152265760051b610ea0015180820382811161522657905090508152506001018181186106a7575b5050610be05160208160051b0180604082610be060045afa505050610d405160208160051b018061016082610d4060045afa5050506108ed6111c0613188565b6111c0805160208160051b01806110a0828560045afa505050506110a05160208160051b01806040826110a060045afa505050610aa051610160526109336111c0613347565b6111c051610e6052610d0051610d2051610e6051610d00518082038281116152265790509050808202811583838304141715615226579050905004610fa0526110a05160208160051b0180610340826110a060045afa505050610aa05161046052610e605161048052610a23613ed056610a23565b610e6051610fa052610e6051604052610e60516060526109c9610fc0612952565b610fc0516022556025546040526109e1611000613984565b6110006040610fc060408360045afa505042610fe0511015610a235742610fe052610fc051604052610fe051606052610a1b611000612952565b611000516025555b602435610fa0511015610a95576014610fc0527f536c697070616765207363726577656420796f75000000000000000000000000610fe052610fc050610fc05180610fe001601f825f031636823750506308c379a0610f80526020610fa052601f19601f610fc0510116604401610f9cfd5b610d2051610fa0518082018281106152265790509050610d20526026610a80516020525f5260405f208054610fa0518082018281106152265790509050815550610d2051602855610a80515f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef610fa051610fc0526020610fc0a3337f189c623b666b1b45b83d7178f39b8c087cb09774317ca2f53c2d3c3726f222a2608080610fc05280610fc0015f610960518083528060051b5f8260088111615226578015610b7a57905b8060051b61098001518160051b602088010152600101818118610b5c575b5050820160200191505090508101905080610fe05280610fc0015f610e80518083528060051b5f8260088111615226578015610bd057905b8060051b610ea001518160051b602088010152600101818118610bb2575b50508201602001915050905081019050610e605161100052610d205161102052610fc0a26020610fa060035f55f35b33610b0052610c19565b6064358060a01c61522657610b00525b60243580600f0b811861522657610ae0525f546002146152265760025f556004351561522657606036610b20375f610c80525f610ca0526004356103c052610ae0516103e052610c6a610cc0614a57565b610cc08051610b20526020810151610b405260408101805160208160051b0180610b60828560045afa50505050610160810151610c8052610180810151610ca05250604435610b20511015610d1e576018610cc0527f4e6f7420656e6f75676820636f696e732072656d6f7665640000000000000000610ce052610cc050610cc05180610ce001601f825f031636823750506308c379a0610c80526020610ca052601f19601f610cc0510116604401610c9cfd5b610ae0516010548110156152265760110180546402540be400610b405164012a05f20081028164012a05f20082041861522657905004808201828110615226579050905081555033604052600435606052610d77614f3d565b610ae051604052610b2051606052610b0051608052610d94612b55565b337f6f48129db1f37ccb9cc5dd7e119cb32750cabdf75b48375d730d26ce3659bbe1610ae051610cc052600435610ce052610b2051610d0052602854610d20526080610cc0a2610b605160208160051b018061034082610b6060045afa505050610c805161046052610ca05161048052610e0c613ed0565b6020610b2060035f55f35b33610a8052610e31565b6044358060a01c61522657610a80525b600435600401600881351161522657803560208160051b018083610960375050505f546002146152265760025f55610e6a610ac061323c565b610ac051610aa052610e7d610be0612d26565b610be0805160208160051b0180610ac0828560045afa50505050610ea2610d00613055565b610d00805160208160051b0180610be0828560045afa50505050610ac05160208160051b01806103c082610ac060045afa505050610be05160208160051b01806104e082610be060045afa505050610aa05161060052610f03610d20614714565b610d2051610d0052610be05160208160051b0180610d2082610be060045afa5050505f60206154135f395f5160088111615226578015610fdb57905b80610e4052610e4051610960518110156152265760051b610980015115610fd057610e4051610d20518110156152265760051b610d40018051610e4051610960518110156152265760051b61098001518082038281116152265790509050815250610e4051604052610e4051610960518110156152265760051b6109800151606052610a8051608052610fd0612b55565b600101818118610f3f575b5050610ac05160208160051b01806103c082610ac060045afa505050610d205160208160051b01806104e082610d2060045afa505050610aa05161060052611024610e60614714565b610e6051610e4052600160206153f35f395f510360021b60206153f35f395f51600a540204610e605260206153f35f395f51610d0051610e4051808201828110615226579050905004610e80525f610ea0525f610fc052608036610fe0375f60206154135f395f51600881116152265780156112a257905b8061106052610e405161106051610be0518110156152265760051b610c0001518082028115838383041417156152265790509050610d005180156152265780820490509050611000525f6110205261106051610d20518110156152265760051b610d400151611040526110405161100051116111245761100051611040510361102052611132565b611040516110005103611020525b670de0b6b3a764000061106051610ac0518110156152265760051b610ae0015161106051610be0518110156152265760051b610c000151611040518082018281106152265790509050808202811583838304141715615226579050905004610fe052610fe051604052610e8051606052610e60516080526111b46110806138c4565b61108051610fc052610ea05160078111615226576402540be400610fc051611020518082028115838383041417156152265790509050048160051b610ec0015260018101610ea05250611060516010548110156152265760110180546402540be40061106051610ea0518110156152265760051b610ec0015164012a05f20081028164012a05f20082041861522657905004808201828110615226579050905081555061106051610d20518110156152265760051b610d4001805161106051610ea0518110156152265760051b610ec00151808203828111615226579050905081525060010181811861109c575b5050610ac05160208160051b01806103c082610ac060045afa505050610d205160208160051b01806104e082610d2060045afa505050610aa051610600526112eb611060614714565b61106051610e4052610ac05160208160051b0180604082610ac060045afa505050610d205160208160051b018061016082610d2060045afa505050611331611060613188565b611060805160208160051b0180611180828560045afa50505050610aa0516112a052610e40516112c05261016061034061016061118060045afa50611374613ed0565b60285461106052610d0051610d0051610e40518082038281116152265790509050611060518082028115838383041417156152265790509050046001810181811061522657905061108052600261108051106152265760243561108051111561143c5760146110a0527f536c697070616765207363726577656420796f750000000000000000000000006110c0526110a0506110a051806110c001601f825f031636823750506308c379a061106052602061108052601f19601f6110a051011660440161107cfd5b336040526110805160605261144f614f3d565b337f3631c28b1f9dd213e0319fb167b554d76b6c283a41143eb400a0d1adb1af17556080806110a052806110a0015f610960518083528060051b5f82600881116152265780156114b957905b8060051b61098001518160051b60208801015260010181811861149b575b50508201602001915050905081019050806110c052806110a0015f610ea0518083528060051b5f826008811161522657801561150f57905b8060051b610ec001518160051b6020880101526001018181186114f1575b50508201602001915050905081019050610e40516110e05261106051611080518082038281116152265790509050611100526110a0a2602061108060035f55f35b336103c05260016103e052611599565b6044358060a01c615226576103c05260016103e052611599565b6044358060a01c615226576103c0526064358060011c615226576103e0525b602435600401600881351161522657803560208160051b0180836102a0375050505f546002146152265760025f5560285461040052600435156152265760206153f35f395f516102a05118615226575f610420526115f8610660613055565b610660805160208160051b0180610540828560045afa505050505f610660525f60206154135f395f516008811161522657801561176257905b80610680526104005161068051610540518110156152265760051b610560015160043580820281158383830414171561522657905090500461066052610680516102a0518110156152265760051b6102c001516106605110156117185760306106a0527f5769746864726177616c20726573756c74656420696e20666577657220636f696106c0527f6e73207468616e206578706563746564000000000000000000000000000000006106e0526106a0506106a051806106c001601f825f031636823750506308c379a061066052602061068052601f19601f6106a051011660440161067cfd5b610420516007811161522657610660518160051b610440015260018101610420525061068051604052610660516060526103c051608052611757612b55565b600101818118611631575b505033604052600435606052611776614f3d565b6025546040526117876106c0613984565b6106c0604061068060408360045afa50506022546106c0526fffffffffffffffffffffffffffffffff6106c051166106e0526106e051610400516106e0516004358082028115838383041417156152265790509050048082038281116152265790509050610740526106c05161012052602454610140526106a05161016052611811610700613dc6565b610700516107605260406040604061074060045afa50611832610720612952565b61072051602255426106a051101561186a57426106a052610680516040526106a051606052611862610700612952565b610700516025555b337f347ad828e58cbe534d8f6b67985d791360756b18f0d95fd9f197a66cc46480ea6060806107005280610700015f610420518083528060051b5f82600881116152265780156118d457905b8060051b61044001518160051b6020880101526001018181186118b6575b50508201602001915050905081019050806107205280610700015f5f82525f5f5f6008811161522657801561191b57905b5f8160051b602087010152600101818118611905575b505081016020019050905081019050600435610400510361074052610700a26103e0511561194b5761194b614faa565b6020806107005280610700015f610420518083528060051b5f826008811161522657801561199357905b8060051b61044001518160051b602088010152600101818118611975575b5050820160200191505090508101905061070060035f55f35b5f546002146152265760025f556119c1614faa565b60035f55005b6fffffffffffffffffffffffffffffffff60043560195481101561522657601a01541660405260206040f35b60043560195481101561522657601a015460801c60405260206040f35b611a1b6103e061323c565b6103e0516103c052611a2e610500612d26565b610500805160208160051b0180610860828560045afa50505050611a53610620613055565b610620805160208160051b0180610980828560045afa50505050610240604061024061086060045afa50611a88610740613188565b610740805160208160051b01806103e0828560045afa505050506103e05160208160051b01806040826103e060045afa5050506103c05161016052611ace610520613347565b610520516105005260206103e05160208160051b01806040826103e060045afa5050506103c051610160526105005161018052611b0c6105206139a9565b61052060043581518110156152265760051b60208201019050f35b5f5460021461522657602060043560195481101561522657601a015461012052602354610140526fffffffffffffffffffffffffffffffff6025541661016052611b72610200613dc6565b610200f35b5f54600214615226576020602254610120526024546101405260255460801c61016052611ba5610200613dc6565b610200f35b6004358060a01c6152265760c0523360405260c051606052602435608052611bd06151aa565b600160e052602060e0f35b6004358060a01c6152265760c0526024358060a01c6152265760e05260c05160405260e051606052604435608052611c116151aa565b602760c0516020525f5260405f2080336020525f5260405f20905054610100527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101005114611cc8576101005160443580820382811161522657905090506101205261012051602760c0516020525f5260405f2080336020525f5260405f209050553360c0517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92561012051610140526020610140a35b6001610120526020610120f35b6004358060a01c615226576040526024356027336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560243560605260206060a3600160605260206060f35b6004358060a01c61522657610120526024358060a01c61522657610140526084358060081c61522657610160526101205115615226576064354211615226576029610120516020525f5260405f2054610180525f60026101c0527f19010000000000000000000000000000000000000000000000000000000000006101e0526101c0805160208201836103200181518152505080830192505050611de2610200615117565b610200518161032001526020810190507f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c961024052610120516102605261014051610280526044356102a052610180516102c0526064356102e05260c061022052610220805160208201209050816103200152602081019050806103005261030090508051602082012090506101a052610120513b15611fab575f604060a46102603760406102405261024080516020820183610320018281848460045afa50505080830192505050610160516102a0526102a0601f810180516102e0525060016102c0526102c09050805160208201836103200181518152505080830192505050806103005261030090506020815101806101c0828460045afa5050507f1626ba7e0000000000000000000000000000000000000000000000000000000061012051631626ba7e6102405260406101a051610260528061028052806102600160206101c051018082826101c060045afa50508051806020830101601f825f03163682375050601f19601f82516020010116905081015050602061024060c461025c845afa611f93573d5f5f3e3d5ffd5b60203d10615226576102409050511861522657611feb565b610120515f610240526101a0516101c052610160516101e05260a4356102005260c43561022052602061024060806101c060015afa506102405118615226575b6044356027610120516020525f5260405f2080610140516020525f5260405f20905055600161018051016029610120516020525f5260405f205561014051610120517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9256044356101c05260206101c0a360016101c05260206101c0f35b6020612075610120615117565b610120f35b60043580600f0b81186152265760405260243580600f0b811861522657606052602060206154335f395f5163e31593d8608052602060806004609c845afa6120c4573d5f5f3e3d5ffd5b60203d10615226576080518060a01c6152265760c05260c09050516383aa796a60e0526040516101005260605161012052604435610140523061016052602060e0608460fc845afa612118573d5f5f3e3d5ffd5b60203d106152265760e09050f35b60043580600f0b81186152265760405260243580600f0b811861522657606052602060206154335f395f5163e31593d8608052602060806004609c845afa612170573d5f5f3e3d5ffd5b60203d10615226576080518060a01c6152265760c05260c0905051630c601c2c60e0526040516101005260605161012052604435610140523061016052602060e0608460fc845afa6121c4573d5f5f3e3d5ffd5b60203d106152265760e09050f35b60243580600f0b811861522657610ae05260206004356103c052610ae0516103e0526121ff610b00614a57565b610b00f35b5f546002146152265760285460405260206040f35b5f546002146152265761222d6103e061323c565b6103e0516103c052612240610500612d26565b610500805160208160051b0180610860828560045afa50505050612265610620613055565b610620805160208160051b0180610980828560045afa50505050610240604061024061086060045afa5061229a610740613188565b610740805160208160051b01806103e0828560045afa505050506103e05160208160051b01806040826103e060045afa5050506103c051610160526122e0610520613347565b610520516105005261050051670de0b6b3a7640000810281670de0b6b3a764000082041861522657905060285480156152265780820490509050610520526020610520f35b600435600401600881351161522657803560208160051b0180836040375050506024358060011c6152265761016052602060206154335f395f5163e31593d8610180526020610180600461019c845afa612381573d5f5f3e3d5ffd5b60203d1061522657610180518060a01c615226576101c0526101c090505163fb79eb276101e0526060806102005280610200015f6040518083528060051b5f82600881116152265780156123ee57905b8060051b606001518160051b6020880101526001018181186123d1575b50508201602001915050905081019050610160516102205230610240525060206101e06101846101fc845afa612426573d5f5f3e3d5ffd5b60203d10615226576101e09050f35b606461244160c061323c565b60c0510460e052602060e0f35b602061245a60c061323c565b60c0f35b602061246b6101e0613055565b6101e060043581518110156152265760051b60208201019050f35b602080610300526124986101e0613055565b6101e081610300015f82518083528060051b5f82600881116152265780156124db57905b8060051b6020880101518160051b6020880101526001018181186124bc575b505082016020019150509050905081019050610300f35b60208061036052612504610240612d26565b61024081610360015f82518083528060051b5f826008811161522657801561254757905b8060051b6020880101518160051b602088010152600101818118612528575b505082016020019150509050905081019050610360f35b60043580600f0b81186152265760405260243580600f0b811861522657606052602060206154335f395f5163e31593d8608052602060806004609c845afa6125a8573d5f5f3e3d5ffd5b60203d10615226576080518060a01c6152265760c05260c090505163a63530bd60e05260405161010052606051610120523061014052602060e0606460fc845afa6125f5573d5f5f3e3d5ffd5b60203d106152265760e09050f35b60206154335f395f5163f851a44060c052602060c0600460dc845afa61262b573d5f5f3e3d5ffd5b60203d106152265760c0518060a01c6152265761010052610100905051331861522657600e5462015180810181811061522657905042106152265742620151808101818110615226579050602435106152265761268860e061323c565b60e05160c0526004356064810281606482041861522657905060e052600435156126ba57620f423f60043511156126bc565b5f5b156152265760c05160e051106126ec5760c051600a810281600a82041861522657905060e0511161522657612708565b60c05160e051600a810281600a82041861522657905010615226575b60c051600c5560e051600d5542600e55602435600f557fa2b71ec6df949300b59aab36b55e189697b750119dd349fcfa8c0f779e83c25460c0516101005260e051610120524261014052602435610160526080610100a1005b60206154335f395f5163f851a44060c052602060c0600460dc845afa612789573d5f5f3e3d5ffd5b60203d106152265760c0518060a01c61522657610100526101009050513318615226576127b660e061323c565b60e05160c05260c051600c5560c051600d5542600e5542600f557f46e22fb3709ad289f62ce63d469248536dbc78d82b84a3d7e74ad606dc20193860c05160e0524261010052604060e0a1005b60206154335f395f5163f851a440604052602060406004605c845afa61282b573d5f5f3e3d5ffd5b60203d10615226576040518060a01c61522657608052608090505133186152265764012a05f2006004351161522657600435600a556802b5e3af16b188000060243560043580820281158383830414171561522657905090501161522657602435600b557f750d10a7f37466ce785ee6bcb604aac543358db42afbcc332a3c12a49c80bf6d6040600460403760406040a1005b60206154335f395f5163f851a440604052602060406004605c845afa6128e6573d5f5f3e3d5ffd5b60203d10615226576040518060a01c6152265760805260809050513318615226576024356004350215615226576004356023556024356024557f68dc4e067dff1862b896b7a0faf55f97df1a60d0aaa79481b69d675f2026a28c6040600460403760406040a1005b5f5ffd5b6fffffffffffffffffffffffffffffffff60405111615226576fffffffffffffffffffffffffffffffff606051116152265760605160801b60405117815250565b602060405160206154535f395f518110156152265760051b6080016153f3015f395f516370a0823160e0523061010052602060e0602460fc845afa6129da573d5f5f3e3d5ffd5b60203d106152265760e090505160c05260a051612af6576060511561522657602060405160206154535f395f518110156152265760051b6080016153f3015f395f516323b872dd60e05260805161010052306101205260605161014052602060e0606460fc5f855af1612a4f573d5f5f3e3d5ffd5b3d612a6657803b1561522657600161016052612a7e565b60203d106152265760e0518060011c61522657610160525b6101609050511561522657602060405160206154535f395f518110156152265760051b6080016153f3015f395f516370a0823160e0523061010052602060e0602460fc845afa612ad0573d5f5f3e3d5ffd5b60203d106152265760e090505160c051808203828111615226579050905060c052612b27565b60c0516040516001548110156152265760020154808203828111615226579050905060c05260605160c05110615226575b60405160015481101561522657600201805460c051808201828110615226579050905081555060c051815250565b608051156152265760206156935f395f51612c1e576040516001548110156152265760020180546060518082038281116152265790509050815550602060405160206154535f395f518110156152265760051b6080016153f3015f395f5163a9059cbb60a05260805160c05260605160e052602060a0604460bc5f855af1612bdf573d5f5f3e3d5ffd5b3d612bf657803b1561522657600161010052612c0e565b60203d106152265760a0518060011c61522657610100525b6101009050511561522657612d24565b602060405160206154535f395f518110156152265760051b6080016153f3015f395f516370a0823160c0523060e052602060c0602460dc845afa612c64573d5f5f3e3d5ffd5b60203d106152265760c090505160a052602060405160206154535f395f518110156152265760051b6080016153f3015f395f5163a9059cbb60c05260805160e05260605161010052602060c0604460dc5f855af1612cc4573d5f5f3e3d5ffd5b3d612cdb57803b1561522657600161012052612cf3565b60203d106152265760c0518060011c61522657610120525b610120905051156152265760a051606051808203828111615226579050905060405160015481101561522657600201555b565b60206156b35f395f5160208160051b01806156b360403950505f60206154135f395f516008811161522657801561303a57905b8061016052600160206101605160206155735f395f518110156152265760051b6101a0016153f3015f395f5118612db65760206101605160206157d35f395f518110156152265760051b610400016153f3015f395f511515612db8565b5f5b612ee757600360206101605160206155735f395f518110156152265760051b6101a0016153f3015f395f511861302f57670de0b6b3a7640000610160516040518110156152265760051b6060015160206101605160206154535f395f518110156152265760051b6080016153f3015f395f516307a2d13a6101805260206101605160206158f35f395f518110156152265760051b610520016153f3016101a0396020610180602461019c845afa612e71573d5f5f3e3d5ffd5b60203d106152265761018090505180820281158383830414171561522657905090506020610160516020615a135f395f518110156152265760051b610640016153f3015f395f51808202811583838304141715615226579050905004610160516040518110156152265760051b6060015261302f565b60206101605160206157d35f395f518110156152265760051b610400016153f3015f395f5173ffffffffffffffffffffffffffffffffffffffff811690508060a01c615226575a7fffffffff0000000000000000000000000000000000000000000000000000000060206101605160206157d35f395f518110156152265760051b610400016153f3015f395f51166101e05260206101c0526101c05060206102206101c0516101e08585fa90509050612fa2573d5f5f3e3d5ffd5b3d602081183d60201002186102005261020080516101805260208101516101a0525060206101805118615226576101a0516101805160200360031b1c6101c052670de0b6b3a7640000610160516040518110156152265760051b606001516101c051808202811583838304141715615226579050905004610160516040518110156152265760051b606001525b600101818118612d59575b505060405160208160051b01808382604060045afa50505050565b5f6040525f610160525f60206154135f395f516008811161522657801561316d57905b806101805260206156935f395f516130c557610180516001548110156152265760020154610180516010548110156152265760110154808203828111615226579050905061016052613143565b60206101805160206154535f395f518110156152265760051b6080016153f3015f395f516370a082316101a052306101c05260206101a060246101bc845afa613110573d5f5f3e3d5ffd5b60203d10615226576101a09050516101805160105481101561522657601101548082038281116152265790509050610160525b6040516007811161522657610160518160051b606001526001810160405250600101818118613078575b505060405160208160051b01808382604060045afa50505050565b5f610280525f60206154135f395f516008811161522657801561321f57905b806103a052610280516007811161522657670de0b6b3a76400006103a0516040518110156152265760051b606001516103a051610160518110156152265760051b61018001518082028115838383041417156152265790509050048160051b6102a001526001810161028052506001018181186131a7575b50506102805160208160051b0180838261028060045afa50505050565b600f54604052600d5460605260405142106132605760605181525061334556613345565b600c54608052600e5460a052608051606051116132e257608051606051608051034260a0518082038281116152265790509050808202811583838304141715615226579050905060405160a051808203828111615226579050905080156152265780820490509050808203828111615226579050905081525061334556613345565b608051608051606051034260a0518082038281116152265790509050808202811583838304141715615226579050905060405160a05180820382811161522657905090508015615226578082049050905080820182811061522657905090508152505b565b5f610180525f6040516008811161522657801561339157905b8060051b606001516101a052610180516101a051808201828110615226579050905061018052600101818118613360575b5050610180516133a4575f8152506135bd565b610180516101a0526101605160206153f35f395f5180820281158383830414171561522657905090506101c0525f60ff905b806101e0526101a051610200525f6040516008811161522657801561343f57905b8060051b6060015161022052610200516101a05180820281158383830414171561522657905090506102205180156152265780820490509050610200526001018181186133f7575b50506102005160206153f35f395f5160206153f35f395f510a80156152265780820490509050610200526101a0516102205260646101c051610180518082028115838383041417156152265790509050046102005160206153f35f395f51808202811583838304141715615226579050905080820182811061522657905090506101a051808202811583838304141715615226579050905060646101c051606481038181116152265790506101a051808202811583838304141715615226579050905004600160206153f35f395f51016102005180820281158383830414171561522657905090508082018281106152265790509050801561522657808204905090506101a052610220516101a05111613582576001610220516101a0518082038281116152265790509050116135ad576101a05183525050506135bd566135ad565b60016101a051610220518082038281116152265790509050116135ad576101a05183525050506135bd565b6001018181186133d65750505f5ffd5b565b60605160405114615226575f606051126152265760206154135f395f516060511215615226575f604051126152265760206154135f395f516040511215615226576101c051610200526101e0516102205260603661024037610220516102a0526102005160206153f35f395f5180820281158383830414171561522657905090506102c0525f6008905b806102e05260206154135f395f516102e051186136655761371f565b6040516102e0511861367d57608051610260526136ab565b6060516102e05114613714576102e05160a0518110156152265760051b60c00151610260526136ab56613714565b61024051610260518082018281106152265790509050610240526102a0516102205180820281158383830414171561522657905090506102605160206153f35f395f518082028115838383041417156152265790509050801561522657808204905090506102a0525b600101818118613649575b50506102a051610220518082028115838383041417156152265790509050606481028160648204186152265790506102c05160206153f35f395f518082028115838383041417156152265790509050801561522657808204905090506102a0526102405161022051606481028160648204186152265790506102c0518015615226578082049050905080820182811061522657905090506102e05261022051610300525f60ff905b80610320526103005161028052610300516103005180820281158383830414171561522657905090506102a0518082018281106152265790509050610300518060011b818160011c186152265790506102e0518082018281106152265790509050610220518082038281116152265790509050801561522657808204905090506103005261028051610300511161388757600161028051610300518082038281116152265790509050116138b2576103005183525050506138c2566138b2565b600161030051610280518082038281116152265790509050116138b2576103005183525050506138c2565b6001018181186137c75750505f5ffd5b565b600b5460a0526402540be40060a051116138e357608051815250613982565b60405160605180820182811061522657905090506fffffffffffffffffffffffffffffffff8111615226576002810a905060c0526402540be4006402540be40060a051038060021b818160021c186152265790506040518082028115838383041417156152265790509050606051808202811583838304141715615226579050905060c051801561522657808204905090500160805160a05102048152505b565b6fffffffffffffffffffffffffffffffff60405116815260405160801c602082015250565b60206153f35f395f5161016051026101a05260206153f35f395f5160206153f35f395f510a61018051046101c0525f60206154135f395f5160088111615226578015613a4357905b806101e0526101c0516101805180820281158383830414171561522657905090506101e0516040518110156152265760051b60600151801561522657808204905090506101c0526001018181186139f1575b50505f6101e05260646101a05160405115615226575f60051b6060015180820281158383830414171561522657905090500461030052600160078101905b806103205260206153f35f395f516103205118613a9d57613b57565b6101e051600781116152265761030051610320516040518110156152265760051b606001516101c05160405115615226575f60051b606001518082028115838383041417156152265790509050048082018281106152265790509050670de0b6b3a7640000810281670de0b6b3a7640000820418615226579050610300516101c0518082018281106152265790509050801561522657808204905090508160051b6102000152600181016101e05250600101818118613a81575b50506101e05160208160051b018083826101e060045afa50505050565b6040516060527ffffffffffffffffffffffffffffffffffffffffffffffffdc0d0570925a462d760405113613bac575f815250613dc4565b680755bf798b4a1bf1e46040511315613c1b5760106080527f7761645f657870206f766572666c6f770000000000000000000000000000000060a0526080506080518060a001601f825f031636823750506308c379a06040526020606052601f19601f6080510116604401605cfd5b6503782dace9d9604051604e1b056060526b8000000000000000000000006bb17217f7d1cf79abc9e3b39860605160601b050160601d6080526bb17217f7d1cf79abc9e3b39860805102606051036060526d02d16720577bd19bf614176fe9ea6060516c10fe68e7fd37d0007b713f7650606051010260601d0160a05279d835ebba824c98fb31b83b2ca45c0000000000000000000000006060516e0587f503bb6ea29d25fcb74019645060a0516d04a4fd9f2a8b96949216d2255a6c60605160a05101030260601d01020160c0526d0277594991cfc85f6e2461837cd96060516c240c330e9fb2d9cbaf0fd5aafc606051030260601d0160e0526d1a521255e34f6a5061b25ef1c9c460605160e0510260601d0360e0526db1bbb201f443cf962f1a1d3db4a560605160e0510260601d0160e0526e02c72388d9f74f51a9331fed693f1560605160e0510260601d0360e0526e05180bb14799ab47a8a8cb2a527d5760605160e0510260601d0160e05260e05160c051056101005274029d9dc38563c32e5c2f6dc192ee70ef65f9978af3610100510260805160c3035f8112615226571c8152505b565b6fffffffffffffffffffffffffffffffff6101205116610180526101205160801c6101a05242610160511015613ec65761014051670de0b6b3a764000061016051420302048060ff1c615226577f80000000000000000000000000000000000000000000000000000000000000008114615226575f03604052613e4a6101e0613b74565b6101e0516101c052670de0b6b3a7640000610180516101c05180670de0b6b3a764000003670de0b6b3a7640000811161522657905080820281158383830414171561522657905090506101a0516101c0518082028115838383041417156152265790509050808201828110615226579050905004815250613ece565b6101a0518152505b565b602554604052613ee16104e0613984565b6104e060406104a060408360045afa505060195460208160051b015f81601f0160051c60098111615226578015613f2d57905b80601901548160051b6104e00152600101818118613f14575b505050506104e05160208160051b0180610600826104e060045afa5050506103405160208160051b018060408261034060045afa50505061046051610160526104805161018052613f7f6108406139a9565b610840805160208160051b0180610720828560045afa505050505f6008905b806108405260206153f35f395f51600181038181116152265790506108405118613fc757614096565b61084051610720518110156152265760051b61074001511561408b5761084051610720518110156152265760051b6107400151671bc16d674ec80000818118671bc16d674ec800008310021890506108a052610840516104e0518110156152265760051b610500015161012052602354610140526104a0516101605261404e610860613dc6565b610860516108c0526040604060406108a060045afa5061406f610880612952565b6108805161084051610600518110156152265760051b61062001525b600101818118613f9e575b50506106005160208160051b015f81601f0160051c600981116152265780156140d457905b8060051b610600015181601901556001018181186140bb575b5050505060225461084052610480516108a0526108405161012052602454610140526104c05161016052614109610860613dc6565b610860516108c0526040604060406108a060045afa5061412a610880612952565b610880516022555f6002905b80610860524261086051600181116152265760051b6104a00151101561416c574261086051600181116152265760051b6104a001525b6001018181186141365750506104a0516040526104c051606052614191610860612952565b61086051602555565b6141a5610c2061323c565b610c2051610c00526109805160208160051b018060408261098060045afa505050610c0051610160526141d9610c40613347565b610c4051610c2052610bc051604052610be051606052610960516080526109805160208160051b018060a08261098060045afa505050610c00516101c052610c20516101e05261422a610c606135bf565b610c6051610c4052610be051610980518110156152265760051b6109a00151610c4051808203828111615226579050905060018103818111615226579050610c60526402540be400610c6051610bc051610980518110156152265760051b6109a0015161096051808201828110615226579050905060011c604052610be051610980518110156152265760051b6109a00151610c4051808201828110615226579050905060011c606052600a546080526142e5610ca06138c4565b610ca051808202811583838304141715615226579050905004610c8052610c6051610c80518082038281116152265790509050670de0b6b3a7640000810281670de0b6b3a7640000820418615226579050610be051610aa0518110156152265760051b610ac0015180156152265780820490509050610c6052610be051601054811015615226576011018054610be051610aa0518110156152265760051b610ac001516402540be400610c805164012a05f20081028164012a05f20082041861522657905004670de0b6b3a7640000810281670de0b6b3a76400008204186152265790500480820182811061522657905090508155506109805160208160051b0180610ca08261098060045afa50505061096051610bc051610ca0518110156152265760051b610cc00152610c4051610be051610ca0518110156152265760051b610cc00152610ca05160208160051b018061034082610ca060045afa505050610c005161046052610c20516104805261445d613ed0565b610c6051815250565b610e0051610de0511461522657610e20511561522657614487610fc0612d26565b610fc0805160208160051b0180610ea0828560045afa505050506144ac6110e0613055565b6110e0805160208160051b0180610fc0828560045afa50505050610ea05160208160051b0180604082610ea060045afa505050610fc05160208160051b018061016082610fc060045afa505050614504611200613188565b611200805160208160051b01806110e0828560045afa50505050610de051604052610e2051606052610dc051608052610e805160a052614545611220612993565b6112205161120052610de0516110e0518110156152265760051b6111000151670de0b6b3a764000061120051610de051610ea0518110156152265760051b610ec0015180820281158383830414171561522657905090500480820182811061522657905090506112205261122051610960526110e05160208160051b0180610980826110e060045afa505050610ea05160208160051b0180610aa082610ea060045afa505050610de051610bc052610e0051610be05261460661126061419a565b6112605161124052610e40516112405110156146a657602e611260527f45786368616e676520726573756c74656420696e20666577657220636f696e73611280527f207468616e2065787065637465640000000000000000000000000000000000006112a05261126050611260518061128001601f825f031636823750506308c379a061122052602061124052601f19601f61126051011660440161123cfd5b610e005160405261124051606052610e60516080526146c3612b55565b337f8b3e96f2b889fa771c53c981b40daf005f63f637f1869f707052d15a3dd97140610de051611260526112005161128052610e00516112a052611240516112c0526080611260a261124051815250565b6103c05160208160051b01806040826103c060045afa5050506104e05160208160051b0180610160826104e060045afa505050614752610740613188565b610740805160208160051b0180610620828560045afa505050506106205160208160051b018060408261062060045afa5050506106005161016052614798610740613347565b61074051815250565b5f606051126152265760206154135f395f516060511215615226576060366101c0376101a0516102205260405160206153f35f395f518082028115838383041417156152265790509050610240525f6008905b806102605260206154135f395f516102605118614810576148b2565b60605161026051146148a757610260516080518110156152265760051b60a001516101e05261483e566148a7565b6101c0516101e05180820182811061522657905090506101c052610220516101a05180820281158383830414171561522657905090506101e05160206153f35f395f51808202811583838304141715615226579050905080156152265780820490509050610220525b6001018181186147f4575b5050610220516101a0518082028115838383041417156152265790509050606481028160648204186152265790506102405160206153f35f395f51808202811583838304141715615226579050905080156152265780820490509050610220526101c0516101a0516064810281606482041861522657905061024051801561522657808204905090508082018281106152265790509050610260526101a051610280525f60ff905b806102a052610280516102005261028051610280518082028115838383041417156152265790509050610220518082018281106152265790509050610280518060011b818160011c186152265790506102605180820182811061522657905090506101a05180820382811161522657905090508015615226578082049050905061028052610200516102805111614a1a5760016102005161028051808203828111615226579050905011614a4557610280518352505050614a5556614a45565b60016102805161020051808203828111615226579050905011614a4557610280518352505050614a55565b60010181811861495a5750505f5ffd5b565b614a6261042061323c565b6104205161040052614a75610540612d26565b610540805160208160051b0180610420828560045afa505050506104205160208160051b01806108a08261042060045afa505050614ab4610660613055565b610660805160208160051b01806109c0828560045afa5050505061024060406102406108a060045afa50614ae9610780613188565b610780805160208160051b0180610540828560045afa505050506105405160208160051b018060408261054060045afa5050506104005161016052614b2f610680613347565b610680516106605260285461068052610660516103c051610660518082028115838383041417156152265790509050610680518015615226578082049050905080820382811161522657905090506106a052610400516040526103e0516060526105405160208160051b018060808261054060045afa5050506106a0516101a052614bbb6106e06147a1565b6106e0516106c052600160206153f35f395f510360021b60206153f35f395f51600a5402046106e0526105405160208160051b01806107008261054060045afa50505060206153f35f395f5160011b610660516106a05180820182811061522657905090500461082052608036610840375f6008905b806108c05260206154135f395f516108c05118614c4d57614daa565b5f610840526108c051610540518110156152265760051b6105600151610860526103e0516108c05118614cdf57610860516106a051808202811583838304141715615226579050905061066051801561522657808204905090506106c051808203828111615226579050905061084052610860516106c051808201828110615226579050905060011c61088052614d2b565b61086051610860516106a0518082028115838383041417156152265790509050610660518015615226578082049050905080820382811161522657905090506108405261086051610880525b61088051604052610820516060526106e051608052614d4b6108e06138c4565b6108e0516108a052610860516402540be4006108a0516108405180820281158383830414171561522657905090500480820382811161522657905090506108c051610700518110156152265760051b6107200152600101818118614c31575b50506103e051610700518110156152265760051b6107200151610400516040526103e0516060526107005160208160051b018060808261070060045afa5050506106a0516101a052614dfd6108e06147a1565b6108e05180820382811161522657905090506108c0526103e051610540518110156152265760051b61056001516106c0518082038281116152265790509050670de0b6b3a7640000810281670de0b6b3a76400008204186152265790506103e051610420518110156152265760051b6104400151801561522657808204905090506108e0526103e051610420518110156152265760051b61044001516108c05160018103818111615226579050670de0b6b3a7640000810281670de0b6b3a7640000820418615226579050046108c0526106c0516103e051610540518110156152265760051b61056001526108c05181526108e0516108c051808203828111615226579050905060208201526105405160208160051b016040830181818361054060045afa50505050610400516101608201526106a05161018082015250565b602854606051808203828111615226579050905060285560266040516020525f5260405f20805460605180820382811161522657905090508155505f6040517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60605160805260206080a3565b60206154335f395f5163cab4d3db610160526020610160600461017c845afa614fd5573d5f5f3e3d5ffd5b60203d1061522657610160518060a01c615226576101a0526101a0905051610140526101405161500457615115565b60105460208160051b015f81601f0160051c6009811161522657801561503f57905b80601001548160051b6101600152600101818118615026575b505050505f60206154135f395f51600881116152265780156150d257905b806102805261028051610160518110156152265760051b6101800151156150c7576102805160405261028051610160518110156152265760051b6101800151606052610140516080526150ae612b55565b5f61028051610160518110156152265760051b61018001525b60010181811861505d575b50506101605160208160051b015f81601f0160051c6009811161522657801561511057905b8060051b610160015181601001556001018181186150f7575b505050505b565b6020615bf35f395f51461461519f577fd87cd6ef79d4e2b95e15ce8abf732db51ec771f1ca2edccf22a46c729ac564726060526020615bd36080397f1c54f243822e0e9a0a377610b81577e771b3efe79964e76636b0d5d10247950d60a0524660c0523060e0526020615c136101003960c060405260408051602082012090508152506151a8565b6020615c338239505b565b60266040516020525f5260405f208054608051808203828111615226579050905081555060266060516020525f5260405f20805460805180820182811061522657905090508155506060516040517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60805160a052602060a0a3565b5f80fd0299538309065752a30a809452480d1cfc52e90c008153c207076c533d0ad40ddb8c1550652081066c00dc059c4258c4011a053931ab5219c72554fd4d5001c90576a9cd3e255e455e604cd2156085b72df5de03f4651a4d01d20bff6567df02ca207a6529357750006705e2e7d26400f425ec0238621a1025fd0684b124f20518160ddd220405a9059cbb1baa4570a0823102372530c5408519ac05ddca3f43009d055e0d443f21266506fdde03013205a7256d0903fe85c66106570075258edfdd5f00a905ddc1f59d02dea5cc2b27d721d24590d2083719f3253644e515206805313ce56701be05081579a50c09851ddc3b01012605d505accf1d3de5bfa0b13302c60595d89b410178051be913a5010e057706db750e1765fee3f7f900b505095ea7b31cd54514f0597924860565bbea6b28be45907a016b1b7705b4b577ad00d0054903b0d1245e2523b872dd1bdb65687276531b27252969e04a157aa5551a65882761051405228800e8055409491a00c405015c28382803454a6e32c60e21857ecebe0002a0257e3db030035d85dd62ed3e025d45bb7b8b802219053c157e6426034576a2f0f0244e053df0212402d485f446c1d02435053db06dd8232565afb430120367a5841953f387181e185b184618541846183f1831190860a16576797065728300030a0023000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000001f400000000000000000000000000000000000000000000000000000000001e84800000000000000000000000000000000000000000000000000000000ba43b7400000000000000000000000000000000000000000000000000000000000000036200000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000360000000000000000000000000000000000000000000000000000000000000000d6372765553442f73745553445400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a6372762d737455534454000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000f939e0a03fb07f59a73314e73794be0e57ac1b4e00000000000000000000000025ec98773d7b4ced4cafab96a2a1c0945f145e1000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
5f3560e01c60056005600683060261522a01601b395f51600760078260ff16848460181c0260181c06028260081c61ffff1601601939505f51818160181c14600336111661004c5761294e565b8060fe16361034826001160217615226578060081c61ffff16565b60206153f360403960206040f35b602060043560206154535f395f518110156152265760051b6080016153f30160403960206040f35b600a5460405260206040f35b600b5460405260206040f35b64012a05f20060405260206040f35b600c5460405260206040f35b600d5460405260206040f35b600e5460405260206040f35b600f5460405260206040f35b600435601054811015615226576011015460405260206040f35b60235460405260206040f35b60245460405260206040f35b60255460405260206040f35b6020806040528060400160206020615b335f395f510180615b338339508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f35b6020806040528060400160206020615b935f395f510180615b938339508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f35b601260405260206040f35b60208060805260066040527f76372e302e30000000000000000000000000000000000000000000000000000060605260408160800181518152602082015160208201528051806020830101601f825f03163682375050601f19601f8251602001011690509050810190506080f35b6004358060a01c6152265760405260266040516020525f5260405f205460605260206060f35b6004358060a01c615226576040526024358060a01c6152265760605260276040516020525f5260405f20806060516020525f5260405f2090505460805260206080f35b6004358060a01c6152265760405260296040516020525f5260405f205460605260206060f35b6020615c1360403960206040f35b33611360526102ee565b6084358060a01c61522657611360525b60043580600f0b8118615226576113205260243580600f0b811861522657611340525f546002146152265760025f55602033610dc05261132051610de05261134051610e005260406044610e203761136051610e60525f610e8052610354611380614466565b61138060035f55f35b3361136052610377565b6084358060a01c61522657611360525b60043580600f0b8118615226576113205260243580600f0b811861522657611340525f546002146152265760025f5560206156935f395f5161522657602033610dc05261132051610de05261134051610e005260406044610e203761136051610e60526001610e80526103eb611380614466565b61138060035f55f35b33610a805261040e565b6044358060a01c61522657610a80525b600435600401600881351161522657803560208160051b018083610960375050505f546002146152265760025f55610a80511561522657610450610ac061323c565b610ac051610aa052610463610be0613055565b610be0805160208160051b0180610ac0828560045afa50505050610488610d00612d26565b610d00805160208160051b0180610be0828560045afa50505050610be05160208160051b01806103c082610be060045afa505050610ac05160208160051b01806104e082610ac060045afa505050610aa051610600526104e9610d20614714565b610d2051610d0052602854610d2052610ac05160208160051b0180610d4082610ac060045afa5050505f60206154135f395f51600881116152265780156105c857905b80610e6052610e6051610960518110156152265760051b6109800151156105b357610e6051610d40518110156152265760051b610d60018051610e6051604052610e6051610960518110156152265760051b6109800151606052336080525f60a052610599610e80612993565b610e805180820182811061522657905090508152506105bd565b610d205115615226575b60010181811861052c575b5050610be05160208160051b01806103c082610be060045afa505050610d405160208160051b01806104e082610d4060045afa505050610aa05161060052610611610e80614714565b610e8051610e6052610d0051610e60511115615226575f610e80525f610fa052610d2051156109a857606036610fc03760206153f35f395f51610d0051610e60518082018281106152265790509050046110205260403661104037600160206153f35f395f510360021b60206153f35f395f51600a540204611080525f60206154135f395f51600881116152265780156108ad57905b806110a052610e60516110a051610ac0518110156152265760051b610ae001518082028115838383041417156152265790509050610d005180156152265780820490509050610fc0525f610fe0526110a051610d40518110156152265760051b610d6001516110005261100051610fc0511161072f57610fc0516110005103610fe05261073d565b61100051610fc05103610fe0525b670de0b6b3a76400006110a051610be0518110156152265760051b610c0001516110a051610ac0518110156152265760051b610ae00151611000518082018281106152265790509050808202811583838304141715615226579050905004611040526110405160405261102051606052611080516080526107bf6110c06138c4565b6110c05161106052610e805160078111615226576402540be40061106051610fe0518082028115838383041417156152265790509050048160051b610ea0015260018101610e8052506110a0516010548110156152265760110180546402540be4006110a051610e80518110156152265760051b610ea0015164012a05f20081028164012a05f2008204186152265790500480820182811061522657905090508155506110a051610d40518110156152265760051b610d600180516110a051610e80518110156152265760051b610ea0015180820382811161522657905090508152506001018181186106a7575b5050610be05160208160051b0180604082610be060045afa505050610d405160208160051b018061016082610d4060045afa5050506108ed6111c0613188565b6111c0805160208160051b01806110a0828560045afa505050506110a05160208160051b01806040826110a060045afa505050610aa051610160526109336111c0613347565b6111c051610e6052610d0051610d2051610e6051610d00518082038281116152265790509050808202811583838304141715615226579050905004610fa0526110a05160208160051b0180610340826110a060045afa505050610aa05161046052610e605161048052610a23613ed056610a23565b610e6051610fa052610e6051604052610e60516060526109c9610fc0612952565b610fc0516022556025546040526109e1611000613984565b6110006040610fc060408360045afa505042610fe0511015610a235742610fe052610fc051604052610fe051606052610a1b611000612952565b611000516025555b602435610fa0511015610a95576014610fc0527f536c697070616765207363726577656420796f75000000000000000000000000610fe052610fc050610fc05180610fe001601f825f031636823750506308c379a0610f80526020610fa052601f19601f610fc0510116604401610f9cfd5b610d2051610fa0518082018281106152265790509050610d20526026610a80516020525f5260405f208054610fa0518082018281106152265790509050815550610d2051602855610a80515f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef610fa051610fc0526020610fc0a3337f189c623b666b1b45b83d7178f39b8c087cb09774317ca2f53c2d3c3726f222a2608080610fc05280610fc0015f610960518083528060051b5f8260088111615226578015610b7a57905b8060051b61098001518160051b602088010152600101818118610b5c575b5050820160200191505090508101905080610fe05280610fc0015f610e80518083528060051b5f8260088111615226578015610bd057905b8060051b610ea001518160051b602088010152600101818118610bb2575b50508201602001915050905081019050610e605161100052610d205161102052610fc0a26020610fa060035f55f35b33610b0052610c19565b6064358060a01c61522657610b00525b60243580600f0b811861522657610ae0525f546002146152265760025f556004351561522657606036610b20375f610c80525f610ca0526004356103c052610ae0516103e052610c6a610cc0614a57565b610cc08051610b20526020810151610b405260408101805160208160051b0180610b60828560045afa50505050610160810151610c8052610180810151610ca05250604435610b20511015610d1e576018610cc0527f4e6f7420656e6f75676820636f696e732072656d6f7665640000000000000000610ce052610cc050610cc05180610ce001601f825f031636823750506308c379a0610c80526020610ca052601f19601f610cc0510116604401610c9cfd5b610ae0516010548110156152265760110180546402540be400610b405164012a05f20081028164012a05f20082041861522657905004808201828110615226579050905081555033604052600435606052610d77614f3d565b610ae051604052610b2051606052610b0051608052610d94612b55565b337f6f48129db1f37ccb9cc5dd7e119cb32750cabdf75b48375d730d26ce3659bbe1610ae051610cc052600435610ce052610b2051610d0052602854610d20526080610cc0a2610b605160208160051b018061034082610b6060045afa505050610c805161046052610ca05161048052610e0c613ed0565b6020610b2060035f55f35b33610a8052610e31565b6044358060a01c61522657610a80525b600435600401600881351161522657803560208160051b018083610960375050505f546002146152265760025f55610e6a610ac061323c565b610ac051610aa052610e7d610be0612d26565b610be0805160208160051b0180610ac0828560045afa50505050610ea2610d00613055565b610d00805160208160051b0180610be0828560045afa50505050610ac05160208160051b01806103c082610ac060045afa505050610be05160208160051b01806104e082610be060045afa505050610aa05161060052610f03610d20614714565b610d2051610d0052610be05160208160051b0180610d2082610be060045afa5050505f60206154135f395f5160088111615226578015610fdb57905b80610e4052610e4051610960518110156152265760051b610980015115610fd057610e4051610d20518110156152265760051b610d40018051610e4051610960518110156152265760051b61098001518082038281116152265790509050815250610e4051604052610e4051610960518110156152265760051b6109800151606052610a8051608052610fd0612b55565b600101818118610f3f575b5050610ac05160208160051b01806103c082610ac060045afa505050610d205160208160051b01806104e082610d2060045afa505050610aa05161060052611024610e60614714565b610e6051610e4052600160206153f35f395f510360021b60206153f35f395f51600a540204610e605260206153f35f395f51610d0051610e4051808201828110615226579050905004610e80525f610ea0525f610fc052608036610fe0375f60206154135f395f51600881116152265780156112a257905b8061106052610e405161106051610be0518110156152265760051b610c0001518082028115838383041417156152265790509050610d005180156152265780820490509050611000525f6110205261106051610d20518110156152265760051b610d400151611040526110405161100051116111245761100051611040510361102052611132565b611040516110005103611020525b670de0b6b3a764000061106051610ac0518110156152265760051b610ae0015161106051610be0518110156152265760051b610c000151611040518082018281106152265790509050808202811583838304141715615226579050905004610fe052610fe051604052610e8051606052610e60516080526111b46110806138c4565b61108051610fc052610ea05160078111615226576402540be400610fc051611020518082028115838383041417156152265790509050048160051b610ec0015260018101610ea05250611060516010548110156152265760110180546402540be40061106051610ea0518110156152265760051b610ec0015164012a05f20081028164012a05f20082041861522657905004808201828110615226579050905081555061106051610d20518110156152265760051b610d4001805161106051610ea0518110156152265760051b610ec00151808203828111615226579050905081525060010181811861109c575b5050610ac05160208160051b01806103c082610ac060045afa505050610d205160208160051b01806104e082610d2060045afa505050610aa051610600526112eb611060614714565b61106051610e4052610ac05160208160051b0180604082610ac060045afa505050610d205160208160051b018061016082610d2060045afa505050611331611060613188565b611060805160208160051b0180611180828560045afa50505050610aa0516112a052610e40516112c05261016061034061016061118060045afa50611374613ed0565b60285461106052610d0051610d0051610e40518082038281116152265790509050611060518082028115838383041417156152265790509050046001810181811061522657905061108052600261108051106152265760243561108051111561143c5760146110a0527f536c697070616765207363726577656420796f750000000000000000000000006110c0526110a0506110a051806110c001601f825f031636823750506308c379a061106052602061108052601f19601f6110a051011660440161107cfd5b336040526110805160605261144f614f3d565b337f3631c28b1f9dd213e0319fb167b554d76b6c283a41143eb400a0d1adb1af17556080806110a052806110a0015f610960518083528060051b5f82600881116152265780156114b957905b8060051b61098001518160051b60208801015260010181811861149b575b50508201602001915050905081019050806110c052806110a0015f610ea0518083528060051b5f826008811161522657801561150f57905b8060051b610ec001518160051b6020880101526001018181186114f1575b50508201602001915050905081019050610e40516110e05261106051611080518082038281116152265790509050611100526110a0a2602061108060035f55f35b336103c05260016103e052611599565b6044358060a01c615226576103c05260016103e052611599565b6044358060a01c615226576103c0526064358060011c615226576103e0525b602435600401600881351161522657803560208160051b0180836102a0375050505f546002146152265760025f5560285461040052600435156152265760206153f35f395f516102a05118615226575f610420526115f8610660613055565b610660805160208160051b0180610540828560045afa505050505f610660525f60206154135f395f516008811161522657801561176257905b80610680526104005161068051610540518110156152265760051b610560015160043580820281158383830414171561522657905090500461066052610680516102a0518110156152265760051b6102c001516106605110156117185760306106a0527f5769746864726177616c20726573756c74656420696e20666577657220636f696106c0527f6e73207468616e206578706563746564000000000000000000000000000000006106e0526106a0506106a051806106c001601f825f031636823750506308c379a061066052602061068052601f19601f6106a051011660440161067cfd5b610420516007811161522657610660518160051b610440015260018101610420525061068051604052610660516060526103c051608052611757612b55565b600101818118611631575b505033604052600435606052611776614f3d565b6025546040526117876106c0613984565b6106c0604061068060408360045afa50506022546106c0526fffffffffffffffffffffffffffffffff6106c051166106e0526106e051610400516106e0516004358082028115838383041417156152265790509050048082038281116152265790509050610740526106c05161012052602454610140526106a05161016052611811610700613dc6565b610700516107605260406040604061074060045afa50611832610720612952565b61072051602255426106a051101561186a57426106a052610680516040526106a051606052611862610700612952565b610700516025555b337f347ad828e58cbe534d8f6b67985d791360756b18f0d95fd9f197a66cc46480ea6060806107005280610700015f610420518083528060051b5f82600881116152265780156118d457905b8060051b61044001518160051b6020880101526001018181186118b6575b50508201602001915050905081019050806107205280610700015f5f82525f5f5f6008811161522657801561191b57905b5f8160051b602087010152600101818118611905575b505081016020019050905081019050600435610400510361074052610700a26103e0511561194b5761194b614faa565b6020806107005280610700015f610420518083528060051b5f826008811161522657801561199357905b8060051b61044001518160051b602088010152600101818118611975575b5050820160200191505090508101905061070060035f55f35b5f546002146152265760025f556119c1614faa565b60035f55005b6fffffffffffffffffffffffffffffffff60043560195481101561522657601a01541660405260206040f35b60043560195481101561522657601a015460801c60405260206040f35b611a1b6103e061323c565b6103e0516103c052611a2e610500612d26565b610500805160208160051b0180610860828560045afa50505050611a53610620613055565b610620805160208160051b0180610980828560045afa50505050610240604061024061086060045afa50611a88610740613188565b610740805160208160051b01806103e0828560045afa505050506103e05160208160051b01806040826103e060045afa5050506103c05161016052611ace610520613347565b610520516105005260206103e05160208160051b01806040826103e060045afa5050506103c051610160526105005161018052611b0c6105206139a9565b61052060043581518110156152265760051b60208201019050f35b5f5460021461522657602060043560195481101561522657601a015461012052602354610140526fffffffffffffffffffffffffffffffff6025541661016052611b72610200613dc6565b610200f35b5f54600214615226576020602254610120526024546101405260255460801c61016052611ba5610200613dc6565b610200f35b6004358060a01c6152265760c0523360405260c051606052602435608052611bd06151aa565b600160e052602060e0f35b6004358060a01c6152265760c0526024358060a01c6152265760e05260c05160405260e051606052604435608052611c116151aa565b602760c0516020525f5260405f2080336020525f5260405f20905054610100527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101005114611cc8576101005160443580820382811161522657905090506101205261012051602760c0516020525f5260405f2080336020525f5260405f209050553360c0517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92561012051610140526020610140a35b6001610120526020610120f35b6004358060a01c615226576040526024356027336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560243560605260206060a3600160605260206060f35b6004358060a01c61522657610120526024358060a01c61522657610140526084358060081c61522657610160526101205115615226576064354211615226576029610120516020525f5260405f2054610180525f60026101c0527f19010000000000000000000000000000000000000000000000000000000000006101e0526101c0805160208201836103200181518152505080830192505050611de2610200615117565b610200518161032001526020810190507f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c961024052610120516102605261014051610280526044356102a052610180516102c0526064356102e05260c061022052610220805160208201209050816103200152602081019050806103005261030090508051602082012090506101a052610120513b15611fab575f604060a46102603760406102405261024080516020820183610320018281848460045afa50505080830192505050610160516102a0526102a0601f810180516102e0525060016102c0526102c09050805160208201836103200181518152505080830192505050806103005261030090506020815101806101c0828460045afa5050507f1626ba7e0000000000000000000000000000000000000000000000000000000061012051631626ba7e6102405260406101a051610260528061028052806102600160206101c051018082826101c060045afa50508051806020830101601f825f03163682375050601f19601f82516020010116905081015050602061024060c461025c845afa611f93573d5f5f3e3d5ffd5b60203d10615226576102409050511861522657611feb565b610120515f610240526101a0516101c052610160516101e05260a4356102005260c43561022052602061024060806101c060015afa506102405118615226575b6044356027610120516020525f5260405f2080610140516020525f5260405f20905055600161018051016029610120516020525f5260405f205561014051610120517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9256044356101c05260206101c0a360016101c05260206101c0f35b6020612075610120615117565b610120f35b60043580600f0b81186152265760405260243580600f0b811861522657606052602060206154335f395f5163e31593d8608052602060806004609c845afa6120c4573d5f5f3e3d5ffd5b60203d10615226576080518060a01c6152265760c05260c09050516383aa796a60e0526040516101005260605161012052604435610140523061016052602060e0608460fc845afa612118573d5f5f3e3d5ffd5b60203d106152265760e09050f35b60043580600f0b81186152265760405260243580600f0b811861522657606052602060206154335f395f5163e31593d8608052602060806004609c845afa612170573d5f5f3e3d5ffd5b60203d10615226576080518060a01c6152265760c05260c0905051630c601c2c60e0526040516101005260605161012052604435610140523061016052602060e0608460fc845afa6121c4573d5f5f3e3d5ffd5b60203d106152265760e09050f35b60243580600f0b811861522657610ae05260206004356103c052610ae0516103e0526121ff610b00614a57565b610b00f35b5f546002146152265760285460405260206040f35b5f546002146152265761222d6103e061323c565b6103e0516103c052612240610500612d26565b610500805160208160051b0180610860828560045afa50505050612265610620613055565b610620805160208160051b0180610980828560045afa50505050610240604061024061086060045afa5061229a610740613188565b610740805160208160051b01806103e0828560045afa505050506103e05160208160051b01806040826103e060045afa5050506103c051610160526122e0610520613347565b610520516105005261050051670de0b6b3a7640000810281670de0b6b3a764000082041861522657905060285480156152265780820490509050610520526020610520f35b600435600401600881351161522657803560208160051b0180836040375050506024358060011c6152265761016052602060206154335f395f5163e31593d8610180526020610180600461019c845afa612381573d5f5f3e3d5ffd5b60203d1061522657610180518060a01c615226576101c0526101c090505163fb79eb276101e0526060806102005280610200015f6040518083528060051b5f82600881116152265780156123ee57905b8060051b606001518160051b6020880101526001018181186123d1575b50508201602001915050905081019050610160516102205230610240525060206101e06101846101fc845afa612426573d5f5f3e3d5ffd5b60203d10615226576101e09050f35b606461244160c061323c565b60c0510460e052602060e0f35b602061245a60c061323c565b60c0f35b602061246b6101e0613055565b6101e060043581518110156152265760051b60208201019050f35b602080610300526124986101e0613055565b6101e081610300015f82518083528060051b5f82600881116152265780156124db57905b8060051b6020880101518160051b6020880101526001018181186124bc575b505082016020019150509050905081019050610300f35b60208061036052612504610240612d26565b61024081610360015f82518083528060051b5f826008811161522657801561254757905b8060051b6020880101518160051b602088010152600101818118612528575b505082016020019150509050905081019050610360f35b60043580600f0b81186152265760405260243580600f0b811861522657606052602060206154335f395f5163e31593d8608052602060806004609c845afa6125a8573d5f5f3e3d5ffd5b60203d10615226576080518060a01c6152265760c05260c090505163a63530bd60e05260405161010052606051610120523061014052602060e0606460fc845afa6125f5573d5f5f3e3d5ffd5b60203d106152265760e09050f35b60206154335f395f5163f851a44060c052602060c0600460dc845afa61262b573d5f5f3e3d5ffd5b60203d106152265760c0518060a01c6152265761010052610100905051331861522657600e5462015180810181811061522657905042106152265742620151808101818110615226579050602435106152265761268860e061323c565b60e05160c0526004356064810281606482041861522657905060e052600435156126ba57620f423f60043511156126bc565b5f5b156152265760c05160e051106126ec5760c051600a810281600a82041861522657905060e0511161522657612708565b60c05160e051600a810281600a82041861522657905010615226575b60c051600c5560e051600d5542600e55602435600f557fa2b71ec6df949300b59aab36b55e189697b750119dd349fcfa8c0f779e83c25460c0516101005260e051610120524261014052602435610160526080610100a1005b60206154335f395f5163f851a44060c052602060c0600460dc845afa612789573d5f5f3e3d5ffd5b60203d106152265760c0518060a01c61522657610100526101009050513318615226576127b660e061323c565b60e05160c05260c051600c5560c051600d5542600e5542600f557f46e22fb3709ad289f62ce63d469248536dbc78d82b84a3d7e74ad606dc20193860c05160e0524261010052604060e0a1005b60206154335f395f5163f851a440604052602060406004605c845afa61282b573d5f5f3e3d5ffd5b60203d10615226576040518060a01c61522657608052608090505133186152265764012a05f2006004351161522657600435600a556802b5e3af16b188000060243560043580820281158383830414171561522657905090501161522657602435600b557f750d10a7f37466ce785ee6bcb604aac543358db42afbcc332a3c12a49c80bf6d6040600460403760406040a1005b60206154335f395f5163f851a440604052602060406004605c845afa6128e6573d5f5f3e3d5ffd5b60203d10615226576040518060a01c6152265760805260809050513318615226576024356004350215615226576004356023556024356024557f68dc4e067dff1862b896b7a0faf55f97df1a60d0aaa79481b69d675f2026a28c6040600460403760406040a1005b5f5ffd5b6fffffffffffffffffffffffffffffffff60405111615226576fffffffffffffffffffffffffffffffff606051116152265760605160801b60405117815250565b602060405160206154535f395f518110156152265760051b6080016153f3015f395f516370a0823160e0523061010052602060e0602460fc845afa6129da573d5f5f3e3d5ffd5b60203d106152265760e090505160c05260a051612af6576060511561522657602060405160206154535f395f518110156152265760051b6080016153f3015f395f516323b872dd60e05260805161010052306101205260605161014052602060e0606460fc5f855af1612a4f573d5f5f3e3d5ffd5b3d612a6657803b1561522657600161016052612a7e565b60203d106152265760e0518060011c61522657610160525b6101609050511561522657602060405160206154535f395f518110156152265760051b6080016153f3015f395f516370a0823160e0523061010052602060e0602460fc845afa612ad0573d5f5f3e3d5ffd5b60203d106152265760e090505160c051808203828111615226579050905060c052612b27565b60c0516040516001548110156152265760020154808203828111615226579050905060c05260605160c05110615226575b60405160015481101561522657600201805460c051808201828110615226579050905081555060c051815250565b608051156152265760206156935f395f51612c1e576040516001548110156152265760020180546060518082038281116152265790509050815550602060405160206154535f395f518110156152265760051b6080016153f3015f395f5163a9059cbb60a05260805160c05260605160e052602060a0604460bc5f855af1612bdf573d5f5f3e3d5ffd5b3d612bf657803b1561522657600161010052612c0e565b60203d106152265760a0518060011c61522657610100525b6101009050511561522657612d24565b602060405160206154535f395f518110156152265760051b6080016153f3015f395f516370a0823160c0523060e052602060c0602460dc845afa612c64573d5f5f3e3d5ffd5b60203d106152265760c090505160a052602060405160206154535f395f518110156152265760051b6080016153f3015f395f5163a9059cbb60c05260805160e05260605161010052602060c0604460dc5f855af1612cc4573d5f5f3e3d5ffd5b3d612cdb57803b1561522657600161012052612cf3565b60203d106152265760c0518060011c61522657610120525b610120905051156152265760a051606051808203828111615226579050905060405160015481101561522657600201555b565b60206156b35f395f5160208160051b01806156b360403950505f60206154135f395f516008811161522657801561303a57905b8061016052600160206101605160206155735f395f518110156152265760051b6101a0016153f3015f395f5118612db65760206101605160206157d35f395f518110156152265760051b610400016153f3015f395f511515612db8565b5f5b612ee757600360206101605160206155735f395f518110156152265760051b6101a0016153f3015f395f511861302f57670de0b6b3a7640000610160516040518110156152265760051b6060015160206101605160206154535f395f518110156152265760051b6080016153f3015f395f516307a2d13a6101805260206101605160206158f35f395f518110156152265760051b610520016153f3016101a0396020610180602461019c845afa612e71573d5f5f3e3d5ffd5b60203d106152265761018090505180820281158383830414171561522657905090506020610160516020615a135f395f518110156152265760051b610640016153f3015f395f51808202811583838304141715615226579050905004610160516040518110156152265760051b6060015261302f565b60206101605160206157d35f395f518110156152265760051b610400016153f3015f395f5173ffffffffffffffffffffffffffffffffffffffff811690508060a01c615226575a7fffffffff0000000000000000000000000000000000000000000000000000000060206101605160206157d35f395f518110156152265760051b610400016153f3015f395f51166101e05260206101c0526101c05060206102206101c0516101e08585fa90509050612fa2573d5f5f3e3d5ffd5b3d602081183d60201002186102005261020080516101805260208101516101a0525060206101805118615226576101a0516101805160200360031b1c6101c052670de0b6b3a7640000610160516040518110156152265760051b606001516101c051808202811583838304141715615226579050905004610160516040518110156152265760051b606001525b600101818118612d59575b505060405160208160051b01808382604060045afa50505050565b5f6040525f610160525f60206154135f395f516008811161522657801561316d57905b806101805260206156935f395f516130c557610180516001548110156152265760020154610180516010548110156152265760110154808203828111615226579050905061016052613143565b60206101805160206154535f395f518110156152265760051b6080016153f3015f395f516370a082316101a052306101c05260206101a060246101bc845afa613110573d5f5f3e3d5ffd5b60203d10615226576101a09050516101805160105481101561522657601101548082038281116152265790509050610160525b6040516007811161522657610160518160051b606001526001810160405250600101818118613078575b505060405160208160051b01808382604060045afa50505050565b5f610280525f60206154135f395f516008811161522657801561321f57905b806103a052610280516007811161522657670de0b6b3a76400006103a0516040518110156152265760051b606001516103a051610160518110156152265760051b61018001518082028115838383041417156152265790509050048160051b6102a001526001810161028052506001018181186131a7575b50506102805160208160051b0180838261028060045afa50505050565b600f54604052600d5460605260405142106132605760605181525061334556613345565b600c54608052600e5460a052608051606051116132e257608051606051608051034260a0518082038281116152265790509050808202811583838304141715615226579050905060405160a051808203828111615226579050905080156152265780820490509050808203828111615226579050905081525061334556613345565b608051608051606051034260a0518082038281116152265790509050808202811583838304141715615226579050905060405160a05180820382811161522657905090508015615226578082049050905080820182811061522657905090508152505b565b5f610180525f6040516008811161522657801561339157905b8060051b606001516101a052610180516101a051808201828110615226579050905061018052600101818118613360575b5050610180516133a4575f8152506135bd565b610180516101a0526101605160206153f35f395f5180820281158383830414171561522657905090506101c0525f60ff905b806101e0526101a051610200525f6040516008811161522657801561343f57905b8060051b6060015161022052610200516101a05180820281158383830414171561522657905090506102205180156152265780820490509050610200526001018181186133f7575b50506102005160206153f35f395f5160206153f35f395f510a80156152265780820490509050610200526101a0516102205260646101c051610180518082028115838383041417156152265790509050046102005160206153f35f395f51808202811583838304141715615226579050905080820182811061522657905090506101a051808202811583838304141715615226579050905060646101c051606481038181116152265790506101a051808202811583838304141715615226579050905004600160206153f35f395f51016102005180820281158383830414171561522657905090508082018281106152265790509050801561522657808204905090506101a052610220516101a05111613582576001610220516101a0518082038281116152265790509050116135ad576101a05183525050506135bd566135ad565b60016101a051610220518082038281116152265790509050116135ad576101a05183525050506135bd565b6001018181186133d65750505f5ffd5b565b60605160405114615226575f606051126152265760206154135f395f516060511215615226575f604051126152265760206154135f395f516040511215615226576101c051610200526101e0516102205260603661024037610220516102a0526102005160206153f35f395f5180820281158383830414171561522657905090506102c0525f6008905b806102e05260206154135f395f516102e051186136655761371f565b6040516102e0511861367d57608051610260526136ab565b6060516102e05114613714576102e05160a0518110156152265760051b60c00151610260526136ab56613714565b61024051610260518082018281106152265790509050610240526102a0516102205180820281158383830414171561522657905090506102605160206153f35f395f518082028115838383041417156152265790509050801561522657808204905090506102a0525b600101818118613649575b50506102a051610220518082028115838383041417156152265790509050606481028160648204186152265790506102c05160206153f35f395f518082028115838383041417156152265790509050801561522657808204905090506102a0526102405161022051606481028160648204186152265790506102c0518015615226578082049050905080820182811061522657905090506102e05261022051610300525f60ff905b80610320526103005161028052610300516103005180820281158383830414171561522657905090506102a0518082018281106152265790509050610300518060011b818160011c186152265790506102e0518082018281106152265790509050610220518082038281116152265790509050801561522657808204905090506103005261028051610300511161388757600161028051610300518082038281116152265790509050116138b2576103005183525050506138c2566138b2565b600161030051610280518082038281116152265790509050116138b2576103005183525050506138c2565b6001018181186137c75750505f5ffd5b565b600b5460a0526402540be40060a051116138e357608051815250613982565b60405160605180820182811061522657905090506fffffffffffffffffffffffffffffffff8111615226576002810a905060c0526402540be4006402540be40060a051038060021b818160021c186152265790506040518082028115838383041417156152265790509050606051808202811583838304141715615226579050905060c051801561522657808204905090500160805160a05102048152505b565b6fffffffffffffffffffffffffffffffff60405116815260405160801c602082015250565b60206153f35f395f5161016051026101a05260206153f35f395f5160206153f35f395f510a61018051046101c0525f60206154135f395f5160088111615226578015613a4357905b806101e0526101c0516101805180820281158383830414171561522657905090506101e0516040518110156152265760051b60600151801561522657808204905090506101c0526001018181186139f1575b50505f6101e05260646101a05160405115615226575f60051b6060015180820281158383830414171561522657905090500461030052600160078101905b806103205260206153f35f395f516103205118613a9d57613b57565b6101e051600781116152265761030051610320516040518110156152265760051b606001516101c05160405115615226575f60051b606001518082028115838383041417156152265790509050048082018281106152265790509050670de0b6b3a7640000810281670de0b6b3a7640000820418615226579050610300516101c0518082018281106152265790509050801561522657808204905090508160051b6102000152600181016101e05250600101818118613a81575b50506101e05160208160051b018083826101e060045afa50505050565b6040516060527ffffffffffffffffffffffffffffffffffffffffffffffffdc0d0570925a462d760405113613bac575f815250613dc4565b680755bf798b4a1bf1e46040511315613c1b5760106080527f7761645f657870206f766572666c6f770000000000000000000000000000000060a0526080506080518060a001601f825f031636823750506308c379a06040526020606052601f19601f6080510116604401605cfd5b6503782dace9d9604051604e1b056060526b8000000000000000000000006bb17217f7d1cf79abc9e3b39860605160601b050160601d6080526bb17217f7d1cf79abc9e3b39860805102606051036060526d02d16720577bd19bf614176fe9ea6060516c10fe68e7fd37d0007b713f7650606051010260601d0160a05279d835ebba824c98fb31b83b2ca45c0000000000000000000000006060516e0587f503bb6ea29d25fcb74019645060a0516d04a4fd9f2a8b96949216d2255a6c60605160a05101030260601d01020160c0526d0277594991cfc85f6e2461837cd96060516c240c330e9fb2d9cbaf0fd5aafc606051030260601d0160e0526d1a521255e34f6a5061b25ef1c9c460605160e0510260601d0360e0526db1bbb201f443cf962f1a1d3db4a560605160e0510260601d0160e0526e02c72388d9f74f51a9331fed693f1560605160e0510260601d0360e0526e05180bb14799ab47a8a8cb2a527d5760605160e0510260601d0160e05260e05160c051056101005274029d9dc38563c32e5c2f6dc192ee70ef65f9978af3610100510260805160c3035f8112615226571c8152505b565b6fffffffffffffffffffffffffffffffff6101205116610180526101205160801c6101a05242610160511015613ec65761014051670de0b6b3a764000061016051420302048060ff1c615226577f80000000000000000000000000000000000000000000000000000000000000008114615226575f03604052613e4a6101e0613b74565b6101e0516101c052670de0b6b3a7640000610180516101c05180670de0b6b3a764000003670de0b6b3a7640000811161522657905080820281158383830414171561522657905090506101a0516101c0518082028115838383041417156152265790509050808201828110615226579050905004815250613ece565b6101a0518152505b565b602554604052613ee16104e0613984565b6104e060406104a060408360045afa505060195460208160051b015f81601f0160051c60098111615226578015613f2d57905b80601901548160051b6104e00152600101818118613f14575b505050506104e05160208160051b0180610600826104e060045afa5050506103405160208160051b018060408261034060045afa50505061046051610160526104805161018052613f7f6108406139a9565b610840805160208160051b0180610720828560045afa505050505f6008905b806108405260206153f35f395f51600181038181116152265790506108405118613fc757614096565b61084051610720518110156152265760051b61074001511561408b5761084051610720518110156152265760051b6107400151671bc16d674ec80000818118671bc16d674ec800008310021890506108a052610840516104e0518110156152265760051b610500015161012052602354610140526104a0516101605261404e610860613dc6565b610860516108c0526040604060406108a060045afa5061406f610880612952565b6108805161084051610600518110156152265760051b61062001525b600101818118613f9e575b50506106005160208160051b015f81601f0160051c600981116152265780156140d457905b8060051b610600015181601901556001018181186140bb575b5050505060225461084052610480516108a0526108405161012052602454610140526104c05161016052614109610860613dc6565b610860516108c0526040604060406108a060045afa5061412a610880612952565b610880516022555f6002905b80610860524261086051600181116152265760051b6104a00151101561416c574261086051600181116152265760051b6104a001525b6001018181186141365750506104a0516040526104c051606052614191610860612952565b61086051602555565b6141a5610c2061323c565b610c2051610c00526109805160208160051b018060408261098060045afa505050610c0051610160526141d9610c40613347565b610c4051610c2052610bc051604052610be051606052610960516080526109805160208160051b018060a08261098060045afa505050610c00516101c052610c20516101e05261422a610c606135bf565b610c6051610c4052610be051610980518110156152265760051b6109a00151610c4051808203828111615226579050905060018103818111615226579050610c60526402540be400610c6051610bc051610980518110156152265760051b6109a0015161096051808201828110615226579050905060011c604052610be051610980518110156152265760051b6109a00151610c4051808201828110615226579050905060011c606052600a546080526142e5610ca06138c4565b610ca051808202811583838304141715615226579050905004610c8052610c6051610c80518082038281116152265790509050670de0b6b3a7640000810281670de0b6b3a7640000820418615226579050610be051610aa0518110156152265760051b610ac0015180156152265780820490509050610c6052610be051601054811015615226576011018054610be051610aa0518110156152265760051b610ac001516402540be400610c805164012a05f20081028164012a05f20082041861522657905004670de0b6b3a7640000810281670de0b6b3a76400008204186152265790500480820182811061522657905090508155506109805160208160051b0180610ca08261098060045afa50505061096051610bc051610ca0518110156152265760051b610cc00152610c4051610be051610ca0518110156152265760051b610cc00152610ca05160208160051b018061034082610ca060045afa505050610c005161046052610c20516104805261445d613ed0565b610c6051815250565b610e0051610de0511461522657610e20511561522657614487610fc0612d26565b610fc0805160208160051b0180610ea0828560045afa505050506144ac6110e0613055565b6110e0805160208160051b0180610fc0828560045afa50505050610ea05160208160051b0180604082610ea060045afa505050610fc05160208160051b018061016082610fc060045afa505050614504611200613188565b611200805160208160051b01806110e0828560045afa50505050610de051604052610e2051606052610dc051608052610e805160a052614545611220612993565b6112205161120052610de0516110e0518110156152265760051b6111000151670de0b6b3a764000061120051610de051610ea0518110156152265760051b610ec0015180820281158383830414171561522657905090500480820182811061522657905090506112205261122051610960526110e05160208160051b0180610980826110e060045afa505050610ea05160208160051b0180610aa082610ea060045afa505050610de051610bc052610e0051610be05261460661126061419a565b6112605161124052610e40516112405110156146a657602e611260527f45786368616e676520726573756c74656420696e20666577657220636f696e73611280527f207468616e2065787065637465640000000000000000000000000000000000006112a05261126050611260518061128001601f825f031636823750506308c379a061122052602061124052601f19601f61126051011660440161123cfd5b610e005160405261124051606052610e60516080526146c3612b55565b337f8b3e96f2b889fa771c53c981b40daf005f63f637f1869f707052d15a3dd97140610de051611260526112005161128052610e00516112a052611240516112c0526080611260a261124051815250565b6103c05160208160051b01806040826103c060045afa5050506104e05160208160051b0180610160826104e060045afa505050614752610740613188565b610740805160208160051b0180610620828560045afa505050506106205160208160051b018060408261062060045afa5050506106005161016052614798610740613347565b61074051815250565b5f606051126152265760206154135f395f516060511215615226576060366101c0376101a0516102205260405160206153f35f395f518082028115838383041417156152265790509050610240525f6008905b806102605260206154135f395f516102605118614810576148b2565b60605161026051146148a757610260516080518110156152265760051b60a001516101e05261483e566148a7565b6101c0516101e05180820182811061522657905090506101c052610220516101a05180820281158383830414171561522657905090506101e05160206153f35f395f51808202811583838304141715615226579050905080156152265780820490509050610220525b6001018181186147f4575b5050610220516101a0518082028115838383041417156152265790509050606481028160648204186152265790506102405160206153f35f395f51808202811583838304141715615226579050905080156152265780820490509050610220526101c0516101a0516064810281606482041861522657905061024051801561522657808204905090508082018281106152265790509050610260526101a051610280525f60ff905b806102a052610280516102005261028051610280518082028115838383041417156152265790509050610220518082018281106152265790509050610280518060011b818160011c186152265790506102605180820182811061522657905090506101a05180820382811161522657905090508015615226578082049050905061028052610200516102805111614a1a5760016102005161028051808203828111615226579050905011614a4557610280518352505050614a5556614a45565b60016102805161020051808203828111615226579050905011614a4557610280518352505050614a55565b60010181811861495a5750505f5ffd5b565b614a6261042061323c565b6104205161040052614a75610540612d26565b610540805160208160051b0180610420828560045afa505050506104205160208160051b01806108a08261042060045afa505050614ab4610660613055565b610660805160208160051b01806109c0828560045afa5050505061024060406102406108a060045afa50614ae9610780613188565b610780805160208160051b0180610540828560045afa505050506105405160208160051b018060408261054060045afa5050506104005161016052614b2f610680613347565b610680516106605260285461068052610660516103c051610660518082028115838383041417156152265790509050610680518015615226578082049050905080820382811161522657905090506106a052610400516040526103e0516060526105405160208160051b018060808261054060045afa5050506106a0516101a052614bbb6106e06147a1565b6106e0516106c052600160206153f35f395f510360021b60206153f35f395f51600a5402046106e0526105405160208160051b01806107008261054060045afa50505060206153f35f395f5160011b610660516106a05180820182811061522657905090500461082052608036610840375f6008905b806108c05260206154135f395f516108c05118614c4d57614daa565b5f610840526108c051610540518110156152265760051b6105600151610860526103e0516108c05118614cdf57610860516106a051808202811583838304141715615226579050905061066051801561522657808204905090506106c051808203828111615226579050905061084052610860516106c051808201828110615226579050905060011c61088052614d2b565b61086051610860516106a0518082028115838383041417156152265790509050610660518015615226578082049050905080820382811161522657905090506108405261086051610880525b61088051604052610820516060526106e051608052614d4b6108e06138c4565b6108e0516108a052610860516402540be4006108a0516108405180820281158383830414171561522657905090500480820382811161522657905090506108c051610700518110156152265760051b6107200152600101818118614c31575b50506103e051610700518110156152265760051b6107200151610400516040526103e0516060526107005160208160051b018060808261070060045afa5050506106a0516101a052614dfd6108e06147a1565b6108e05180820382811161522657905090506108c0526103e051610540518110156152265760051b61056001516106c0518082038281116152265790509050670de0b6b3a7640000810281670de0b6b3a76400008204186152265790506103e051610420518110156152265760051b6104400151801561522657808204905090506108e0526103e051610420518110156152265760051b61044001516108c05160018103818111615226579050670de0b6b3a7640000810281670de0b6b3a7640000820418615226579050046108c0526106c0516103e051610540518110156152265760051b61056001526108c05181526108e0516108c051808203828111615226579050905060208201526105405160208160051b016040830181818361054060045afa50505050610400516101608201526106a05161018082015250565b602854606051808203828111615226579050905060285560266040516020525f5260405f20805460605180820382811161522657905090508155505f6040517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60605160805260206080a3565b60206154335f395f5163cab4d3db610160526020610160600461017c845afa614fd5573d5f5f3e3d5ffd5b60203d1061522657610160518060a01c615226576101a0526101a0905051610140526101405161500457615115565b60105460208160051b015f81601f0160051c6009811161522657801561503f57905b80601001548160051b6101600152600101818118615026575b505050505f60206154135f395f51600881116152265780156150d257905b806102805261028051610160518110156152265760051b6101800151156150c7576102805160405261028051610160518110156152265760051b6101800151606052610140516080526150ae612b55565b5f61028051610160518110156152265760051b61018001525b60010181811861505d575b50506101605160208160051b015f81601f0160051c6009811161522657801561511057905b8060051b610160015181601001556001018181186150f7575b505050505b565b6020615bf35f395f51461461519f577fd87cd6ef79d4e2b95e15ce8abf732db51ec771f1ca2edccf22a46c729ac564726060526020615bd36080397f1c54f243822e0e9a0a377610b81577e771b3efe79964e76636b0d5d10247950d60a0524660c0523060e0526020615c136101003960c060405260408051602082012090508152506151a8565b6020615c338239505b565b60266040516020525f5260405f208054608051808203828111615226579050905081555060266060516020525f5260405f20805460805180820182811061522657905090508155506060516040517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60805160a052602060a0a3565b5f80fd0299538309065752a30a809452480d1cfc52e90c008153c207076c533d0ad40ddb8c1550652081066c00dc059c4258c4011a053931ab5219c72554fd4d5001c90576a9cd3e255e455e604cd2156085b72df5de03f4651a4d01d20bff6567df02ca207a6529357750006705e2e7d26400f425ec0238621a1025fd0684b124f20518160ddd220405a9059cbb1baa4570a0823102372530c5408519ac05ddca3f43009d055e0d443f21266506fdde03013205a7256d0903fe85c66106570075258edfdd5f00a905ddc1f59d02dea5cc2b27d721d24590d2083719f3253644e515206805313ce56701be05081579a50c09851ddc3b01012605d505accf1d3de5bfa0b13302c60595d89b410178051be913a5010e057706db750e1765fee3f7f900b505095ea7b31cd54514f0597924860565bbea6b28be45907a016b1b7705b4b577ad00d0054903b0d1245e2523b872dd1bdb65687276531b27252969e04a157aa5551a65882761051405228800e8055409491a00c405015c28382803454a6e32c60e21857ecebe0002a0257e3db030035d85dd62ed3e025d45bb7b8b802219053c157e6426034576a2f0f0244e053df0212402d485f446c1d02435053db06dd8232565afb430120367a5000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000006a8cbed756804b16e05e741edabd5cb544ae21bf0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000f939e0a03fb07f59a73314e73794be0e57ac1b4e00000000000000000000000025ec98773d7b4ced4cafab96a2a1c0945f145e10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d6372765553442f737455534454000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a6372762d73745553445400000000000000000000000000000000000000000000252d7407937936a49cea52a97fbc6fbe8a986018f5a8a3fa040e3d8702e3885300000000000000000000000000000000000000000000000000000000000000016f55abe17c821675c59662cb0e76df4b534197646807ec2820cfc992a2b818262198f23b4ec43118355877ded640bcc822b156414015baca107a3a182b7e05a7
# pragma version 0.3.10 # pragma optimize codesize # pragma evm-version shanghai """ @title CurveStableSwapNG @author Curve.Fi @license Copyright (c) Curve.Fi, 2020-2023 - all rights reserved @notice Stableswap implementation for up to 8 coins with no rehypothecation, i.e. the AMM does not deposit tokens into other contracts. The Pool contract also records exponential moving averages for coins relative to coin 0. @dev Asset Types: 0. Standard ERC20 token with no additional features. Note: Users are advised to do careful due-diligence on ERC20 tokens that they interact with, as this contract cannot differentiate between harmless and malicious ERC20 tokens. 1. Oracle - token with rate oracle (e.g. wstETH) Note: Oracles may be controlled externally by an EOA. Users are advised to proceed with caution. 2. Rebasing - token with rebase (e.g. stETH). Note: Users and Integrators are advised to understand how the AMM contract works with rebasing balances. 3. ERC4626 - token with convertToAssets method (e.g. sDAI). Note: Some ERC4626 implementations may be susceptible to Donation/Inflation attacks. Users are advised to proceed with caution. NOTE: Pool Cannot support tokens with multiple asset types: e.g. ERC4626 with fees are not supported. Supports: 1. ERC20 support for return True/revert, return True/False, return None 2. ERC20 tokens can have arbitrary decimals (<=18). 3. ERC20 tokens that rebase (either positive or fee on transfer) 4. ERC20 tokens that have a rate oracle (e.g. wstETH, cbETH, sDAI, etc.) Note: Oracle precision _must_ be 10**18. 5. ERC4626 tokens with arbitrary precision (<=18) of Vault token and underlying asset. Additional features include: 1. Adds price oracles based on AMM State Price (and _not_ last traded price). 2. Adds TVL oracle based on D. 3. `exchange_received`: swaps that expect an ERC20 transfer to have occurred prior to executing the swap. Note: a. If pool contains rebasing tokens and one of the `asset_types` is 2 (Rebasing) then calling `exchange_received` will REVERT. b. If pool contains rebasing token and `asset_types` does not contain 2 (Rebasing) then this is an incorrect implementation and rebases can be stolen. 4. Adds `get_dx`: Similar to `get_dy` which returns an expected output of coin[j] for given `dx` amount of coin[i], `get_dx` returns expected input of coin[i] for an output amount of coin[j]. 5. Fees are dynamic: AMM will charge a higher fee if pool depegs. This can cause very slight discrepancies between calculated fees and realised fees. """ from vyper.interfaces import ERC20 from vyper.interfaces import ERC20Detailed from vyper.interfaces import ERC4626 implements: ERC20 # ------------------------------- Interfaces --------------------------------- interface Factory: def fee_receiver() -> address: view def admin() -> address: view def views_implementation() -> address: view interface ERC1271: def isValidSignature(_hash: bytes32, _signature: Bytes[65]) -> bytes32: view interface StableSwapViews: def get_dx(i: int128, j: int128, dy: uint256, pool: address) -> uint256: view def get_dy(i: int128, j: int128, dx: uint256, pool: address) -> uint256: view def dynamic_fee(i: int128, j: int128, pool: address) -> uint256: view def calc_token_amount( _amounts: DynArray[uint256, MAX_COINS], _is_deposit: bool, _pool: address ) -> uint256: view # --------------------------------- Events ----------------------------------- event Transfer: sender: indexed(address) receiver: indexed(address) value: uint256 event Approval: owner: indexed(address) spender: indexed(address) value: uint256 event TokenExchange: buyer: indexed(address) sold_id: int128 tokens_sold: uint256 bought_id: int128 tokens_bought: uint256 event TokenExchangeUnderlying: buyer: indexed(address) sold_id: int128 tokens_sold: uint256 bought_id: int128 tokens_bought: uint256 event AddLiquidity: provider: indexed(address) token_amounts: DynArray[uint256, MAX_COINS] fees: DynArray[uint256, MAX_COINS] invariant: uint256 token_supply: uint256 event RemoveLiquidity: provider: indexed(address) token_amounts: DynArray[uint256, MAX_COINS] fees: DynArray[uint256, MAX_COINS] token_supply: uint256 event RemoveLiquidityOne: provider: indexed(address) token_id: int128 token_amount: uint256 coin_amount: uint256 token_supply: uint256 event RemoveLiquidityImbalance: provider: indexed(address) token_amounts: DynArray[uint256, MAX_COINS] fees: DynArray[uint256, MAX_COINS] invariant: uint256 token_supply: uint256 event RampA: old_A: uint256 new_A: uint256 initial_time: uint256 future_time: uint256 event StopRampA: A: uint256 t: uint256 event ApplyNewFee: fee: uint256 offpeg_fee_multiplier: uint256 event SetNewMATime: ma_exp_time: uint256 D_ma_time: uint256 MAX_COINS: constant(uint256) = 8 # max coins is 8 in the factory MAX_COINS_128: constant(int128) = 8 # ---------------------------- Pool Variables -------------------------------- N_COINS: public(immutable(uint256)) N_COINS_128: immutable(int128) PRECISION: constant(uint256) = 10 ** 18 factory: immutable(Factory) coins: public(immutable(DynArray[address, MAX_COINS])) asset_types: immutable(DynArray[uint8, MAX_COINS]) pool_contains_rebasing_tokens: immutable(bool) stored_balances: DynArray[uint256, MAX_COINS] # Fee specific vars FEE_DENOMINATOR: constant(uint256) = 10 ** 10 fee: public(uint256) # fee * 1e10 offpeg_fee_multiplier: public(uint256) # * 1e10 admin_fee: public(constant(uint256)) = 5000000000 MAX_FEE: constant(uint256) = 5 * 10 ** 9 # ---------------------- Pool Amplification Parameters ----------------------- A_PRECISION: constant(uint256) = 100 MAX_A: constant(uint256) = 10 ** 6 MAX_A_CHANGE: constant(uint256) = 10 initial_A: public(uint256) future_A: public(uint256) initial_A_time: public(uint256) future_A_time: public(uint256) # ---------------------------- Admin Variables ------------------------------- MIN_RAMP_TIME: constant(uint256) = 86400 admin_balances: public(DynArray[uint256, MAX_COINS]) # ----------------------- Oracle Specific vars ------------------------------- rate_multipliers: immutable(DynArray[uint256, MAX_COINS]) # [bytes4 method_id][bytes8 <empty>][bytes20 oracle] rate_oracles: immutable(DynArray[uint256, MAX_COINS]) # For ERC4626 tokens, we need: call_amount: immutable(DynArray[uint256, MAX_COINS]) scale_factor: immutable(DynArray[uint256, MAX_COINS]) last_prices_packed: DynArray[uint256, MAX_COINS] # packing: last_price, ma_price last_D_packed: uint256 # packing: last_D, ma_D ma_exp_time: public(uint256) D_ma_time: public(uint256) ma_last_time: public(uint256) # packing: ma_last_time_p, ma_last_time_D # ma_last_time has a distinction for p and D because p is _not_ updated if # users remove_liquidity, but D is. # shift(2**32 - 1, 224) ORACLE_BIT_MASK: constant(uint256) = (2**32 - 1) * 256**28 # --------------------------- ERC20 Specific Vars ---------------------------- name: public(immutable(String[64])) symbol: public(immutable(String[32])) decimals: public(constant(uint8)) = 18 version: public(constant(String[8])) = "v7.0.0" balanceOf: public(HashMap[address, uint256]) allowance: public(HashMap[address, HashMap[address, uint256]]) total_supply: uint256 nonces: public(HashMap[address, uint256]) # keccak256("isValidSignature(bytes32,bytes)")[:4] << 224 ERC1271_MAGIC_VAL: constant(bytes32) = 0x1626ba7e00000000000000000000000000000000000000000000000000000000 EIP712_TYPEHASH: constant(bytes32) = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract,bytes32 salt)") EIP2612_TYPEHASH: constant(bytes32) = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)") VERSION_HASH: constant(bytes32) = keccak256(version) NAME_HASH: immutable(bytes32) CACHED_CHAIN_ID: immutable(uint256) salt: public(immutable(bytes32)) CACHED_DOMAIN_SEPARATOR: immutable(bytes32) # ------------------------------ AMM Setup ----------------------------------- @external def __init__( _name: String[32], _symbol: String[10], _A: uint256, _fee: uint256, _offpeg_fee_multiplier: uint256, _ma_exp_time: uint256, _coins: DynArray[address, MAX_COINS], _rate_multipliers: DynArray[uint256, MAX_COINS], _asset_types: DynArray[uint8, MAX_COINS], _method_ids: DynArray[bytes4, MAX_COINS], _oracles: DynArray[address, MAX_COINS], ): """ @notice Initialize the pool contract @param _name Name of the new plain pool. @param _symbol Symbol for the new plain pool. @param _A Amplification co-efficient - a lower value here means less tolerance for imbalance within the pool's assets. Suggested values include: * Uncollateralized algorithmic stablecoins: 5-10 * Non-redeemable, collateralized assets: 100 * Redeemable assets: 200-400 @param _fee Trade fee, given as an integer with 1e10 precision. The the maximum is 1% (100000000). 50% of the fee is distributed to veCRV holders. @param _offpeg_fee_multiplier A multiplier that determines how much to increase Fees by when assets in the AMM depeg. Example value: 20000000000 @param _ma_exp_time Averaging window of oracle. Set as time_in_seconds / ln(2) Example: for 10 minute EMA, _ma_exp_time is 600 / ln(2) ~= 866 @param _coins List of addresses of the coins being used in the pool. @param _rate_multipliers An array of: [10 ** (36 - _coins[n].decimals()), ... for n in range(N_COINS)] @param _asset_types Array of uint8 representing tokens in pool @param _method_ids Array of first four bytes of the Keccak-256 hash of the function signatures of the oracle addresses that gives rate oracles. Calculated as: keccak(text=event_signature.replace(" ", ""))[:4] @param _oracles Array of rate oracle addresses. """ coins = _coins asset_types = _asset_types pool_contains_rebasing_tokens = 2 in asset_types __n_coins: uint256 = len(_coins) N_COINS = __n_coins N_COINS_128 = convert(__n_coins, int128) rate_multipliers = _rate_multipliers factory = Factory(msg.sender) A: uint256 = unsafe_mul(_A, A_PRECISION) self.initial_A = A self.future_A = A self.fee = _fee self.offpeg_fee_multiplier = _offpeg_fee_multiplier assert _ma_exp_time != 0 self.ma_exp_time = _ma_exp_time self.D_ma_time = 62324 # <--------- 12 hours default on contract start. self.ma_last_time = self.pack_2(block.timestamp, block.timestamp) # ------------------- initialize storage for DynArrays ------------------ _call_amount: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) _scale_factor: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) _rate_oracles: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) for i in range(N_COINS_128, bound=MAX_COINS_128): if i < N_COINS_128 - 1: self.last_prices_packed.append(self.pack_2(10**18, 10**18)) _rate_oracles.append(convert(_method_ids[i], uint256) * 2**224 | convert(_oracles[i], uint256)) self.stored_balances.append(0) self.admin_balances.append(0) if _asset_types[i] == 3: _call_amount.append(10**convert(ERC20Detailed(_coins[i]).decimals(), uint256)) _underlying_asset: address = ERC4626(_coins[i]).asset() _scale_factor.append(10**(18 - convert(ERC20Detailed(_underlying_asset).decimals(), uint256))) else: _call_amount.append(0) _scale_factor.append(0) call_amount = _call_amount scale_factor = _scale_factor rate_oracles = _rate_oracles # ----------------------------- ERC20 stuff ------------------------------ name = _name symbol = _symbol # EIP712 related params ----------------- NAME_HASH = keccak256(name) salt = block.prevhash CACHED_CHAIN_ID = chain.id CACHED_DOMAIN_SEPARATOR = keccak256( _abi_encode( EIP712_TYPEHASH, NAME_HASH, VERSION_HASH, chain.id, self, salt, ) ) # ------------------------ Fire a transfer event ------------------------- log Transfer(empty(address), msg.sender, 0) # ------------------ Token transfers in and out of the AMM ------------------- @internal def _transfer_in( coin_idx: int128, dx: uint256, sender: address, expect_optimistic_transfer: bool, ) -> uint256: """ @notice Contains all logic to handle ERC20 token transfers. @param coin_idx Index of the coin to transfer in. @param dx amount of `_coin` to transfer into the pool. @param sender address to transfer `_coin` from. @param receiver address to transfer `_coin` to. @param expect_optimistic_transfer True if contract expects an optimistic coin transfer """ _dx: uint256 = ERC20(coins[coin_idx]).balanceOf(self) # ------------------------- Handle Transfers ----------------------------- if expect_optimistic_transfer: _dx = _dx - self.stored_balances[coin_idx] assert _dx >= dx else: assert dx > 0 # dev : do not transferFrom 0 tokens into the pool assert ERC20(coins[coin_idx]).transferFrom( sender, self, dx, default_return_value=True ) _dx = ERC20(coins[coin_idx]).balanceOf(self) - _dx # --------------------------- Store transferred in amount --------------------------- self.stored_balances[coin_idx] += _dx return _dx @internal def _transfer_out(_coin_idx: int128, _amount: uint256, receiver: address): """ @notice Transfer a single token from the pool to receiver. @dev This function is called by `remove_liquidity` and `remove_liquidity_one_coin`, `_exchange`, `_withdraw_admin_fees` and `remove_liquidity_imbalance` methods. @param _coin_idx Index of the token to transfer out @param _amount Amount of token to transfer out @param receiver Address to send the tokens to """ assert receiver != empty(address) # dev: do not send tokens to zero_address if not pool_contains_rebasing_tokens: # we need not cache balanceOf pool before swap out self.stored_balances[_coin_idx] -= _amount assert ERC20(coins[_coin_idx]).transfer( receiver, _amount, default_return_value=True ) else: # cache balances pre and post to account for fee on transfers etc. coin_balance: uint256 = ERC20(coins[_coin_idx]).balanceOf(self) assert ERC20(coins[_coin_idx]).transfer( receiver, _amount, default_return_value=True ) self.stored_balances[_coin_idx] = coin_balance - _amount # -------------------------- AMM Special Methods ----------------------------- @view @internal def _stored_rates() -> DynArray[uint256, MAX_COINS]: """ @notice Gets rate multipliers for each coin. @dev If the coin has a rate oracle that has been properly initialised, this method queries that rate by static-calling an external contract. """ rates: DynArray[uint256, MAX_COINS] = rate_multipliers for i in range(N_COINS_128, bound=MAX_COINS_128): if asset_types[i] == 1 and not rate_oracles[i] == 0: # NOTE: fetched_rate is assumed to be 10**18 precision oracle_response: Bytes[32] = raw_call( convert(rate_oracles[i] % 2**160, address), _abi_encode(rate_oracles[i] & ORACLE_BIT_MASK), max_outsize=32, is_static_call=True, ) assert len(oracle_response) == 32 fetched_rate: uint256 = convert(oracle_response, uint256) rates[i] = unsafe_div(rates[i] * fetched_rate, PRECISION) elif asset_types[i] == 3: # ERC4626 # fetched_rate: uint256 = ERC4626(coins[i]).convertToAssets(call_amount[i]) * scale_factor[i] # here: call_amount has ERC4626 precision, but the returned value is scaled up to 18 # using scale_factor which is (18 - n) if underlying asset has n decimals. rates[i] = unsafe_div( rates[i] * ERC4626(coins[i]).convertToAssets(call_amount[i]) * scale_factor[i], PRECISION ) # 1e18 precision return rates @view @internal def _balances() -> DynArray[uint256, MAX_COINS]: """ @notice Calculates the pool's balances _excluding_ the admin's balances. @dev If the pool contains rebasing tokens, this method ensures LPs keep all rebases and admin only claims swap fees. This also means that, since admin's balances are stored in an array and not inferred from read balances, the fees in the rebasing token that the admin collects is immune to slashing events. """ result: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) balances_i: uint256 = 0 for i in range(N_COINS_128, bound=MAX_COINS_128): if pool_contains_rebasing_tokens: # Read balances by gulping to account for rebases balances_i = ERC20(coins[i]).balanceOf(self) - self.admin_balances[i] else: # Use cached balances balances_i = self.stored_balances[i] - self.admin_balances[i] result.append(balances_i) return result # -------------------------- AMM Main Functions ------------------------------ @external @nonreentrant('lock') def exchange( i: int128, j: int128, _dx: uint256, _min_dy: uint256, _receiver: address = msg.sender, ) -> uint256: """ @notice Perform an exchange between two coins @dev Index values can be found via the `coins` public getter method @param i Index value for the coin to send @param j Index value of the coin to receive @param _dx Amount of `i` being exchanged @param _min_dy Minimum amount of `j` to receive @param _receiver Address that receives `j` @return Actual amount of `j` received """ return self._exchange( msg.sender, i, j, _dx, _min_dy, _receiver, False ) @external @nonreentrant('lock') def exchange_received( i: int128, j: int128, _dx: uint256, _min_dy: uint256, _receiver: address = msg.sender, ) -> uint256: """ @notice Perform an exchange between two coins without transferring token in @dev The contract swaps tokens based on a change in balance of coin[i]. The dx = ERC20(coin[i]).balanceOf(self) - self.stored_balances[i]. Users of this method are dex aggregators, arbitrageurs, or other users who do not wish to grant approvals to the contract: they would instead send tokens directly to the contract and call `exchange_received`. Note: This is disabled if pool contains rebasing tokens. @param i Index value for the coin to send @param j Index value of the coin to receive @param _dx Amount of `i` being exchanged @param _min_dy Minimum amount of `j` to receive @param _receiver Address that receives `j` @return Actual amount of `j` received """ assert not pool_contains_rebasing_tokens # dev: exchange_received not supported if pool contains rebasing tokens return self._exchange( msg.sender, i, j, _dx, _min_dy, _receiver, True, # <--------------------------------------- swap optimistically. ) @external @nonreentrant('lock') def add_liquidity( _amounts: DynArray[uint256, MAX_COINS], _min_mint_amount: uint256, _receiver: address = msg.sender ) -> uint256: """ @notice Deposit coins into the pool @param _amounts List of amounts of coins to deposit @param _min_mint_amount Minimum amount of LP tokens to mint from the deposit @param _receiver Address that owns the minted LP tokens @return Amount of LP tokens received by depositing """ assert _receiver != empty(address) # dev: do not send LP tokens to zero_address amp: uint256 = self._A() old_balances: DynArray[uint256, MAX_COINS] = self._balances() rates: DynArray[uint256, MAX_COINS] = self._stored_rates() # Initial invariant D0: uint256 = self.get_D_mem(rates, old_balances, amp) total_supply: uint256 = self.total_supply new_balances: DynArray[uint256, MAX_COINS] = old_balances # -------------------------- Do Transfers In ----------------------------- for i in range(N_COINS_128, bound=MAX_COINS_128): if _amounts[i] > 0: new_balances[i] += self._transfer_in( i, _amounts[i], msg.sender, False, # expect_optimistic_transfer ) else: assert total_supply != 0 # dev: initial deposit requires all coins # ------------------------------------------------------------------------ # Invariant after change D1: uint256 = self.get_D_mem(rates, new_balances, amp) assert D1 > D0 # We need to recalculate the invariant accounting for fees # to calculate fair user's share fees: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) mint_amount: uint256 = 0 if total_supply > 0: ideal_balance: uint256 = 0 difference: uint256 = 0 new_balance: uint256 = 0 ys: uint256 = unsafe_div(D0 + D1, N_COINS) xs: uint256 = 0 _dynamic_fee_i: uint256 = 0 # Only account for fees if we are not the first to deposit base_fee: uint256 = unsafe_div( unsafe_mul(self.fee, N_COINS), unsafe_mul(4, unsafe_sub(N_COINS, 1)) ) for i in range(N_COINS_128, bound=MAX_COINS_128): ideal_balance = D1 * old_balances[i] / D0 difference = 0 new_balance = new_balances[i] if ideal_balance > new_balance: difference = unsafe_sub(ideal_balance, new_balance) else: difference = unsafe_sub(new_balance, ideal_balance) # fee[i] = _dynamic_fee(i, j) * difference / FEE_DENOMINATOR xs = unsafe_div(rates[i] * (old_balances[i] + new_balance), PRECISION) _dynamic_fee_i = self._dynamic_fee(xs, ys, base_fee) fees.append(unsafe_div(_dynamic_fee_i * difference, FEE_DENOMINATOR)) self.admin_balances[i] += unsafe_div(fees[i] * admin_fee, FEE_DENOMINATOR) new_balances[i] -= fees[i] xp: DynArray[uint256, MAX_COINS] = self._xp_mem(rates, new_balances) D1 = self.get_D(xp, amp) # <--------------- Reuse D1 for new D value. mint_amount = unsafe_div(total_supply * (D1 - D0), D0) self.upkeep_oracles(xp, amp, D1) else: mint_amount = D1 # Take the dust if there was any # (re)instantiate D oracle if totalSupply is zero. self.last_D_packed = self.pack_2(D1, D1) # Update D ma time: ma_last_time_unpacked: uint256[2] = self.unpack_2(self.ma_last_time) if ma_last_time_unpacked[1] < block.timestamp: ma_last_time_unpacked[1] = block.timestamp self.ma_last_time = self.pack_2(ma_last_time_unpacked[0], ma_last_time_unpacked[1]) assert mint_amount >= _min_mint_amount, "Slippage screwed you" # Mint pool tokens total_supply += mint_amount self.balanceOf[_receiver] += mint_amount self.total_supply = total_supply log Transfer(empty(address), _receiver, mint_amount) log AddLiquidity(msg.sender, _amounts, fees, D1, total_supply) return mint_amount @external @nonreentrant('lock') def remove_liquidity_one_coin( _burn_amount: uint256, i: int128, _min_received: uint256, _receiver: address = msg.sender, ) -> uint256: """ @notice Withdraw a single coin from the pool @param _burn_amount Amount of LP tokens to burn in the withdrawal @param i Index value of the coin to withdraw @param _min_received Minimum amount of coin to receive @param _receiver Address that receives the withdrawn coins @return Amount of coin received """ assert _burn_amount > 0 # dev: do not remove 0 LP tokens dy: uint256 = 0 fee: uint256 = 0 xp: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) amp: uint256 = empty(uint256) D: uint256 = empty(uint256) dy, fee, xp, amp, D = self._calc_withdraw_one_coin(_burn_amount, i) assert dy >= _min_received, "Not enough coins removed" self.admin_balances[i] += unsafe_div(fee * admin_fee, FEE_DENOMINATOR) self._burnFrom(msg.sender, _burn_amount) self._transfer_out(i, dy, _receiver) log RemoveLiquidityOne(msg.sender, i, _burn_amount, dy, self.total_supply) self.upkeep_oracles(xp, amp, D) return dy @external @nonreentrant('lock') def remove_liquidity_imbalance( _amounts: DynArray[uint256, MAX_COINS], _max_burn_amount: uint256, _receiver: address = msg.sender ) -> uint256: """ @notice Withdraw coins from the pool in an imbalanced amount @param _amounts List of amounts of underlying coins to withdraw @param _max_burn_amount Maximum amount of LP token to burn in the withdrawal @param _receiver Address that receives the withdrawn coins @return Actual amount of the LP token burned in the withdrawal """ amp: uint256 = self._A() rates: DynArray[uint256, MAX_COINS] = self._stored_rates() old_balances: DynArray[uint256, MAX_COINS] = self._balances() D0: uint256 = self.get_D_mem(rates, old_balances, amp) new_balances: DynArray[uint256, MAX_COINS] = old_balances for i in range(N_COINS_128, bound=MAX_COINS_128): if _amounts[i] != 0: new_balances[i] -= _amounts[i] self._transfer_out(i, _amounts[i], _receiver) D1: uint256 = self.get_D_mem(rates, new_balances, amp) base_fee: uint256 = unsafe_div( unsafe_mul(self.fee, N_COINS), unsafe_mul(4, unsafe_sub(N_COINS, 1)) ) ys: uint256 = unsafe_div((D0 + D1), N_COINS) fees: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) dynamic_fee: uint256 = 0 xs: uint256 = 0 ideal_balance: uint256 = 0 difference: uint256 = 0 new_balance: uint256 = 0 for i in range(N_COINS_128, bound=MAX_COINS_128): ideal_balance = D1 * old_balances[i] / D0 difference = 0 new_balance = new_balances[i] if ideal_balance > new_balance: difference = unsafe_sub(ideal_balance, new_balance) else: difference = unsafe_sub(new_balance, ideal_balance) xs = unsafe_div(rates[i] * (old_balances[i] + new_balance), PRECISION) dynamic_fee = self._dynamic_fee(xs, ys, base_fee) fees.append(unsafe_div(dynamic_fee * difference, FEE_DENOMINATOR)) self.admin_balances[i] += unsafe_div(fees[i] * admin_fee, FEE_DENOMINATOR) new_balances[i] -= fees[i] D1 = self.get_D_mem(rates, new_balances, amp) # dev: reuse D1 for new D. self.upkeep_oracles(self._xp_mem(rates, new_balances), amp, D1) total_supply: uint256 = self.total_supply burn_amount: uint256 = unsafe_div((D0 - D1) * total_supply, D0) + 1 assert burn_amount > 1 # dev: zero tokens burned assert burn_amount <= _max_burn_amount, "Slippage screwed you" self._burnFrom(msg.sender, burn_amount) log RemoveLiquidityImbalance( msg.sender, _amounts, fees, D1, total_supply - burn_amount ) return burn_amount @external @nonreentrant('lock') def remove_liquidity( _burn_amount: uint256, _min_amounts: DynArray[uint256, MAX_COINS], _receiver: address = msg.sender, _claim_admin_fees: bool = True, ) -> DynArray[uint256, MAX_COINS]: """ @notice Withdraw coins from the pool @dev Withdrawal amounts are based on current deposit ratios @param _burn_amount Quantity of LP tokens to burn in the withdrawal @param _min_amounts Minimum amounts of underlying coins to receive @param _receiver Address that receives the withdrawn coins @return List of amounts of coins that were withdrawn """ total_supply: uint256 = self.total_supply assert _burn_amount > 0 # dev: invalid burn amount assert len(_min_amounts) == N_COINS # dev: invalid array length for _min_amounts amounts: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) balances: DynArray[uint256, MAX_COINS] = self._balances() value: uint256 = 0 for i in range(N_COINS_128, bound=MAX_COINS_128): value = unsafe_div(balances[i] * _burn_amount, total_supply) assert value >= _min_amounts[i], "Withdrawal resulted in fewer coins than expected" amounts.append(value) self._transfer_out(i, value, _receiver) self._burnFrom(msg.sender, _burn_amount) # <---- Updates self.total_supply # --------------------------- Upkeep D_oracle ---------------------------- ma_last_time_unpacked: uint256[2] = self.unpack_2(self.ma_last_time) last_D_packed_current: uint256 = self.last_D_packed old_D: uint256 = last_D_packed_current & (2**128 - 1) self.last_D_packed = self.pack_2( old_D - unsafe_div(old_D * _burn_amount, total_supply), # new_D = proportionally reduce D. self._calc_moving_average( last_D_packed_current, self.D_ma_time, ma_last_time_unpacked[1] ) ) if ma_last_time_unpacked[1] < block.timestamp: ma_last_time_unpacked[1] = block.timestamp self.ma_last_time = self.pack_2(ma_last_time_unpacked[0], ma_last_time_unpacked[1]) # ------------------------------- Log event ------------------------------ log RemoveLiquidity( msg.sender, amounts, empty(DynArray[uint256, MAX_COINS]), unsafe_sub(total_supply, _burn_amount) ) # ------- Withdraw admin fees if _claim_admin_fees is set to True -------- if _claim_admin_fees: self._withdraw_admin_fees() return amounts @external @nonreentrant('lock') def withdraw_admin_fees(): """ @notice Claim admin fees. Callable by anyone. """ self._withdraw_admin_fees() # ------------------------ AMM Internal Functions ---------------------------- @view @internal def _dynamic_fee(xpi: uint256, xpj: uint256, _fee: uint256) -> uint256: _offpeg_fee_multiplier: uint256 = self.offpeg_fee_multiplier if _offpeg_fee_multiplier <= FEE_DENOMINATOR: return _fee xps2: uint256 = (xpi + xpj) ** 2 return unsafe_div( unsafe_mul(_offpeg_fee_multiplier, _fee), unsafe_add( unsafe_sub(_offpeg_fee_multiplier, FEE_DENOMINATOR) * 4 * xpi * xpj / xps2, FEE_DENOMINATOR ) ) @internal def __exchange( x: uint256, _xp: DynArray[uint256, MAX_COINS], rates: DynArray[uint256, MAX_COINS], i: int128, j: int128, ) -> uint256: amp: uint256 = self._A() D: uint256 = self.get_D(_xp, amp) y: uint256 = self.get_y(i, j, x, _xp, amp, D) dy: uint256 = _xp[j] - y - 1 # -1 just in case there were some rounding errors dy_fee: uint256 = unsafe_div( dy * self._dynamic_fee( unsafe_div(_xp[i] + x, 2), unsafe_div(_xp[j] + y, 2), self.fee ), FEE_DENOMINATOR ) # Convert all to real units dy = (dy - dy_fee) * PRECISION / rates[j] self.admin_balances[j] += unsafe_div( unsafe_div(dy_fee * admin_fee, FEE_DENOMINATOR) * PRECISION, rates[j] ) # Calculate and store state prices: xp: DynArray[uint256, MAX_COINS] = _xp xp[i] = x xp[j] = y # D is not changed because we did not apply a fee self.upkeep_oracles(xp, amp, D) return dy @internal def _exchange( sender: address, i: int128, j: int128, _dx: uint256, _min_dy: uint256, receiver: address, expect_optimistic_transfer: bool ) -> uint256: assert i != j # dev: coin index out of range assert _dx > 0 # dev: do not exchange 0 coins rates: DynArray[uint256, MAX_COINS] = self._stored_rates() old_balances: DynArray[uint256, MAX_COINS] = self._balances() xp: DynArray[uint256, MAX_COINS] = self._xp_mem(rates, old_balances) # --------------------------- Do Transfer in ----------------------------- # `dx` is whatever the pool received after ERC20 transfer: dx: uint256 = self._transfer_in( i, _dx, sender, expect_optimistic_transfer ) # ------------------------------- Exchange ------------------------------- x: uint256 = xp[i] + unsafe_div(dx * rates[i], PRECISION) dy: uint256 = self.__exchange(x, xp, rates, i, j) assert dy >= _min_dy, "Exchange resulted in fewer coins than expected" # --------------------------- Do Transfer out ---------------------------- self._transfer_out(j, dy, receiver) # ------------------------------------------------------------------------ log TokenExchange(msg.sender, i, dx, j, dy) return dy @internal def _withdraw_admin_fees(): fee_receiver: address = factory.fee_receiver() if fee_receiver == empty(address): return # Do nothing. admin_balances: DynArray[uint256, MAX_COINS] = self.admin_balances for i in range(N_COINS_128, bound=MAX_COINS_128): if admin_balances[i] > 0: self._transfer_out(i, admin_balances[i], fee_receiver) admin_balances[i] = 0 self.admin_balances = admin_balances # --------------------------- AMM Math Functions ----------------------------- @view @internal def get_y( i: int128, j: int128, x: uint256, xp: DynArray[uint256, MAX_COINS], _amp: uint256, _D: uint256 ) -> uint256: """ Calculate x[j] if one makes x[i] = x Done by solving quadratic equation iteratively. x_1**2 + x_1 * (sum' - (A*n**n - 1) * D / (A * n**n)) = D ** (n + 1) / (n ** (2 * n) * prod' * A) x_1**2 + b*x_1 = c x_1 = (x_1**2 + c) / (2*x_1 + b) """ # x in the input is converted to the same price/precision assert i != j # dev: same coin assert j >= 0 # dev: j below zero assert j < N_COINS_128 # dev: j above N_COINS # should be unreachable, but good for safety assert i >= 0 assert i < N_COINS_128 amp: uint256 = _amp D: uint256 = _D S_: uint256 = 0 _x: uint256 = 0 y_prev: uint256 = 0 c: uint256 = D Ann: uint256 = amp * N_COINS for _i in range(MAX_COINS_128): if _i == N_COINS_128: break if _i == i: _x = x elif _i != j: _x = xp[_i] else: continue S_ += _x c = c * D / (_x * N_COINS) c = c * D * A_PRECISION / (Ann * N_COINS) b: uint256 = S_ + D * A_PRECISION / Ann # - D y: uint256 = D for _i in range(255): y_prev = y y = (y*y + c) / (2 * y + b - D) # Equality with the precision of 1 if y > y_prev: if y - y_prev <= 1: return y else: if y_prev - y <= 1: return y raise @pure @internal def get_D(_xp: DynArray[uint256, MAX_COINS], _amp: uint256) -> uint256: """ D invariant calculation in non-overflowing integer operations iteratively A * sum(x_i) * n**n + D = A * D * n**n + D**(n+1) / (n**n * prod(x_i)) Converging solution: D[j+1] = (A * n**n * sum(x_i) - D[j]**(n+1) / (n**n prod(x_i))) / (A * n**n - 1) """ S: uint256 = 0 for x in _xp: S += x if S == 0: return 0 D: uint256 = S Ann: uint256 = _amp * N_COINS for i in range(255): D_P: uint256 = D for x in _xp: D_P = D_P * D / x D_P /= pow_mod256(N_COINS, N_COINS) Dprev: uint256 = D # (Ann * S / A_PRECISION + D_P * N_COINS) * D / ((Ann - A_PRECISION) * D / A_PRECISION + (N_COINS + 1) * D_P) D = ( (unsafe_div(Ann * S, A_PRECISION) + D_P * N_COINS) * D / ( unsafe_div((Ann - A_PRECISION) * D, A_PRECISION) + unsafe_add(N_COINS, 1) * D_P ) ) # Equality with the precision of 1 if D > Dprev: if D - Dprev <= 1: return D else: if Dprev - D <= 1: return D # convergence typically occurs in 4 rounds or less, this should be unreachable! # if it does happen the pool is borked and LPs can withdraw via `remove_liquidity` raise @pure @internal def get_y_D( A: uint256, i: int128, xp: DynArray[uint256, MAX_COINS], D: uint256 ) -> uint256: """ Calculate x[i] if one reduces D from being calculated for xp to D Done by solving quadratic equation iteratively. x_1**2 + x_1 * (sum' - (A*n**n - 1) * D / (A * n**n)) = D ** (n + 1) / (n ** (2 * n) * prod' * A) x_1**2 + b*x_1 = c x_1 = (x_1**2 + c) / (2*x_1 + b) """ # x in the input is converted to the same price/precision assert i >= 0 # dev: i below zero assert i < N_COINS_128 # dev: i above N_COINS S_: uint256 = 0 _x: uint256 = 0 y_prev: uint256 = 0 c: uint256 = D Ann: uint256 = A * N_COINS for _i in range(MAX_COINS_128): if _i == N_COINS_128: break if _i != i: _x = xp[_i] else: continue S_ += _x c = c * D / (_x * N_COINS) c = c * D * A_PRECISION / (Ann * N_COINS) b: uint256 = S_ + D * A_PRECISION / Ann y: uint256 = D for _i in range(255): y_prev = y y = (y*y + c) / (2 * y + b - D) # Equality with the precision of 1 if y > y_prev: if y - y_prev <= 1: return y else: if y_prev - y <= 1: return y raise @view @internal def _A() -> uint256: """ Handle ramping A up or down """ t1: uint256 = self.future_A_time A1: uint256 = self.future_A if block.timestamp < t1: A0: uint256 = self.initial_A t0: uint256 = self.initial_A_time # Expressions in uint256 cannot have negative numbers, thus "if" if A1 > A0: return A0 + unsafe_sub(A1, A0) * (block.timestamp - t0) / (t1 - t0) else: return A0 - unsafe_sub(A0, A1) * (block.timestamp - t0) / (t1 - t0) else: # when t1 == 0 or block.timestamp >= t1 return A1 @pure @internal def _xp_mem( _rates: DynArray[uint256, MAX_COINS], _balances: DynArray[uint256, MAX_COINS] ) -> DynArray[uint256, MAX_COINS]: result: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) for i in range(N_COINS_128, bound=MAX_COINS_128): result.append(unsafe_div(_rates[i] * _balances[i], PRECISION)) return result @view @internal def get_D_mem( _rates: DynArray[uint256, MAX_COINS], _balances: DynArray[uint256, MAX_COINS], _amp: uint256 ) -> uint256: xp: DynArray[uint256, MAX_COINS] = self._xp_mem(_rates, _balances) return self.get_D(xp, _amp) @view @internal def _calc_withdraw_one_coin( _burn_amount: uint256, i: int128 ) -> ( uint256, uint256, DynArray[uint256, MAX_COINS], uint256, uint256 ): # First, need to calculate # * Get current D # * Solve Eqn against y_i for D - _token_amount amp: uint256 = self._A() rates: DynArray[uint256, MAX_COINS] = self._stored_rates() xp: DynArray[uint256, MAX_COINS] = self._xp_mem(rates, self._balances()) D0: uint256 = self.get_D(xp, amp) total_supply: uint256 = self.total_supply D1: uint256 = D0 - _burn_amount * D0 / total_supply new_y: uint256 = self.get_y_D(amp, i, xp, D1) base_fee: uint256 = unsafe_div( unsafe_mul(self.fee, N_COINS), unsafe_mul(4, unsafe_sub(N_COINS, 1)) ) xp_reduced: DynArray[uint256, MAX_COINS] = xp ys: uint256 = unsafe_div((D0 + D1), unsafe_mul(2, N_COINS)) dx_expected: uint256 = 0 xp_j: uint256 = 0 xavg: uint256 = 0 dynamic_fee: uint256 = 0 for j in range(MAX_COINS_128): if j == N_COINS_128: break dx_expected = 0 xp_j = xp[j] if j == i: dx_expected = xp_j * D1 / D0 - new_y xavg = unsafe_div((xp_j + new_y), 2) else: dx_expected = xp_j - xp_j * D1 / D0 xavg = xp_j dynamic_fee = self._dynamic_fee(xavg, ys, base_fee) xp_reduced[j] = xp_j - unsafe_div(dynamic_fee * dx_expected, FEE_DENOMINATOR) dy: uint256 = xp_reduced[i] - self.get_y_D(amp, i, xp_reduced, D1) dy_0: uint256 = (xp[i] - new_y) * PRECISION / rates[i] # w/o fees dy = unsafe_div((dy - 1) * PRECISION, rates[i]) # Withdraw less to account for rounding errors # update xp with new_y for p calculations. xp[i] = new_y return dy, dy_0 - dy, xp, amp, D1 # -------------------------- AMM Price Methods ------------------------------- @pure @internal def pack_2(p1: uint256, p2: uint256) -> uint256: assert p1 < 2**128 assert p2 < 2**128 return p1 | (p2 << 128) @pure @internal def unpack_2(packed: uint256) -> uint256[2]: return [packed & (2**128 - 1), packed >> 128] @internal @pure def _get_p( xp: DynArray[uint256, MAX_COINS], amp: uint256, D: uint256, ) -> DynArray[uint256, MAX_COINS]: # dx_0 / dx_1 only, however can have any number of coins in pool ANN: uint256 = unsafe_mul(amp, N_COINS) Dr: uint256 = unsafe_div(D, pow_mod256(N_COINS, N_COINS)) for i in range(N_COINS_128, bound=MAX_COINS_128): Dr = Dr * D / xp[i] p: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS]) xp0_A: uint256 = unsafe_div(ANN * xp[0], A_PRECISION) for i in range(1, MAX_COINS): if i == N_COINS: break p.append(10**18 * (xp0_A + unsafe_div(Dr * xp[0], xp[i])) / (xp0_A + Dr)) return p @internal def upkeep_oracles(xp: DynArray[uint256, MAX_COINS], amp: uint256, D: uint256): """ @notice Upkeeps price and D oracles. """ ma_last_time_unpacked: uint256[2] = self.unpack_2(self.ma_last_time) last_prices_packed_current: DynArray[uint256, MAX_COINS] = self.last_prices_packed last_prices_packed_new: DynArray[uint256, MAX_COINS] = last_prices_packed_current spot_price: DynArray[uint256, MAX_COINS] = self._get_p(xp, amp, D) # -------------------------- Upkeep price oracle ------------------------- for i in range(MAX_COINS): if i == N_COINS - 1: break if spot_price[i] != 0: # Update packed prices ----------------- last_prices_packed_new[i] = self.pack_2( min(spot_price[i], 2 * 10**18), # <----- Cap spot value by 2. self._calc_moving_average( last_prices_packed_current[i], self.ma_exp_time, ma_last_time_unpacked[0], # index 0 is ma_last_time for prices ) ) self.last_prices_packed = last_prices_packed_new # ---------------------------- Upkeep D oracle --------------------------- last_D_packed_current: uint256 = self.last_D_packed self.last_D_packed = self.pack_2( D, self._calc_moving_average( last_D_packed_current, self.D_ma_time, ma_last_time_unpacked[1], # index 1 is ma_last_time for D ) ) # Housekeeping: Update ma_last_time for p and D oracles ------------------ for i in range(2): if ma_last_time_unpacked[i] < block.timestamp: ma_last_time_unpacked[i] = block.timestamp self.ma_last_time = self.pack_2(ma_last_time_unpacked[0], ma_last_time_unpacked[1]) @internal @view def _calc_moving_average( packed_value: uint256, averaging_window: uint256, ma_last_time: uint256 ) -> uint256: last_spot_value: uint256 = packed_value & (2**128 - 1) last_ema_value: uint256 = (packed_value >> 128) if ma_last_time < block.timestamp: # calculate new_ema_value and return that. alpha: uint256 = self.exp( -convert( unsafe_div(unsafe_mul(unsafe_sub(block.timestamp, ma_last_time), 10**18), averaging_window), int256 ) ) return unsafe_div(last_spot_value * (10**18 - alpha) + last_ema_value * alpha, 10**18) return last_ema_value @view @external def last_price(i: uint256) -> uint256: return self.last_prices_packed[i] & (2**128 - 1) @view @external def ema_price(i: uint256) -> uint256: return (self.last_prices_packed[i] >> 128) @external @view def get_p(i: uint256) -> uint256: """ @notice Returns the AMM State price of token @dev if i = 0, it will return the state price of coin[1]. @param i index of state price (0 for coin[1], 1 for coin[2], ...) @return uint256 The state price quoted by the AMM for coin[i+1] """ amp: uint256 = self._A() xp: DynArray[uint256, MAX_COINS] = self._xp_mem( self._stored_rates(), self._balances() ) D: uint256 = self.get_D(xp, amp) return self._get_p(xp, amp, D)[i] @external @view @nonreentrant('lock') def price_oracle(i: uint256) -> uint256: return self._calc_moving_average( self.last_prices_packed[i], self.ma_exp_time, self.ma_last_time & (2**128 - 1) ) @external @view @nonreentrant('lock') def D_oracle() -> uint256: return self._calc_moving_average( self.last_D_packed, self.D_ma_time, self.ma_last_time >> 128 ) # ----------------------------- Math Utils ----------------------------------- @internal @pure def exp(x: int256) -> uint256: """ @dev Calculates the natural exponential function of a signed integer with a precision of 1e18. @notice Note that this function consumes about 810 gas units. The implementation is inspired by Remco Bloemen's implementation under the MIT license here: https://xn--2-umb.com/22/exp-ln. @dev This implementation is derived from Snekmate, which is authored by pcaversaccio (Snekmate), distributed under the AGPL-3.0 license. https://github.com/pcaversaccio/snekmate @param x The 32-byte variable. @return int256 The 32-byte calculation result. """ value: int256 = x # If the result is `< 0.5`, we return zero. This happens when we have the following: # "x <= floor(log(0.5e18) * 1e18) ~ -42e18". if (x <= -41446531673892822313): return empty(uint256) # When the result is "> (2 ** 255 - 1) / 1e18" we cannot represent it as a signed integer. # This happens when "x >= floor(log((2 ** 255 - 1) / 1e18) * 1e18) ~ 135". assert x < 135305999368893231589, "wad_exp overflow" # `x` is now in the range "(-42, 136) * 1e18". Convert to "(-42, 136) * 2 ** 96" for higher # intermediate precision and a binary base. This base conversion is a multiplication with # "1e18 / 2 ** 96 = 5 ** 18 / 2 ** 78". value = unsafe_div(x << 78, 5 ** 18) # Reduce the range of `x` to "(-½ ln 2, ½ ln 2) * 2 ** 96" by factoring out powers of two # so that "exp(x) = exp(x') * 2 ** k", where `k` is a signer integer. Solving this gives # "k = round(x / log(2))" and "x' = x - k * log(2)". Thus, `k` is in the range "[-61, 195]". k: int256 = unsafe_add(unsafe_div(value << 96, 54916777467707473351141471128), 2 ** 95) >> 96 value = unsafe_sub(value, unsafe_mul(k, 54916777467707473351141471128)) # Evaluate using a "(6, 7)"-term rational approximation. Since `p` is monic, # we will multiply by a scaling factor later. y: int256 = unsafe_add(unsafe_mul(unsafe_add(value, 1346386616545796478920950773328), value) >> 96, 57155421227552351082224309758442) p: int256 = unsafe_add(unsafe_mul(unsafe_add(unsafe_mul(unsafe_sub(unsafe_add(y, value), 94201549194550492254356042504812), y) >> 96,\ 28719021644029726153956944680412240), value), 4385272521454847904659076985693276 << 96) # We leave `p` in the "2 ** 192" base so that we do not have to scale it up # again for the division. q: int256 = unsafe_add(unsafe_mul(unsafe_sub(value, 2855989394907223263936484059900), value) >> 96, 50020603652535783019961831881945) q = unsafe_sub(unsafe_mul(q, value) >> 96, 533845033583426703283633433725380) q = unsafe_add(unsafe_mul(q, value) >> 96, 3604857256930695427073651918091429) q = unsafe_sub(unsafe_mul(q, value) >> 96, 14423608567350463180887372962807573) q = unsafe_add(unsafe_mul(q, value) >> 96, 26449188498355588339934803723976023) # The polynomial `q` has no zeros in the range because all its roots are complex. # No scaling is required, as `p` is already "2 ** 96" too large. Also, # `r` is in the range "(0.09, 0.25) * 2**96" after the division. r: int256 = unsafe_div(p, q) # To finalise the calculation, we have to multiply `r` by: # - the scale factor "s = ~6.031367120", # - the factor "2 ** k" from the range reduction, and # - the factor "1e18 / 2 ** 96" for the base conversion. # We do this all at once, with an intermediate result in "2**213" base, # so that the final right shift always gives a positive value. # Note that to circumvent Vyper's safecast feature for the potentially # negative parameter value `r`, we first convert `r` to `bytes32` and # subsequently to `uint256`. Remember that the EVM default behaviour is # to use two's complement representation to handle signed integers. return unsafe_mul(convert(convert(r, bytes32), uint256), 3822833074963236453042738258902158003155416615667) >> convert(unsafe_sub(195, k), uint256) # ---------------------------- ERC20 Utils ----------------------------------- @view @internal def _domain_separator() -> bytes32: if chain.id != CACHED_CHAIN_ID: return keccak256( _abi_encode( EIP712_TYPEHASH, NAME_HASH, VERSION_HASH, chain.id, self, salt, ) ) return CACHED_DOMAIN_SEPARATOR @internal def _transfer(_from: address, _to: address, _value: uint256): # # NOTE: vyper does not allow underflows # # so the following subtraction would revert on insufficient balance self.balanceOf[_from] -= _value self.balanceOf[_to] += _value log Transfer(_from, _to, _value) @internal def _burnFrom(_from: address, _burn_amount: uint256): self.total_supply -= _burn_amount self.balanceOf[_from] -= _burn_amount log Transfer(_from, empty(address), _burn_amount) @external def transfer(_to : address, _value : uint256) -> bool: """ @dev Transfer token for a specified address @param _to The address to transfer to. @param _value The amount to be transferred. """ self._transfer(msg.sender, _to, _value) return True @external def transferFrom(_from : address, _to : address, _value : uint256) -> bool: """ @dev Transfer tokens from one address to another. @param _from address The address which you want to send tokens from @param _to address The address which you want to transfer to @param _value uint256 the amount of tokens to be transferred """ self._transfer(_from, _to, _value) _allowance: uint256 = self.allowance[_from][msg.sender] if _allowance != max_value(uint256): _new_allowance: uint256 = _allowance - _value self.allowance[_from][msg.sender] = _new_allowance log Approval(_from, msg.sender, _new_allowance) return True @external def approve(_spender : address, _value : uint256) -> bool: """ @notice Approve the passed address to transfer the specified amount of tokens on behalf of msg.sender @dev Beware that changing an allowance via this method brings the risk that someone may use both the old and new allowance by unfortunate transaction ordering: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 @param _spender The address which will transfer the funds @param _value The amount of tokens that may be transferred @return bool success """ self.allowance[msg.sender][_spender] = _value log Approval(msg.sender, _spender, _value) return True @external def permit( _owner: address, _spender: address, _value: uint256, _deadline: uint256, _v: uint8, _r: bytes32, _s: bytes32 ) -> bool: """ @notice Approves spender by owner's signature to expend owner's tokens. See https://eips.ethereum.org/EIPS/eip-2612. @dev Inspired by https://github.com/yearn/yearn-vaults/blob/main/contracts/Vault.vy#L753-L793 @dev Supports smart contract wallets which implement ERC1271 https://eips.ethereum.org/EIPS/eip-1271 @param _owner The address which is a source of funds and has signed the Permit. @param _spender The address which is allowed to spend the funds. @param _value The amount of tokens to be spent. @param _deadline The timestamp after which the Permit is no longer valid. @param _v The bytes[64] of the valid secp256k1 signature of permit by owner @param _r The bytes[0:32] of the valid secp256k1 signature of permit by owner @param _s The bytes[32:64] of the valid secp256k1 signature of permit by owner @return True, if transaction completes successfully """ assert _owner != empty(address) assert block.timestamp <= _deadline nonce: uint256 = self.nonces[_owner] digest: bytes32 = keccak256( concat( b"\x19\x01", self._domain_separator(), keccak256(_abi_encode(EIP2612_TYPEHASH, _owner, _spender, _value, nonce, _deadline)) ) ) if _owner.is_contract: sig: Bytes[65] = concat(_abi_encode(_r, _s), slice(convert(_v, bytes32), 31, 1)) # reentrancy not a concern since this is a staticcall assert ERC1271(_owner).isValidSignature(digest, sig) == ERC1271_MAGIC_VAL else: assert ecrecover(digest, convert(_v, uint256), convert(_r, uint256), convert(_s, uint256)) == _owner self.allowance[_owner][_spender] = _value self.nonces[_owner] = unsafe_add(nonce, 1) log Approval(_owner, _spender, _value) return True @view @external def DOMAIN_SEPARATOR() -> bytes32: """ @notice EIP712 domain separator. @return bytes32 Domain Separator set for the current chain. """ return self._domain_separator() # ------------------------- AMM View Functions ------------------------------- @view @external def get_dx(i: int128, j: int128, dy: uint256) -> uint256: """ @notice Calculate the current input dx given output dy @dev Index values can be found via the `coins` public getter method @param i Index value for the coin to send @param j Index value of the coin to receive @param dy Amount of `j` being received after exchange @return Amount of `i` predicted """ return StableSwapViews(factory.views_implementation()).get_dx(i, j, dy, self) @view @external def get_dy(i: int128, j: int128, dx: uint256) -> uint256: """ @notice Calculate the current output dy given input dx @dev Index values can be found via the `coins` public getter method @param i Index value for the coin to send @param j Index value of the coin to receive @param dx Amount of `i` being exchanged @return Amount of `j` predicted """ return StableSwapViews(factory.views_implementation()).get_dy(i, j, dx, self) @view @external def calc_withdraw_one_coin(_burn_amount: uint256, i: int128) -> uint256: """ @notice Calculate the amount received when withdrawing a single coin @param _burn_amount Amount of LP tokens to burn in the withdrawal @param i Index value of the coin to withdraw @return Amount of coin received """ return self._calc_withdraw_one_coin(_burn_amount, i)[0] @view @external @nonreentrant('lock') def totalSupply() -> uint256: """ @notice The total supply of pool LP tokens @return self.total_supply, 18 decimals. """ return self.total_supply @view @external @nonreentrant('lock') def get_virtual_price() -> uint256: """ @notice The current virtual price of the pool LP token @dev Useful for calculating profits. The method may be vulnerable to donation-style attacks if implementation contains rebasing tokens. For integrators, caution is advised. @return LP token virtual price normalized to 1e18 """ amp: uint256 = self._A() xp: DynArray[uint256, MAX_COINS] = self._xp_mem( self._stored_rates(), self._balances() ) D: uint256 = self.get_D(xp, amp) # D is in the units similar to DAI (e.g. converted to precision 1e18) # When balanced, D = n * x_u - total virtual value of the portfolio return D * PRECISION / self.total_supply @view @external def calc_token_amount( _amounts: DynArray[uint256, MAX_COINS], _is_deposit: bool ) -> uint256: """ @notice Calculate addition or reduction in token supply from a deposit or withdrawal @param _amounts Amount of each coin being deposited @param _is_deposit set True for deposits, False for withdrawals @return Expected amount of LP tokens received """ return StableSwapViews(factory.views_implementation()).calc_token_amount(_amounts, _is_deposit, self) @view @external def A() -> uint256: return unsafe_div(self._A(), A_PRECISION) @view @external def A_precise() -> uint256: return self._A() @view @external def balances(i: uint256) -> uint256: """ @notice Get the current balance of a coin within the pool, less the accrued admin fees @param i Index value for the coin to query balance of @return Token balance """ return self._balances()[i] @view @external def get_balances() -> DynArray[uint256, MAX_COINS]: return self._balances() @view @external def stored_rates() -> DynArray[uint256, MAX_COINS]: return self._stored_rates() @view @external def dynamic_fee(i: int128, j: int128) -> uint256: """ @notice Return the fee for swapping between `i` and `j` @param i Index value for the coin to send @param j Index value of the coin to receive @return Swap fee expressed as an integer with 1e10 precision """ return StableSwapViews(factory.views_implementation()).dynamic_fee(i, j, self) # --------------------------- AMM Admin Functions ---------------------------- @external def ramp_A(_future_A: uint256, _future_time: uint256): assert msg.sender == factory.admin() # dev: only owner assert block.timestamp >= self.initial_A_time + MIN_RAMP_TIME assert _future_time >= block.timestamp + MIN_RAMP_TIME # dev: insufficient time _initial_A: uint256 = self._A() _future_A_p: uint256 = _future_A * A_PRECISION assert _future_A > 0 and _future_A < MAX_A if _future_A_p < _initial_A: assert _future_A_p * MAX_A_CHANGE >= _initial_A else: assert _future_A_p <= _initial_A * MAX_A_CHANGE self.initial_A = _initial_A self.future_A = _future_A_p self.initial_A_time = block.timestamp self.future_A_time = _future_time log RampA(_initial_A, _future_A_p, block.timestamp, _future_time) @external def stop_ramp_A(): assert msg.sender == factory.admin() # dev: only owner current_A: uint256 = self._A() self.initial_A = current_A self.future_A = current_A self.initial_A_time = block.timestamp self.future_A_time = block.timestamp # now (block.timestamp < t1) is always False, so we return saved A log StopRampA(current_A, block.timestamp) @external def set_new_fee(_new_fee: uint256, _new_offpeg_fee_multiplier: uint256): assert msg.sender == factory.admin() # set new fee: assert _new_fee <= MAX_FEE self.fee = _new_fee # set new offpeg_fee_multiplier: assert _new_offpeg_fee_multiplier * _new_fee <= MAX_FEE * FEE_DENOMINATOR # dev: offpeg multiplier exceeds maximum self.offpeg_fee_multiplier = _new_offpeg_fee_multiplier log ApplyNewFee(_new_fee, _new_offpeg_fee_multiplier) @external def set_ma_exp_time(_ma_exp_time: uint256, _D_ma_time: uint256): """ @notice Set the moving average window of the price oracles. @param _ma_exp_time Moving average window for the price oracle. It is time_in_seconds / ln(2). @param _D_ma_time Moving average window for the D oracle. It is time_in_seconds / ln(2). """ assert msg.sender == factory.admin() # dev: only owner assert unsafe_mul(_ma_exp_time, _D_ma_time) > 0 # dev: 0 in input values self.ma_exp_time = _ma_exp_time self.D_ma_time = _D_ma_time log SetNewMATime(_ma_exp_time, _D_ma_time)
1
20,290,580
7a652c6a66831b1ae70dfc7707fca3947989d45825d4b562fea81efb0baebde1
c05fb80697516ae262db2f7fb616db3411281edeaecefab47122cdc9e5ba083a
f7bd34dd44b92fb2f9c3d2e31aaad06570a853a6
6a8cbed756804b16e05e741edabd5cb544ae21bf
f98cbbe9eb3fcb9a793fb4d0a82854023970d4a4
6129c551503461035a576020612cd95f395f518060a01c61035a57604052604051600d5533600b5532600c556040516395d89b4160a052606060a0600460bc845afa61004d573d5f5f3e3d5ffd5b60403d1061035a5760a05160a001602081511161035a5780516101205260208101516101405250610120905080516060526020810151608052505f6009610100527f43757276652e666920000000000000000000000000000000000000000000000061012052610100805160208201836101a00181518152505080830192505050606051816101a001608051815250808201915050600e610140527f204761756765204465706f73697400000000000000000000000000000000000061016052610140805160208201836101a001815181525050808301925050508061018052610180905060208151018060a0828460045afa505050602060a051015f81601f0160051c6003811161035a57801561017957905b8060051b60a001518160040155600101818118610161575b5050505f60605181610160016080518152508082019150506006610100527f2d67617567650000000000000000000000000000000000000000000000000000610120526101008051602082018361016001815181525050808301925050508061014052610140905060208151015f81601f0160051c6003811161035a57801561021557905b8060051b84015181600701556001018181186101fe575b505050504260235563b26b238e610100526020610100600461011c5f73d533a949740bb3306d119cc777fa900ba034cd525af1610254573d5f5f3e3d5ffd5b60203d1061035a576101005160d81b632c4e722e610140526020610140600461015c73d533a949740bb3306d119cc777fa900ba034cd525afa610299573d5f5f3e3d5ffd5b60203d1061035a576101405180820182811061035a5790509050600f5560a05160c0206129655260014303406129a55246612985527f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6101205261296551610140527f71916ddf3efd1d13d14899519c9cd193fa3f9be07ea852717d2f225de1eb2466610160524661018052306101a0526129a5516101c05260c0610100526101008051602082012090506129c55261296561035e610000396129e5610000f35b5f80fd5f3560e01c6002603f821660011b6128e501601e395f51565b63bfa0b133811861003657346128e15760206129a560403960206040f35b63095ea7b38118611c2d576044361034176128e1576004358060a01c6128e1576040526024356003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560243560605260206060a3600160605260206060f3611c2d565b6370a0823181186100f2576024361034176128e1576004358060a01c6128e15760405260016040516020525f5260405f205460605260206060f35b6301ddabf18118611c2d576024361034176128e1576004358060a01c6128e15760405260126040516020525f5260405f205460605260206060f3611c2d565b6318160ddd811861014d57346128e15760025460405260206040f35b6323b872dd8118611c2d576064361034176128e1576004358060a01c6128e1576103a0526024358060a01c6128e1576103c0525f546002146128e15760025f5560036103a0516020525f5260405f2080336020525f5260405f209050546103e0527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6103e0511461020b576103e0516044358082038281116128e1579050905060036103a0516020525f5260405f2080336020525f5260405f209050555b6103a0516102e0526103c051610300526044356103205261022a612779565b600161040052602061040060035f55f3611c2d565b63dd62ed3e8118610297576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260036040516020525f5260405f20806060516020525f5260405f2090505460805260206080f35b6384e9bd7e8118611c2d576024361034176128e1576004358060a01c6128e1576102e0525f61030052610f3a56611c2d565b6306fdde03811861034457346128e157602080604052806040016020600454015f81601f0160051c600381116128e157801561031857905b80600401548160051b850152600101818118610301575b5050508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f35b63331345838118611c2d576024361034176128e1576004358060a01c6128e1576102805261028051604052610377611cc4565b6019610280516020525f5260405f2054638b752bb06102a052610280516102c052306102e05260206102a060446102bc73d061d61a4d941c39e5453435b6345dc261c2fce05afa6103ca573d5f5f3e3d5ffd5b60203d106128e1576102a0518082038281116128e15790509050610300526020610300f3611c2d565b6395d89b418118611c2d57346128e157602080604052806040016020600754015f81601f0160051c600381116128e157801561044257905b80600701548160051b85015260010181811861042b575b5050508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f3611c2d565b637ecebe0081146003361116156104b3576024361034176128e1576004358060a01c6128e157604052600a6040516020525f5260405f205460605260206060f35b639c868ac08118611c2d57346128e157600e5460405260206040f3611c2d565b63c45a015581186104ef57346128e157600b5460405260206040f35b633644e5158118611c2d57346128e157602061050c610120611c31565b610120f3611c2d565b63481c6a75811861053157346128e157600c5460405260206040f35b6396c551758118611c2d576024361034176128e1576004358060a01c6128e157610280526018610280516020525f5260405f20546102a05263da020a1861032052610280516103405263010ae7576102e052610280516103005260206102e060246102fc735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa6105b8573d5f5f3e3d5ffd5b60203d106128e1576102e051610360526020610320604461033c735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa6105f5573d5f5f3e3d5ffd5b60203d106128e157610320516102c0526001610280516020525f5260405f20546102e0526370a082316103005261028051610320526020610300602461031c735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa610657573d5f5f3e3d5ffd5b60203d106128e1576103005161066e576001610678565b6102a0516102c051115b156128e1576102e051602881028160288204186128e15790506064810490506015610280516020525f5260405f205411156128e157610280516040526106bc611cc4565b610280516040526001610280516020525f5260405f20546060526002546080526106e46125c3565b00611c2d565b6382c630668118611c2d57346128e157600d5460405260206040f3611c2d565b63963c94b98118611c2d57346128e15760105460405260206040f3611c2d565b6348e9c65e8118611c2d576024361034176128e1576004358060a01c6128e15760405260116040516020525f5260405f2080546060526001810154608052600281015460a052600381015460c052600481015460e0526005810154610100525060c06060f3611c2d565b63f05cc0588118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260136040516020525f5260405f20806060516020525f5260405f2090505460805260206080f3611c2d565b6313ecb1ca8118611c2d576024361034176128e1576004358060a01c6128e15760405260156040516020525f5260405f205460605260206060f3611c2d565b6317e280898118611c2d57346128e15760165460405260206040f3611c2d565b63de263bfa8118611c2d576024361034176128e1576004358060a01c6128e15760405260176040516020525f5260405f205460605260206060f3611c2d565b639bd324f281186108c9576024361034176128e1576004358060a01c6128e15760405260186040516020525f5260405f205460605260206060f35b63e6f1daf28118611c2d57346128e157336102e0525f61030052610f3a56611c2d565b63094007078118610927576024361034176128e1576004358060a01c6128e15760405260196040516020525f5260405f205460605260206060f35b6383df67478118611c2d576064361034176128e1576024358060a01c6128e1576102e0526044358060011c6128e157610300525b5f546002146128e15760025f556102e051156128e1576102e051604052610980611cc4565b60043515610af2576010541515610320526002546103405261032051156109c2576102e05160405261034051606052610300516080525f60a0526109c26121f9565b610340516004358082018281106128e157905090506103405260016102e0516020525f5260405f20546004358082018281106128e15790509050610360526103605160016102e0516020525f5260405f2055610340516002556102e0516040526103605160605261034051608052610a386125c3565b600d546323b872dd61038052336103a052306103c0526004356103e0526020610380606461039c5f855af1610a6f573d5f5f3e3d5ffd5b60203d106128e157610380518060011c6128e1576104005261040050506102e0517fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c600435610380526020610380a26102e0515f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600435610380526020610380a35b60035f5500611c2d565b63ef78d4fd8118611c2d57346128e157601a5460405260206040f3611c2d565b6354c49fe98118610b49576024361034176128e157600435600781116128e157601b015460405260206040f35b63be5d1be98118611c2d57346128e157600f5460d81c60405260206040f3611c2d565b637598108c8118610ba5576024361034176128e1576004356c01431e0fae6d7217ca9fffffff81116128e1576023015460405260206040f35b63fec8ee0c8118611c2d576024361034176128e1576004356c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015460405260206040f3611c2d565b63b6b55f258118610c12576024361034176128e157336102e0525f6103005261095b565b636e553f658118611c2d576044361034176128e1576024358060a01c6128e1576102e0525f6103005261095b56611c2d565b632e1a7d4d8118610c63576024361034176128e1575f6102e052610d88565b63e8de0d4d8118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605233600c548118610ca5576001610ce8565b600b5463f851a44060e052602060e0600460fc845afa610cc7573d5f5f3e3d5ffd5b60203d106128e15760e0518060a01c6128e157610120526101209050518118155b9050156128e157606051156128e1576010546080526007608051116128e15760116040516020525f5260405f20600181019050546128e15760605160116040516020525f5260405f2060018101905055604051608051600781116128e157601b0155608051600181018181106128e157905060105500611c2d565b6338d074368118611c2d576044361034176128e1576024358060011c6128e1576102e0525b5f546002146128e15760025f5533604052610da1611cc4565b60043515610e9d57601054151561030052600254610320526103005115610de05733604052610320516060526102e0516080525f60a052610de06121f9565b610320516004358082038281116128e15790509050610320526001336020525f5260405f20546004358082038281116128e1579050905061034052610340516001336020525f5260405f205561032051600255336040526103405160605261032051608052610e4d6125c3565b600d5463a9059cbb6103605233610380526004356103a0526020610360604461037c5f855af1610e7f573d5f5f3e3d5ffd5b60203d106128e157610360518060011c6128e1576103c0526103c050505b337f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364600435610300526020610300a25f337fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600435610300526020610300a360035f5500611c2d565b639faceb1b8118611c2d576044361034176128e1576004358060a01c6128e1576102e0526024358060a01c6128e157610300525b5f546002146128e15760025f556103005115610f5b57336102e051186128e1575b6102e05160405260025460605260016080526103005160a052610f7c6121f9565b60035f5500611c2d565b63a9059cbb8118611c2d576044361034176128e1576004358060a01c6128e1576103a0525f546002146128e15760025f55336102e0526103a0516103005260243561032052610fd3612779565b60016103c05260206103c060035f55f3611c2d565b63d505accf8118611c2d5760e4361034176128e1576004358060a01c6128e157610120526024358060a01c6128e157610140526084358060081c6128e1576101605261012051156128e15760643542116128e157600a610120516020525f5260405f2054610180525f60026101c0527f19010000000000000000000000000000000000000000000000000000000000006101e0526101c08051602082018361032001815181525050808301925050506110a2610200611c31565b610200518161032001526020810190507f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c961024052610120516102605261014051610280526044356102a052610180516102c0526064356102e05260c061022052610220805160208201209050816103200152602081019050806103005261030090508051602082012090506101a052610120515f610240526101a0516101c052610160516101e052604060a461020037602061024060806101c060015afa5061024051186128e1576044356003610120516020525f5260405f2080610140516020525f5260405f2090505560016101805101600a610120516020525f5260405f205561014051610120517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9256044356101c05260206101c0a360016101c05260206101c0f3611c2d565b63395093518118611c2d576044361034176128e1576004358060a01c6128e1576040526003336020525f5260405f20806040516020525f5260405f209050546024358082018281106128e157905090506060526060516003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560605160805260206080a3600160805260206080f3611c2d565b63a457c2d7811861134a576044361034176128e1576004358060a01c6128e1576040526003336020525f5260405f20806040516020525f5260405f209050546024358082038281116128e157905090506060526060516003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560605160805260206080a3600160805260206080f35b6390b229978118611c2d576024361034176128e1576004358060011c6128e157604052600b5463f851a440606052602060606004607c845afa61138f573d5f5f3e3d5ffd5b60203d106128e1576060518060a01c6128e15760a05260a090505133186128e157604051600e5500611c2d565b634b8200938118611c2d576024361034176128e1576004358060a01c6128e15761028052336102805181186113f257600161140b565b73d061d61a4d941c39e5453435b6345dc261c2fce08118155b9050156128e15761028051604052611421611cc4565b610280516040526001610280516020525f5260405f20546060526002546080526114496125c3565b60016102a05260206102a0f3611c2d565b63bdf981168118611c2d576024361034176128e1576004358060a01c6128e1576040526040516012336020525f5260405f205500611c2d565b63aace1d488118611c2d576024361034176128e1576004358060a01c6128e15760405233600c5481186114c757600161150a565b600b5463f851a44060c052602060c0600460dc845afa6114e9573d5f5f3e3d5ffd5b60203d106128e15760c0518060a01c6128e157610100526101009050518118155b9050156128e157604051600c557fe83c80a0349150991cb09b4c940149ac4c37cb03673b6c0c669b4da27865c28b60405160605260206060a100611c2d565b6393f7aa67811861156b576044361034176128e15762093a80610300526115a7565b63313ce5678118611c2d57346128e157601260405260206040f3611c2d565b6333b50aed8118611826576064361034176128e157604435610300525b6004358060a01c6128e1576102e0525f546002146128e15760025f5560116102e0516020525f5260405f206001810190505433186128e1575f6040526002546060526040366080376115f76121f9565b6102e0516370a082316103405230610360526020610340602461035c845afa611622573d5f5f3e3d5ffd5b60203d106128e157610340905051610320526102e0516323b872dd61034052336103605230610380526024356103a0526020610340606461035c5f855af161166c573d5f5f3e3d5ffd5b3d61168357803b156128e15760016103c05261169c565b60203d106128e157610340518060011c6128e1576103c0525b6103c0905051156128e1576102e0516370a082316103405230610360526020610340602461035c845afa6116d2573d5f5f3e3d5ffd5b60203d106128e157610340905051610320518082038281116128e157905090506103205260116102e0516020525f5260405f206002810190505461034052610300516103205111156128e157610340514210156117b45761034051428082038281116128e15790509050610360526103605160116102e0516020525f5260405f20600381019050548082028115838383041417156128e157905090506103805261032051610380518082018281106128e157905090506103005180156128e1578082049050905060116102e0516020525f5260405f20600381019050556117e0565b610320516103005180156128e1578082049050905060116102e0516020525f5260405f20600381019050555b4260116102e0516020525f5260405f206004810190505542610300518082018281106128e1579050905060116102e0516020525f5260405f206002810190505560035f55005b63d31f3f6d8118611c2d57346128e157601a546c01431e0fae6d7217ca9fffffff81116128e1576023015460405260206040f3611c2d565b63058a3a248118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260116040516020525f5260405f20600181019050546080523360805181186118b857600161190f565b600b5463f851a440610100526020610100600461011c845afa6118dd573d5f5f3e3d5ffd5b60203d106128e157610100518060a01c6128e15761014052610140905051811861190857600161190f565b600c548118155b9050156128e157608051156128e157606051156128e15760605160116040516020525f5260405f206001810190505500611c2d565b63e77e74378118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260146040516020525f5260405f20806060516020525f5260405f209050546fffffffffffffffffffffffffffffffff8116905060805260206080f3611c2d565b6333fd6f748118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260116060516020525f5260405f206005810190505460805260025460a05260a05115611aca574260116060516020525f5260405f20600281019050548082811882841002189050905060c05260c05160116060516020525f5260405f20600481019050548082038281116128e1579050905060e05260805160e05160116060516020525f5260405f20600381019050548082028115838383041417156128e15790509050670de0b6b3a7640000810281670de0b6b3a76400008204186128e157905060a05180156128e157808204905090508082018281106128e157905090506080525b60136060516020525f5260405f20806040516020525f5260405f2090505460c05260016040516020525f5260405f205460805160c0518082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a76400008104905060e05260146040516020525f5260405f20806060516020525f5260405f2090505460801c60e0518082018281106128e15790509050610100526020610100f3611c2d565b63180692d08118611baf57346128e157600f547affffffffffffffffffffffffffffffffffffffffffffffffffffff8116905060405260206040f35b6354fd4d508118611c2d57346128e15760208060805260066040527f76362e312e30000000000000000000000000000000000000000000000000000060605260408160800181518152602082015160208201528051806020830101601f825f03163682375050601f19601f8251602001011690509050810190506080f35b5f5ffd5b60206129855f395f514614611cb9577f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60605260206129656080397f71916ddf3efd1d13d14899519c9cd193fa3f9be07ea852717d2f225de1eb246660a0524660c0523060e05260206129a56101003960c06040526040805160208201209050815250611cc2565b60206129c58239505b565b601a546060526060516c01431e0fae6d7217ca9fffffff81116128e157602301546080526060516c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015460a052600f5460c05260c05160d81c60e052600e546101005260c0517affffffffffffffffffffffffffffffffffffffffffffffffffffff811690506101205261012051610140526101005115611d6857604036610120375b60805160e05110611e265763b26b238e610180526020610180600461019c5f73d533a949740bb3306d119cc777fa900ba034cd525af1611daa573d5f5f3e3d5ffd5b60203d106128e157610180516101605261010051611e0957632c4e722e610180526020610180600461019c73d533a949740bb3306d119cc777fa900ba034cd525afa611df8573d5f5f3e3d5ffd5b60203d106128e15761018051610140525b6101605160d81b610140518082018281106128e15790509050600f555b6080514211156120fa576016546101605263615e523761018052306101a052732f50d538606fa9edd2b11e2446beb18c9d5846bb3b156128e1575f610180602461019c5f732f50d538606fa9edd2b11e2446beb18c9d5846bb5af1611e8d573d5f5f3e3d5ffd5b6080516101805260805162093a8081018181106128e157905062093a808104905062093a8081028162093a808204186128e157905042808281188284100218905090506101a0525f6101f4905b806101c0526101a051610180518082038281116128e157905090506101e05263d3078c9461022052306102405261018051610260526020610220604461023c732f50d538606fa9edd2b11e2446beb18c9d5846bb5afa611f3c573d5f5f3e3d5ffd5b60203d106128e157610220516102005261016051156120b0576101805160e0511015611f68575f611f71565b6101a05160e051105b611fd35760a05161012051610200518082028115838383041417156128e157905090506101e0518082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a0526120b0565b60a05161012051610200518082028115838383041417156128e1579050905060e051610180518082038281116128e157905090508082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a052610140516101205260a05161012051610200518082028115838383041417156128e157905090506101a05160e0518082038281116128e157905090508082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a0525b426101a051186120bf576120f7565b6101a051610180526101a05162093a8081018181106128e157905042808281188284100218905090506101a052600101818118611eda575b50505b6060516001810180600f0b81186128e1579050606052606051601a55426060516c01431e0fae6d7217ca9fffffff81116128e1576023015560a0516060516c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015560156040516020525f5260405f20546101605260196040516020525f5260405f2080546101605160a05160176040516020525f5260405f20548082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a7640000810490508082018281106128e1579050905081555060a05160176040516020525f5260405f20554260186040516020525f5260405f2055565b5f60c05260a05160e052604051156122545760016040516020525f5260405f205460c05260805161222a575f61222f565b60a051155b156122545760126040516020525f5260405f205460e05260e0516122545760405160e0525b601054610100525f6008905b8061012052610100516101205118612277576125bf565b61012051600781116128e157601b0154610140526011610140516020525f5260405f206005810190505461016052426011610140516020525f5260405f20600281019050548082811882841002189050905061018052610180516011610140516020525f5260405f20600481019050548082038281116128e157905090506101a0526101a0511561230c57606051151561230e565b5f5b156123ba57610180516011610140516020525f5260405f2060048101905055610160516101a0516011610140516020525f5260405f20600381019050548082028115838383041417156128e15790509050670de0b6b3a7640000810281670de0b6b3a76400008204186128e157905060605180156128e157808204905090508082018281106128e1579050905061016052610160516011610140516020525f5260405f20600581019050555b604051156125b4576013610140516020525f5260405f20806040516020525f5260405f209050546101c0525f6101e052610160516101c051101561245a57610160516013610140516020525f5260405f20806040516020525f5260405f2090505560c051610160516101c0518082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a7640000810490506101e0525b60146040516020525f5260405f2080610140516020525f5260405f20905054610200526102005160801c6101e0518082018281106128e157905090506102205261022051156125b457610200516fffffffffffffffffffffffffffffffff811690506102405260805161250d576101e051156125b457610240516102205160801b8082018281106128e1579050905060146040516020525f5260405f2080610140516020525f5260405f209050556125b4565b6101405163a9059cbb6102605260e05161028052610220516102a0526020610260604461027c5f855af1612543573d5f5f3e3d5ffd5b3d61255a57803b156128e15760016102c052612573565b60203d106128e157610260518060011c6128e1576102c0525b6102c0905051156128e15761024051610220518082018281106128e1579050905060146040516020525f5260405f2080610140516020525f5260405f209050555b600101818118612260575b5050565b63bbf7408a60c05260405160e052602060c0602460dc738e0c00ed546602fd9927df742bbabf726d5b0d165afa6125fc573d5f5f3e3d5ffd5b60203d106128e15760c05160a0526318160ddd60e052602060e0600460fc735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa61263d573d5f5f3e3d5ffd5b60203d106128e15760e05160c052606051602881028160288204186128e157905060648104905060e05260c051156126c45760e05160805160a0518082028115838383041417156128e1579050905060c05180156128e15780820490509050603c810281603c8204186128e15790506064810490508082018281106128e1579050905060e0525b60605160e0518082811882841002189050905060e05260156040516020525f5260405f20546101005260e05160156040516020525f5260405f205560165460e0518082018281106128e15790509050610100518082038281116128e1579050905061012052610120516016556040517f7ecd84343f76a23d2227290e0288da3251b045541698e575a5515af4f04197a3606051610140526080516101605260e05161018052610120516101a0526080610140a2565b6102e051604052612788611cc4565b61030051604052612797611cc4565b61032051156128a8576002546103405260105415156103605261036051156127d5576102e051604052610340516060526040366080376127d56121f9565b60016102e0516020525f5260405f2054610320518082038281116128e15790509050610380526103805160016102e0516020525f5260405f20556102e051604052610380516060526103405160805261282c6125c3565b61036051156128515761030051604052610340516060526040366080376128516121f9565b6001610300516020525f5260405f2054610320518082018281106128e1579050905061038052610380516001610300516020525f5260405f20556103005160405261038051606052610340516080526128a86125c3565b610300516102e0517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef61032051610340526020610340a3565b5f80fd047203f31c2d02c91c2d1c2d1c2d08ec1493082f07f01c2d0b6c0c441c2d0fe81b7311ec1c2d13bc1c2d04d3145a129d07941c2d1c2d0f061c2d0131072a1c2d1c2d1c2d1c2d1c2d185e0bee06ea15491c2d0b1c1c2d1c2d1c2d158a1c2d1c2d1c2d00b7088e001819b505150d6319441c2d070a084f0f861c2d0afc023f1c2d841929658118801880a16576797065728300030a0016000000000000000000000000b73527615c25ac2d226db2581525f69968926caf
5f3560e01c6002603f821660011b6128e501601e395f51565b63bfa0b133811861003657346128e15760206129a560403960206040f35b63095ea7b38118611c2d576044361034176128e1576004358060a01c6128e1576040526024356003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560243560605260206060a3600160605260206060f3611c2d565b6370a0823181186100f2576024361034176128e1576004358060a01c6128e15760405260016040516020525f5260405f205460605260206060f35b6301ddabf18118611c2d576024361034176128e1576004358060a01c6128e15760405260126040516020525f5260405f205460605260206060f3611c2d565b6318160ddd811861014d57346128e15760025460405260206040f35b6323b872dd8118611c2d576064361034176128e1576004358060a01c6128e1576103a0526024358060a01c6128e1576103c0525f546002146128e15760025f5560036103a0516020525f5260405f2080336020525f5260405f209050546103e0527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6103e0511461020b576103e0516044358082038281116128e1579050905060036103a0516020525f5260405f2080336020525f5260405f209050555b6103a0516102e0526103c051610300526044356103205261022a612779565b600161040052602061040060035f55f3611c2d565b63dd62ed3e8118610297576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260036040516020525f5260405f20806060516020525f5260405f2090505460805260206080f35b6384e9bd7e8118611c2d576024361034176128e1576004358060a01c6128e1576102e0525f61030052610f3a56611c2d565b6306fdde03811861034457346128e157602080604052806040016020600454015f81601f0160051c600381116128e157801561031857905b80600401548160051b850152600101818118610301575b5050508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f35b63331345838118611c2d576024361034176128e1576004358060a01c6128e1576102805261028051604052610377611cc4565b6019610280516020525f5260405f2054638b752bb06102a052610280516102c052306102e05260206102a060446102bc73d061d61a4d941c39e5453435b6345dc261c2fce05afa6103ca573d5f5f3e3d5ffd5b60203d106128e1576102a0518082038281116128e15790509050610300526020610300f3611c2d565b6395d89b418118611c2d57346128e157602080604052806040016020600754015f81601f0160051c600381116128e157801561044257905b80600701548160051b85015260010181811861042b575b5050508051806020830101601f825f03163682375050601f19601f825160200101169050810190506040f3611c2d565b637ecebe0081146003361116156104b3576024361034176128e1576004358060a01c6128e157604052600a6040516020525f5260405f205460605260206060f35b639c868ac08118611c2d57346128e157600e5460405260206040f3611c2d565b63c45a015581186104ef57346128e157600b5460405260206040f35b633644e5158118611c2d57346128e157602061050c610120611c31565b610120f3611c2d565b63481c6a75811861053157346128e157600c5460405260206040f35b6396c551758118611c2d576024361034176128e1576004358060a01c6128e157610280526018610280516020525f5260405f20546102a05263da020a1861032052610280516103405263010ae7576102e052610280516103005260206102e060246102fc735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa6105b8573d5f5f3e3d5ffd5b60203d106128e1576102e051610360526020610320604461033c735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa6105f5573d5f5f3e3d5ffd5b60203d106128e157610320516102c0526001610280516020525f5260405f20546102e0526370a082316103005261028051610320526020610300602461031c735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa610657573d5f5f3e3d5ffd5b60203d106128e1576103005161066e576001610678565b6102a0516102c051115b156128e1576102e051602881028160288204186128e15790506064810490506015610280516020525f5260405f205411156128e157610280516040526106bc611cc4565b610280516040526001610280516020525f5260405f20546060526002546080526106e46125c3565b00611c2d565b6382c630668118611c2d57346128e157600d5460405260206040f3611c2d565b63963c94b98118611c2d57346128e15760105460405260206040f3611c2d565b6348e9c65e8118611c2d576024361034176128e1576004358060a01c6128e15760405260116040516020525f5260405f2080546060526001810154608052600281015460a052600381015460c052600481015460e0526005810154610100525060c06060f3611c2d565b63f05cc0588118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260136040516020525f5260405f20806060516020525f5260405f2090505460805260206080f3611c2d565b6313ecb1ca8118611c2d576024361034176128e1576004358060a01c6128e15760405260156040516020525f5260405f205460605260206060f3611c2d565b6317e280898118611c2d57346128e15760165460405260206040f3611c2d565b63de263bfa8118611c2d576024361034176128e1576004358060a01c6128e15760405260176040516020525f5260405f205460605260206060f3611c2d565b639bd324f281186108c9576024361034176128e1576004358060a01c6128e15760405260186040516020525f5260405f205460605260206060f35b63e6f1daf28118611c2d57346128e157336102e0525f61030052610f3a56611c2d565b63094007078118610927576024361034176128e1576004358060a01c6128e15760405260196040516020525f5260405f205460605260206060f35b6383df67478118611c2d576064361034176128e1576024358060a01c6128e1576102e0526044358060011c6128e157610300525b5f546002146128e15760025f556102e051156128e1576102e051604052610980611cc4565b60043515610af2576010541515610320526002546103405261032051156109c2576102e05160405261034051606052610300516080525f60a0526109c26121f9565b610340516004358082018281106128e157905090506103405260016102e0516020525f5260405f20546004358082018281106128e15790509050610360526103605160016102e0516020525f5260405f2055610340516002556102e0516040526103605160605261034051608052610a386125c3565b600d546323b872dd61038052336103a052306103c0526004356103e0526020610380606461039c5f855af1610a6f573d5f5f3e3d5ffd5b60203d106128e157610380518060011c6128e1576104005261040050506102e0517fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c600435610380526020610380a26102e0515f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600435610380526020610380a35b60035f5500611c2d565b63ef78d4fd8118611c2d57346128e157601a5460405260206040f3611c2d565b6354c49fe98118610b49576024361034176128e157600435600781116128e157601b015460405260206040f35b63be5d1be98118611c2d57346128e157600f5460d81c60405260206040f3611c2d565b637598108c8118610ba5576024361034176128e1576004356c01431e0fae6d7217ca9fffffff81116128e1576023015460405260206040f35b63fec8ee0c8118611c2d576024361034176128e1576004356c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015460405260206040f3611c2d565b63b6b55f258118610c12576024361034176128e157336102e0525f6103005261095b565b636e553f658118611c2d576044361034176128e1576024358060a01c6128e1576102e0525f6103005261095b56611c2d565b632e1a7d4d8118610c63576024361034176128e1575f6102e052610d88565b63e8de0d4d8118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605233600c548118610ca5576001610ce8565b600b5463f851a44060e052602060e0600460fc845afa610cc7573d5f5f3e3d5ffd5b60203d106128e15760e0518060a01c6128e157610120526101209050518118155b9050156128e157606051156128e1576010546080526007608051116128e15760116040516020525f5260405f20600181019050546128e15760605160116040516020525f5260405f2060018101905055604051608051600781116128e157601b0155608051600181018181106128e157905060105500611c2d565b6338d074368118611c2d576044361034176128e1576024358060011c6128e1576102e0525b5f546002146128e15760025f5533604052610da1611cc4565b60043515610e9d57601054151561030052600254610320526103005115610de05733604052610320516060526102e0516080525f60a052610de06121f9565b610320516004358082038281116128e15790509050610320526001336020525f5260405f20546004358082038281116128e1579050905061034052610340516001336020525f5260405f205561032051600255336040526103405160605261032051608052610e4d6125c3565b600d5463a9059cbb6103605233610380526004356103a0526020610360604461037c5f855af1610e7f573d5f5f3e3d5ffd5b60203d106128e157610360518060011c6128e1576103c0526103c050505b337f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364600435610300526020610300a25f337fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600435610300526020610300a360035f5500611c2d565b639faceb1b8118611c2d576044361034176128e1576004358060a01c6128e1576102e0526024358060a01c6128e157610300525b5f546002146128e15760025f556103005115610f5b57336102e051186128e1575b6102e05160405260025460605260016080526103005160a052610f7c6121f9565b60035f5500611c2d565b63a9059cbb8118611c2d576044361034176128e1576004358060a01c6128e1576103a0525f546002146128e15760025f55336102e0526103a0516103005260243561032052610fd3612779565b60016103c05260206103c060035f55f3611c2d565b63d505accf8118611c2d5760e4361034176128e1576004358060a01c6128e157610120526024358060a01c6128e157610140526084358060081c6128e1576101605261012051156128e15760643542116128e157600a610120516020525f5260405f2054610180525f60026101c0527f19010000000000000000000000000000000000000000000000000000000000006101e0526101c08051602082018361032001815181525050808301925050506110a2610200611c31565b610200518161032001526020810190507f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c961024052610120516102605261014051610280526044356102a052610180516102c0526064356102e05260c061022052610220805160208201209050816103200152602081019050806103005261030090508051602082012090506101a052610120515f610240526101a0516101c052610160516101e052604060a461020037602061024060806101c060015afa5061024051186128e1576044356003610120516020525f5260405f2080610140516020525f5260405f2090505560016101805101600a610120516020525f5260405f205561014051610120517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9256044356101c05260206101c0a360016101c05260206101c0f3611c2d565b63395093518118611c2d576044361034176128e1576004358060a01c6128e1576040526003336020525f5260405f20806040516020525f5260405f209050546024358082018281106128e157905090506060526060516003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560605160805260206080a3600160805260206080f3611c2d565b63a457c2d7811861134a576044361034176128e1576004358060a01c6128e1576040526003336020525f5260405f20806040516020525f5260405f209050546024358082038281116128e157905090506060526060516003336020525f5260405f20806040516020525f5260405f20905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560605160805260206080a3600160805260206080f35b6390b229978118611c2d576024361034176128e1576004358060011c6128e157604052600b5463f851a440606052602060606004607c845afa61138f573d5f5f3e3d5ffd5b60203d106128e1576060518060a01c6128e15760a05260a090505133186128e157604051600e5500611c2d565b634b8200938118611c2d576024361034176128e1576004358060a01c6128e15761028052336102805181186113f257600161140b565b73d061d61a4d941c39e5453435b6345dc261c2fce08118155b9050156128e15761028051604052611421611cc4565b610280516040526001610280516020525f5260405f20546060526002546080526114496125c3565b60016102a05260206102a0f3611c2d565b63bdf981168118611c2d576024361034176128e1576004358060a01c6128e1576040526040516012336020525f5260405f205500611c2d565b63aace1d488118611c2d576024361034176128e1576004358060a01c6128e15760405233600c5481186114c757600161150a565b600b5463f851a44060c052602060c0600460dc845afa6114e9573d5f5f3e3d5ffd5b60203d106128e15760c0518060a01c6128e157610100526101009050518118155b9050156128e157604051600c557fe83c80a0349150991cb09b4c940149ac4c37cb03673b6c0c669b4da27865c28b60405160605260206060a100611c2d565b6393f7aa67811861156b576044361034176128e15762093a80610300526115a7565b63313ce5678118611c2d57346128e157601260405260206040f3611c2d565b6333b50aed8118611826576064361034176128e157604435610300525b6004358060a01c6128e1576102e0525f546002146128e15760025f5560116102e0516020525f5260405f206001810190505433186128e1575f6040526002546060526040366080376115f76121f9565b6102e0516370a082316103405230610360526020610340602461035c845afa611622573d5f5f3e3d5ffd5b60203d106128e157610340905051610320526102e0516323b872dd61034052336103605230610380526024356103a0526020610340606461035c5f855af161166c573d5f5f3e3d5ffd5b3d61168357803b156128e15760016103c05261169c565b60203d106128e157610340518060011c6128e1576103c0525b6103c0905051156128e1576102e0516370a082316103405230610360526020610340602461035c845afa6116d2573d5f5f3e3d5ffd5b60203d106128e157610340905051610320518082038281116128e157905090506103205260116102e0516020525f5260405f206002810190505461034052610300516103205111156128e157610340514210156117b45761034051428082038281116128e15790509050610360526103605160116102e0516020525f5260405f20600381019050548082028115838383041417156128e157905090506103805261032051610380518082018281106128e157905090506103005180156128e1578082049050905060116102e0516020525f5260405f20600381019050556117e0565b610320516103005180156128e1578082049050905060116102e0516020525f5260405f20600381019050555b4260116102e0516020525f5260405f206004810190505542610300518082018281106128e1579050905060116102e0516020525f5260405f206002810190505560035f55005b63d31f3f6d8118611c2d57346128e157601a546c01431e0fae6d7217ca9fffffff81116128e1576023015460405260206040f3611c2d565b63058a3a248118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260116040516020525f5260405f20600181019050546080523360805181186118b857600161190f565b600b5463f851a440610100526020610100600461011c845afa6118dd573d5f5f3e3d5ffd5b60203d106128e157610100518060a01c6128e15761014052610140905051811861190857600161190f565b600c548118155b9050156128e157608051156128e157606051156128e15760605160116040516020525f5260405f206001810190505500611c2d565b63e77e74378118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260146040516020525f5260405f20806060516020525f5260405f209050546fffffffffffffffffffffffffffffffff8116905060805260206080f3611c2d565b6333fd6f748118611c2d576044361034176128e1576004358060a01c6128e1576040526024358060a01c6128e15760605260116060516020525f5260405f206005810190505460805260025460a05260a05115611aca574260116060516020525f5260405f20600281019050548082811882841002189050905060c05260c05160116060516020525f5260405f20600481019050548082038281116128e1579050905060e05260805160e05160116060516020525f5260405f20600381019050548082028115838383041417156128e15790509050670de0b6b3a7640000810281670de0b6b3a76400008204186128e157905060a05180156128e157808204905090508082018281106128e157905090506080525b60136060516020525f5260405f20806040516020525f5260405f2090505460c05260016040516020525f5260405f205460805160c0518082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a76400008104905060e05260146040516020525f5260405f20806060516020525f5260405f2090505460801c60e0518082018281106128e15790509050610100526020610100f3611c2d565b63180692d08118611baf57346128e157600f547affffffffffffffffffffffffffffffffffffffffffffffffffffff8116905060405260206040f35b6354fd4d508118611c2d57346128e15760208060805260066040527f76362e312e30000000000000000000000000000000000000000000000000000060605260408160800181518152602082015160208201528051806020830101601f825f03163682375050601f19601f8251602001011690509050810190506080f35b5f5ffd5b60206129855f395f514614611cb9577f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60605260206129656080397f71916ddf3efd1d13d14899519c9cd193fa3f9be07ea852717d2f225de1eb246660a0524660c0523060e05260206129a56101003960c06040526040805160208201209050815250611cc2565b60206129c58239505b565b601a546060526060516c01431e0fae6d7217ca9fffffff81116128e157602301546080526060516c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015460a052600f5460c05260c05160d81c60e052600e546101005260c0517affffffffffffffffffffffffffffffffffffffffffffffffffffff811690506101205261012051610140526101005115611d6857604036610120375b60805160e05110611e265763b26b238e610180526020610180600461019c5f73d533a949740bb3306d119cc777fa900ba034cd525af1611daa573d5f5f3e3d5ffd5b60203d106128e157610180516101605261010051611e0957632c4e722e610180526020610180600461019c73d533a949740bb3306d119cc777fa900ba034cd525afa611df8573d5f5f3e3d5ffd5b60203d106128e15761018051610140525b6101605160d81b610140518082018281106128e15790509050600f555b6080514211156120fa576016546101605263615e523761018052306101a052732f50d538606fa9edd2b11e2446beb18c9d5846bb3b156128e1575f610180602461019c5f732f50d538606fa9edd2b11e2446beb18c9d5846bb5af1611e8d573d5f5f3e3d5ffd5b6080516101805260805162093a8081018181106128e157905062093a808104905062093a8081028162093a808204186128e157905042808281188284100218905090506101a0525f6101f4905b806101c0526101a051610180518082038281116128e157905090506101e05263d3078c9461022052306102405261018051610260526020610220604461023c732f50d538606fa9edd2b11e2446beb18c9d5846bb5afa611f3c573d5f5f3e3d5ffd5b60203d106128e157610220516102005261016051156120b0576101805160e0511015611f68575f611f71565b6101a05160e051105b611fd35760a05161012051610200518082028115838383041417156128e157905090506101e0518082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a0526120b0565b60a05161012051610200518082028115838383041417156128e1579050905060e051610180518082038281116128e157905090508082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a052610140516101205260a05161012051610200518082028115838383041417156128e157905090506101a05160e0518082038281116128e157905090508082028115838383041417156128e157905090506101605180156128e157808204905090508082018281106128e1579050905060a0525b426101a051186120bf576120f7565b6101a051610180526101a05162093a8081018181106128e157905042808281188284100218905090506101a052600101818118611eda575b50505b6060516001810180600f0b81186128e1579050606052606051601a55426060516c01431e0fae6d7217ca9fffffff81116128e1576023015560a0516060516c01431e0fae6d7217ca9fffffff81116128e1576c01431e0fae6d7217caa0000023015560156040516020525f5260405f20546101605260196040516020525f5260405f2080546101605160a05160176040516020525f5260405f20548082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a7640000810490508082018281106128e1579050905081555060a05160176040516020525f5260405f20554260186040516020525f5260405f2055565b5f60c05260a05160e052604051156122545760016040516020525f5260405f205460c05260805161222a575f61222f565b60a051155b156122545760126040516020525f5260405f205460e05260e0516122545760405160e0525b601054610100525f6008905b8061012052610100516101205118612277576125bf565b61012051600781116128e157601b0154610140526011610140516020525f5260405f206005810190505461016052426011610140516020525f5260405f20600281019050548082811882841002189050905061018052610180516011610140516020525f5260405f20600481019050548082038281116128e157905090506101a0526101a0511561230c57606051151561230e565b5f5b156123ba57610180516011610140516020525f5260405f2060048101905055610160516101a0516011610140516020525f5260405f20600381019050548082028115838383041417156128e15790509050670de0b6b3a7640000810281670de0b6b3a76400008204186128e157905060605180156128e157808204905090508082018281106128e1579050905061016052610160516011610140516020525f5260405f20600581019050555b604051156125b4576013610140516020525f5260405f20806040516020525f5260405f209050546101c0525f6101e052610160516101c051101561245a57610160516013610140516020525f5260405f20806040516020525f5260405f2090505560c051610160516101c0518082038281116128e157905090508082028115838383041417156128e15790509050670de0b6b3a7640000810490506101e0525b60146040516020525f5260405f2080610140516020525f5260405f20905054610200526102005160801c6101e0518082018281106128e157905090506102205261022051156125b457610200516fffffffffffffffffffffffffffffffff811690506102405260805161250d576101e051156125b457610240516102205160801b8082018281106128e1579050905060146040516020525f5260405f2080610140516020525f5260405f209050556125b4565b6101405163a9059cbb6102605260e05161028052610220516102a0526020610260604461027c5f855af1612543573d5f5f3e3d5ffd5b3d61255a57803b156128e15760016102c052612573565b60203d106128e157610260518060011c6128e1576102c0525b6102c0905051156128e15761024051610220518082018281106128e1579050905060146040516020525f5260405f2080610140516020525f5260405f209050555b600101818118612260575b5050565b63bbf7408a60c05260405160e052602060c0602460dc738e0c00ed546602fd9927df742bbabf726d5b0d165afa6125fc573d5f5f3e3d5ffd5b60203d106128e15760c05160a0526318160ddd60e052602060e0600460fc735f3b5dfeb7b28cdbd7faba78963ee202a494e2a25afa61263d573d5f5f3e3d5ffd5b60203d106128e15760e05160c052606051602881028160288204186128e157905060648104905060e05260c051156126c45760e05160805160a0518082028115838383041417156128e1579050905060c05180156128e15780820490509050603c810281603c8204186128e15790506064810490508082018281106128e1579050905060e0525b60605160e0518082811882841002189050905060e05260156040516020525f5260405f20546101005260e05160156040516020525f5260405f205560165460e0518082018281106128e15790509050610100518082038281116128e1579050905061012052610120516016556040517f7ecd84343f76a23d2227290e0288da3251b045541698e575a5515af4f04197a3606051610140526080516101605260e05161018052610120516101a0526080610140a2565b6102e051604052612788611cc4565b61030051604052612797611cc4565b61032051156128a8576002546103405260105415156103605261036051156127d5576102e051604052610340516060526040366080376127d56121f9565b60016102e0516020525f5260405f2054610320518082038281116128e15790509050610380526103805160016102e0516020525f5260405f20556102e051604052610380516060526103405160805261282c6125c3565b61036051156128515761030051604052610340516060526040366080376128516121f9565b6001610300516020525f5260405f2054610320518082018281106128e1579050905061038052610380516001610300516020525f5260405f20556103005160405261038051606052610340516080526128a86125c3565b610300516102e0517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef61032051610340526020610340a3565b5f80fd047203f31c2d02c91c2d1c2d1c2d08ec1493082f07f01c2d0b6c0c441c2d0fe81b7311ec1c2d13bc1c2d04d3145a129d07941c2d1c2d0f061c2d0131072a1c2d1c2d1c2d1c2d1c2d185e0bee06ea15491c2d0b1c1c2d1c2d1c2d158a1c2d1c2d1c2d00b7088e001819b505150d6319441c2d070a084f0f861c2d0afc023f1c2da461a4569c71c176f77505bf45a2c96b11c5b79e5912ac8f5c2c71700f38711b00000000000000000000000000000000000000000000000000000000000000016d7f1d398884e62f329829290c34336d1de855d7f3f8d229ec8c47edbe81be51dd3fe948675c2b24ab368b2b8c1c06d38968f3f9f3d4371424c3032e86826ab1
# pragma version 0.3.10 # pragma optimize gas # pragma evm-version shanghai """ @title LiquidityGaugeV6 @author Curve.Fi @license Copyright (c) Curve.Fi, 2020-2023 - all rights reserved @notice Implementation contract for use with Curve Factory @dev Differs from v5.0.0 in that it uses create_from_blueprint to deploy Gauges """ from vyper.interfaces import ERC20 implements: ERC20 interface CRV20: def future_epoch_time_write() -> uint256: nonpayable def rate() -> uint256: view interface Controller: def checkpoint_gauge(addr: address): nonpayable def gauge_relative_weight(addr: address, time: uint256) -> uint256: view interface ERC20Extended: def symbol() -> String[32]: view interface ERC1271: def isValidSignature(_hash: bytes32, _signature: Bytes[65]) -> bytes32: view interface Factory: def admin() -> address: view interface Minter: def minted(user: address, gauge: address) -> uint256: view interface VotingEscrow: def user_point_epoch(addr: address) -> uint256: view def user_point_history__ts(addr: address, epoch: uint256) -> uint256: view interface VotingEscrowBoost: def adjusted_balance_of(_account: address) -> uint256: view event Deposit: provider: indexed(address) value: uint256 event Withdraw: provider: indexed(address) value: uint256 event UpdateLiquidityLimit: user: indexed(address) original_balance: uint256 original_supply: uint256 working_balance: uint256 working_supply: uint256 event CommitOwnership: admin: address event ApplyOwnership: admin: address event SetGaugeManager: _gauge_manager: address event Transfer: _from: indexed(address) _to: indexed(address) _value: uint256 event Approval: _owner: indexed(address) _spender: indexed(address) _value: uint256 struct Reward: token: address distributor: address period_finish: uint256 rate: uint256 last_update: uint256 integral: uint256 MAX_REWARDS: constant(uint256) = 8 TOKENLESS_PRODUCTION: constant(uint256) = 40 WEEK: constant(uint256) = 604800 VERSION: constant(String[8]) = "v6.1.0" # <- updated from v6.0.0 (makes rewards semi-permissionless) EIP712_TYPEHASH: constant(bytes32) = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)") EIP2612_TYPEHASH: constant(bytes32) = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)") VERSION_HASH: constant(bytes32) = keccak256(VERSION) NAME_HASH: immutable(bytes32) CACHED_CHAIN_ID: immutable(uint256) salt: public(immutable(bytes32)) CACHED_DOMAIN_SEPARATOR: immutable(bytes32) CRV: constant(address) = 0xD533a949740bb3306d119CC777fa900bA034cd52 GAUGE_CONTROLLER: constant(address) = 0x2F50D538606Fa9EDD2B11E2446BEb18C9D5846bB MINTER: constant(address) = 0xd061D61a4d941c39E5453435B6345Dc261C2fcE0 VEBOOST_PROXY: constant(address) = 0x8E0c00ed546602fD9927DF742bbAbF726D5B0d16 VOTING_ESCROW: constant(address) = 0x5f3b5DfEb7B28CDbD7FAba78963EE202a494e2A2 # ERC20 balanceOf: public(HashMap[address, uint256]) totalSupply: public(uint256) allowance: public(HashMap[address, HashMap[address, uint256]]) name: public(String[64]) symbol: public(String[40]) # ERC2612 nonces: public(HashMap[address, uint256]) # Gauge factory: public(address) manager: public(address) lp_token: public(address) is_killed: public(bool) # [future_epoch_time uint40][inflation_rate uint216] inflation_params: uint256 # For tracking external rewards reward_count: public(uint256) reward_data: public(HashMap[address, Reward]) # claimant -> default reward receiver rewards_receiver: public(HashMap[address, address]) # reward token -> claiming address -> integral reward_integral_for: public(HashMap[address, HashMap[address, uint256]]) # user -> [uint128 claimable amount][uint128 claimed amount] claim_data: HashMap[address, HashMap[address, uint256]] working_balances: public(HashMap[address, uint256]) working_supply: public(uint256) # 1e18 * ∫(rate(t) / totalSupply(t) dt) from (last_action) till checkpoint integrate_inv_supply_of: public(HashMap[address, uint256]) integrate_checkpoint_of: public(HashMap[address, uint256]) # ∫(balance * rate(t) / totalSupply(t) dt) from 0 till checkpoint # Units: rate * t = already number of coins per address to issue integrate_fraction: public(HashMap[address, uint256]) # The goal is to be able to calculate ∫(rate * balance / totalSupply dt) from 0 till checkpoint # All values are kept in units of being multiplied by 1e18 period: public(int128) # array of reward tokens reward_tokens: public(address[MAX_REWARDS]) period_timestamp: public(uint256[100000000000000000000000000000]) # 1e18 * ∫(rate(t) / totalSupply(t) dt) from 0 till checkpoint integrate_inv_supply: public(uint256[100000000000000000000000000000]) # bump epoch when rate() changes @external def __init__(_lp_token: address): """ @notice Contract constructor @param _lp_token Liquidity Pool contract address """ self.lp_token = _lp_token self.factory = msg.sender self.manager = tx.origin symbol: String[32] = ERC20Extended(_lp_token).symbol() name: String[64] = concat("Curve.fi ", symbol, " Gauge Deposit") self.name = name self.symbol = concat(symbol, "-gauge") self.period_timestamp[0] = block.timestamp self.inflation_params = ( (CRV20(CRV).future_epoch_time_write() << 216) + CRV20(CRV).rate() ) NAME_HASH = keccak256(name) salt = block.prevhash CACHED_CHAIN_ID = chain.id CACHED_DOMAIN_SEPARATOR = keccak256( _abi_encode( EIP712_TYPEHASH, NAME_HASH, VERSION_HASH, chain.id, self, salt, ) ) # Internal Functions @view @internal def _domain_separator() -> bytes32: if chain.id != CACHED_CHAIN_ID: return keccak256( _abi_encode( EIP712_TYPEHASH, NAME_HASH, VERSION_HASH, chain.id, self, salt, ) ) return CACHED_DOMAIN_SEPARATOR @internal def _checkpoint(addr: address): """ @notice Checkpoint for a user @dev Updates the CRV emissions a user is entitled to receive @param addr User address """ _period: int128 = self.period _period_time: uint256 = self.period_timestamp[_period] _integrate_inv_supply: uint256 = self.integrate_inv_supply[_period] inflation_params: uint256 = self.inflation_params prev_future_epoch: uint256 = inflation_params >> 216 gauge_is_killed: bool = self.is_killed rate: uint256 = inflation_params % 2 ** 216 new_rate: uint256 = rate if gauge_is_killed: rate = 0 new_rate = 0 if prev_future_epoch >= _period_time: future_epoch_time_write: uint256 = CRV20(CRV).future_epoch_time_write() if not gauge_is_killed: new_rate = CRV20(CRV).rate() self.inflation_params = (future_epoch_time_write << 216) + new_rate # Update integral of 1/supply if block.timestamp > _period_time: _working_supply: uint256 = self.working_supply Controller(GAUGE_CONTROLLER).checkpoint_gauge(self) prev_week_time: uint256 = _period_time week_time: uint256 = min((_period_time + WEEK) / WEEK * WEEK, block.timestamp) for i in range(500): dt: uint256 = week_time - prev_week_time w: uint256 = Controller(GAUGE_CONTROLLER).gauge_relative_weight(self, prev_week_time) if _working_supply > 0: if prev_future_epoch >= prev_week_time and prev_future_epoch < week_time: # If we went across one or multiple epochs, apply the rate # of the first epoch until it ends, and then the rate of # the last epoch. # If more than one epoch is crossed - the gauge gets less, # but that'd meen it wasn't called for more than 1 year _integrate_inv_supply += rate * w * (prev_future_epoch - prev_week_time) / _working_supply rate = new_rate _integrate_inv_supply += rate * w * (week_time - prev_future_epoch) / _working_supply else: _integrate_inv_supply += rate * w * dt / _working_supply # On precisions of the calculation # rate ~= 10e18 # last_weight > 0.01 * 1e18 = 1e16 (if pool weight is 1%) # _working_supply ~= TVL * 1e18 ~= 1e26 ($100M for example) # The largest loss is at dt = 1 # Loss is 1e-9 - acceptable if week_time == block.timestamp: break prev_week_time = week_time week_time = min(week_time + WEEK, block.timestamp) _period += 1 self.period = _period self.period_timestamp[_period] = block.timestamp self.integrate_inv_supply[_period] = _integrate_inv_supply # Update user-specific integrals _working_balance: uint256 = self.working_balances[addr] self.integrate_fraction[addr] += _working_balance * (_integrate_inv_supply - self.integrate_inv_supply_of[addr]) / 10 ** 18 self.integrate_inv_supply_of[addr] = _integrate_inv_supply self.integrate_checkpoint_of[addr] = block.timestamp @internal def _checkpoint_rewards(_user: address, _total_supply: uint256, _claim: bool, _receiver: address): """ @notice Claim pending rewards and checkpoint rewards for a user """ user_balance: uint256 = 0 receiver: address = _receiver if _user != empty(address): user_balance = self.balanceOf[_user] if _claim and _receiver == empty(address): # if receiver is not explicitly declared, check if a default receiver is set receiver = self.rewards_receiver[_user] if receiver == empty(address): # if no default receiver is set, direct claims to the user receiver = _user reward_count: uint256 = self.reward_count for i in range(MAX_REWARDS): if i == reward_count: break token: address = self.reward_tokens[i] integral: uint256 = self.reward_data[token].integral last_update: uint256 = min(block.timestamp, self.reward_data[token].period_finish) duration: uint256 = last_update - self.reward_data[token].last_update if duration != 0 and _total_supply != 0: self.reward_data[token].last_update = last_update integral += duration * self.reward_data[token].rate * 10**18 / _total_supply self.reward_data[token].integral = integral if _user != empty(address): integral_for: uint256 = self.reward_integral_for[token][_user] new_claimable: uint256 = 0 if integral_for < integral: self.reward_integral_for[token][_user] = integral new_claimable = user_balance * (integral - integral_for) / 10**18 claim_data: uint256 = self.claim_data[_user][token] total_claimable: uint256 = (claim_data >> 128) + new_claimable if total_claimable > 0: total_claimed: uint256 = claim_data % 2**128 if _claim: assert ERC20(token).transfer(receiver, total_claimable, default_return_value=True) self.claim_data[_user][token] = total_claimed + total_claimable elif new_claimable > 0: self.claim_data[_user][token] = total_claimed + (total_claimable << 128) @internal def _update_liquidity_limit(addr: address, l: uint256, L: uint256): """ @notice Calculate limits which depend on the amount of CRV token per-user. Effectively it calculates working balances to apply amplification of CRV production by CRV @param addr User address @param l User's amount of liquidity (LP tokens) @param L Total amount of liquidity (LP tokens) """ # To be called after totalSupply is updated voting_balance: uint256 = VotingEscrowBoost(VEBOOST_PROXY).adjusted_balance_of(addr) voting_total: uint256 = ERC20(VOTING_ESCROW).totalSupply() lim: uint256 = l * TOKENLESS_PRODUCTION / 100 if voting_total > 0: lim += L * voting_balance / voting_total * (100 - TOKENLESS_PRODUCTION) / 100 lim = min(l, lim) old_bal: uint256 = self.working_balances[addr] self.working_balances[addr] = lim _working_supply: uint256 = self.working_supply + lim - old_bal self.working_supply = _working_supply log UpdateLiquidityLimit(addr, l, L, lim, _working_supply) @internal def _transfer(_from: address, _to: address, _value: uint256): """ @notice Transfer tokens as well as checkpoint users """ self._checkpoint(_from) self._checkpoint(_to) if _value != 0: total_supply: uint256 = self.totalSupply is_rewards: bool = self.reward_count != 0 if is_rewards: self._checkpoint_rewards(_from, total_supply, False, empty(address)) new_balance: uint256 = self.balanceOf[_from] - _value self.balanceOf[_from] = new_balance self._update_liquidity_limit(_from, new_balance, total_supply) if is_rewards: self._checkpoint_rewards(_to, total_supply, False, empty(address)) new_balance = self.balanceOf[_to] + _value self.balanceOf[_to] = new_balance self._update_liquidity_limit(_to, new_balance, total_supply) log Transfer(_from, _to, _value) # External User Facing Functions @external @nonreentrant('lock') def deposit(_value: uint256, _addr: address = msg.sender, _claim_rewards: bool = False): """ @notice Deposit `_value` LP tokens @dev Depositting also claims pending reward tokens @param _value Number of tokens to deposit @param _addr Address to deposit for """ assert _addr != empty(address) # dev: cannot deposit for zero address self._checkpoint(_addr) if _value != 0: is_rewards: bool = self.reward_count != 0 total_supply: uint256 = self.totalSupply if is_rewards: self._checkpoint_rewards(_addr, total_supply, _claim_rewards, empty(address)) total_supply += _value new_balance: uint256 = self.balanceOf[_addr] + _value self.balanceOf[_addr] = new_balance self.totalSupply = total_supply self._update_liquidity_limit(_addr, new_balance, total_supply) ERC20(self.lp_token).transferFrom(msg.sender, self, _value) log Deposit(_addr, _value) log Transfer(empty(address), _addr, _value) @external @nonreentrant('lock') def withdraw(_value: uint256, _claim_rewards: bool = False): """ @notice Withdraw `_value` LP tokens @dev Withdrawing also claims pending reward tokens @param _value Number of tokens to withdraw """ self._checkpoint(msg.sender) if _value != 0: is_rewards: bool = self.reward_count != 0 total_supply: uint256 = self.totalSupply if is_rewards: self._checkpoint_rewards(msg.sender, total_supply, _claim_rewards, empty(address)) total_supply -= _value new_balance: uint256 = self.balanceOf[msg.sender] - _value self.balanceOf[msg.sender] = new_balance self.totalSupply = total_supply self._update_liquidity_limit(msg.sender, new_balance, total_supply) ERC20(self.lp_token).transfer(msg.sender, _value) log Withdraw(msg.sender, _value) log Transfer(msg.sender, empty(address), _value) @external @nonreentrant('lock') def claim_rewards(_addr: address = msg.sender, _receiver: address = empty(address)): """ @notice Claim available reward tokens for `_addr` @param _addr Address to claim for @param _receiver Address to transfer rewards to - if set to empty(address), uses the default reward receiver for the caller """ if _receiver != empty(address): assert _addr == msg.sender # dev: cannot redirect when claiming for another user self._checkpoint_rewards(_addr, self.totalSupply, True, _receiver) @external @nonreentrant('lock') def transferFrom(_from: address, _to :address, _value: uint256) -> bool: """ @notice Transfer tokens from one address to another. @dev Transferring claims pending reward tokens for the sender and receiver @param _from address The address which you want to send tokens from @param _to address The address which you want to transfer to @param _value uint256 the amount of tokens to be transferred """ _allowance: uint256 = self.allowance[_from][msg.sender] if _allowance != max_value(uint256): self.allowance[_from][msg.sender] = _allowance - _value self._transfer(_from, _to, _value) return True @external @nonreentrant('lock') def transfer(_to: address, _value: uint256) -> bool: """ @notice Transfer token for a specified address @dev Transferring claims pending reward tokens for the sender and receiver @param _to The address to transfer to. @param _value The amount to be transferred. """ self._transfer(msg.sender, _to, _value) return True @external def approve(_spender : address, _value : uint256) -> bool: """ @notice Approve the passed address to transfer the specified amount of tokens on behalf of msg.sender @dev Beware that changing an allowance via this method brings the risk that someone may use both the old and new allowance by unfortunate transaction ordering. This may be mitigated with the use of {incraseAllowance} and {decreaseAllowance}. https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 @param _spender The address which will transfer the funds @param _value The amount of tokens that may be transferred @return bool success """ self.allowance[msg.sender][_spender] = _value log Approval(msg.sender, _spender, _value) return True @external def permit( _owner: address, _spender: address, _value: uint256, _deadline: uint256, _v: uint8, _r: bytes32, _s: bytes32 ) -> bool: """ @notice Approves spender by owner's signature to expend owner's tokens. See https://eips.ethereum.org/EIPS/eip-2612. @dev Inspired by https://github.com/yearn/yearn-vaults/blob/main/contracts/Vault.vy#L753-L793 @dev Supports smart contract wallets which implement ERC1271 https://eips.ethereum.org/EIPS/eip-1271 @param _owner The address which is a source of funds and has signed the Permit. @param _spender The address which is allowed to spend the funds. @param _value The amount of tokens to be spent. @param _deadline The timestamp after which the Permit is no longer valid. @param _v The bytes[64] of the valid secp256k1 signature of permit by owner @param _r The bytes[0:32] of the valid secp256k1 signature of permit by owner @param _s The bytes[32:64] of the valid secp256k1 signature of permit by owner @return True, if transaction completes successfully """ assert _owner != empty(address) # dev: invalid owner assert block.timestamp <= _deadline # dev: permit expired nonce: uint256 = self.nonces[_owner] digest: bytes32 = keccak256( concat( b"\x19\x01", self._domain_separator(), keccak256( _abi_encode( EIP2612_TYPEHASH, _owner, _spender, _value, nonce, _deadline ) ), ) ) assert ecrecover(digest, _v, _r, _s) == _owner # dev: invalid signature self.allowance[_owner][_spender] = _value self.nonces[_owner] = unsafe_add(nonce, 1) log Approval(_owner, _spender, _value) return True @external def increaseAllowance(_spender: address, _added_value: uint256) -> bool: """ @notice Increase the allowance granted to `_spender` by the caller @dev This is alternative to {approve} that can be used as a mitigation for the potential race condition @param _spender The address which will transfer the funds @param _added_value The amount of to increase the allowance @return bool success """ allowance: uint256 = self.allowance[msg.sender][_spender] + _added_value self.allowance[msg.sender][_spender] = allowance log Approval(msg.sender, _spender, allowance) return True @external def decreaseAllowance(_spender: address, _subtracted_value: uint256) -> bool: """ @notice Decrease the allowance granted to `_spender` by the caller @dev This is alternative to {approve} that can be used as a mitigation for the potential race condition @param _spender The address which will transfer the funds @param _subtracted_value The amount of to decrease the allowance @return bool success """ allowance: uint256 = self.allowance[msg.sender][_spender] - _subtracted_value self.allowance[msg.sender][_spender] = allowance log Approval(msg.sender, _spender, allowance) return True @external def user_checkpoint(addr: address) -> bool: """ @notice Record a checkpoint for `addr` @param addr User address @return bool success """ assert msg.sender in [addr, MINTER] # dev: unauthorized self._checkpoint(addr) self._update_liquidity_limit(addr, self.balanceOf[addr], self.totalSupply) return True @external def set_rewards_receiver(_receiver: address): """ @notice Set the default reward receiver for the caller. @dev When set to empty(address), rewards are sent to the caller @param _receiver Receiver address for any rewards claimed via `claim_rewards` """ self.rewards_receiver[msg.sender] = _receiver @external def kick(addr: address): """ @notice Kick `addr` for abusing their boost @dev Only if either they had another voting event, or their voting escrow lock expired @param addr Address to kick """ t_last: uint256 = self.integrate_checkpoint_of[addr] t_ve: uint256 = VotingEscrow(VOTING_ESCROW).user_point_history__ts( addr, VotingEscrow(VOTING_ESCROW).user_point_epoch(addr) ) _balance: uint256 = self.balanceOf[addr] assert ERC20(VOTING_ESCROW).balanceOf(addr) == 0 or t_ve > t_last # dev: kick not allowed assert self.working_balances[addr] > _balance * TOKENLESS_PRODUCTION / 100 # dev: kick not needed self._checkpoint(addr) self._update_liquidity_limit(addr, self.balanceOf[addr], self.totalSupply) # Administrative Functions @external def set_gauge_manager(_gauge_manager: address): """ @notice Change the gauge manager for a gauge @dev The manager of this contract, or the ownership admin can outright modify gauge managership. A gauge manager can also transfer managership to a new manager via this method, but only for the gauge which they are the manager of. @param _gauge_manager The account to set as the new manager of the gauge. """ assert msg.sender in [self.manager, Factory(self.factory).admin()] # dev: only manager or factory admin self.manager = _gauge_manager log SetGaugeManager(_gauge_manager) @external @nonreentrant("lock") def deposit_reward_token(_reward_token: address, _amount: uint256, _epoch: uint256 = WEEK): """ @notice Deposit a reward token for distribution @param _reward_token The reward token being deposited @param _amount The amount of `_reward_token` being deposited @param _epoch The duration the rewards are distributed across. """ assert msg.sender == self.reward_data[_reward_token].distributor self._checkpoint_rewards(empty(address), self.totalSupply, False, empty(address)) # transferFrom reward token and use transferred amount henceforth: amount_received: uint256 = ERC20(_reward_token).balanceOf(self) assert ERC20(_reward_token).transferFrom( msg.sender, self, _amount, default_return_value=True ) amount_received = ERC20(_reward_token).balanceOf(self) - amount_received period_finish: uint256 = self.reward_data[_reward_token].period_finish assert amount_received > _epoch # dev: rate will tend to zero! if block.timestamp >= period_finish: self.reward_data[_reward_token].rate = amount_received / _epoch else: remaining: uint256 = period_finish - block.timestamp leftover: uint256 = remaining * self.reward_data[_reward_token].rate self.reward_data[_reward_token].rate = (amount_received + leftover) / _epoch self.reward_data[_reward_token].last_update = block.timestamp self.reward_data[_reward_token].period_finish = block.timestamp + _epoch @external def add_reward(_reward_token: address, _distributor: address): """ @notice Add additional rewards to be distributed to stakers @param _reward_token The token to add as an additional reward @param _distributor Address permitted to fund this contract with the reward token """ assert msg.sender in [self.manager, Factory(self.factory).admin()] # dev: only manager or factory admin assert _distributor != empty(address) # dev: distributor cannot be zero address reward_count: uint256 = self.reward_count assert reward_count < MAX_REWARDS assert self.reward_data[_reward_token].distributor == empty(address) self.reward_data[_reward_token].distributor = _distributor self.reward_tokens[reward_count] = _reward_token self.reward_count = reward_count + 1 @external def set_reward_distributor(_reward_token: address, _distributor: address): """ @notice Reassign the reward distributor for a reward token @param _reward_token The reward token to reassign distribution rights to @param _distributor The address of the new distributor """ current_distributor: address = self.reward_data[_reward_token].distributor assert msg.sender in [current_distributor, Factory(self.factory).admin(), self.manager] assert current_distributor != empty(address) assert _distributor != empty(address) self.reward_data[_reward_token].distributor = _distributor @external def set_killed(_is_killed: bool): """ @notice Set the killed status for this contract @dev When killed, the gauge always yields a rate of 0 and so cannot mint CRV @param _is_killed Killed status to set """ assert msg.sender == Factory(self.factory).admin() # dev: only owner self.is_killed = _is_killed # View Methods @view @external def claimed_reward(_addr: address, _token: address) -> uint256: """ @notice Get the number of already-claimed reward tokens for a user @param _addr Account to get reward amount for @param _token Token to get reward amount for @return uint256 Total amount of `_token` already claimed by `_addr` """ return self.claim_data[_addr][_token] % 2**128 @view @external def claimable_reward(_user: address, _reward_token: address) -> uint256: """ @notice Get the number of claimable reward tokens for a user @param _user Account to get reward amount for @param _reward_token Token to get reward amount for @return uint256 Claimable reward token amount """ integral: uint256 = self.reward_data[_reward_token].integral total_supply: uint256 = self.totalSupply if total_supply != 0: last_update: uint256 = min(block.timestamp, self.reward_data[_reward_token].period_finish) duration: uint256 = last_update - self.reward_data[_reward_token].last_update integral += (duration * self.reward_data[_reward_token].rate * 10**18 / total_supply) integral_for: uint256 = self.reward_integral_for[_reward_token][_user] new_claimable: uint256 = self.balanceOf[_user] * (integral - integral_for) / 10**18 return (self.claim_data[_user][_reward_token] >> 128) + new_claimable @external def claimable_tokens(addr: address) -> uint256: """ @notice Get the number of claimable tokens per user @dev This function should be manually changed to "view" in the ABI @return uint256 number of claimable tokens per user """ self._checkpoint(addr) return self.integrate_fraction[addr] - Minter(MINTER).minted(addr, self) @view @external def integrate_checkpoint() -> uint256: """ @notice Get the timestamp of the last checkpoint """ return self.period_timestamp[self.period] @view @external def future_epoch_time() -> uint256: """ @notice Get the locally stored CRV future epoch start time """ return self.inflation_params >> 216 @view @external def inflation_rate() -> uint256: """ @notice Get the locally stored CRV inflation rate """ return self.inflation_params % 2 ** 216 @view @external def decimals() -> uint256: """ @notice Get the number of decimals for this token @dev Implemented as a view method to reduce gas costs @return uint256 decimal places """ return 18 @view @external def version() -> String[8]: """ @notice Get the version of this gauge contract """ return VERSION @view @external def DOMAIN_SEPARATOR() -> bytes32: """ @notice EIP712 domain separator. """ return self._domain_separator()
1
20,290,581
d1775f79961cbb0ae15ec2e66e2b43ca9d9e1c921d278f8d373c82bf9f2a7ffa
9cce2b0a80d995861f41a367b187a26af04b8f1aa6e50a01926aeb60c4152ea1
bfbcdd04dda68cfcfba2d687ffce365fd46d5f5f
5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f
f74b9cc57a932cfb81578116e12408a2021e4bc6
60806040526001600c5534801561001557600080fd5b506040514690806052612d228239604080519182900360520182208282018252600a8352692ab734b9bbb0b8102b1960b11b6020938401528151808301835260018152603160f81b908401528151808401919091527fbfcc8ef98ffbf7b6c3fec7bf5185b566b9863e35a9d83acd49ad6824b5969738818301527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606082015260808101949094523060a0808601919091528151808603909101815260c09094019052825192019190912060035550600580546001600160a01b03191633179055612c1d806101056000396000f3fe608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a7146105da578063d505accf146105e2578063dd62ed3e14610640578063fff6cae91461067b576101b9565b8063ba9a7a5614610597578063bc25cf771461059f578063c45a0155146105d2576101b9565b80637ecebe00116100d35780637ecebe00146104d757806389afcb441461050a57806395d89b4114610556578063a9059cbb1461055e576101b9565b80636a6278421461046957806370a082311461049c5780637464fc3d146104cf576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610416578063485cc9551461041e5780635909c0d5146104595780635a3d549314610461576101b9565b806323b872dd146103ad57806330adf81f146103f0578063313ce567146103f8576101b9565b8063095ea7b311610197578063095ea7b3146103155780630dfe16811461036257806318160ddd14610393576101b9565b8063022c0d9f146101be57806306fdde03146102595780630902f1ac146102d6575b600080fd5b610257600480360360808110156101d457600080fd5b81359160208101359173ffffffffffffffffffffffffffffffffffffffff604083013516919081019060808101606082013564010000000081111561021857600080fd5b82018360208201111561022a57600080fd5b8035906020019184600183028401116401000000008311171561024c57600080fd5b509092509050610683565b005b610261610d57565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029b578181015183820152602001610283565b50505050905090810190601f1680156102c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102de610d90565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b61034e6004803603604081101561032b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de5565b604080519115158252519081900360200190f35b61036a610dfc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61039b610e18565b60408051918252519081900360200190f35b61034e600480360360608110156103c357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e1e565b61039b610efd565b610400610f21565b6040805160ff9092168252519081900360200190f35b61039b610f26565b6102576004803603604081101561043457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610f2c565b61039b611005565b61039b61100b565b61039b6004803603602081101561047f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611011565b61039b600480360360208110156104b257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113cb565b61039b6113dd565b61039b600480360360208110156104ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113e3565b61053d6004803603602081101561052057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113f5565b6040805192835260208301919091528051918290030190f35b610261611892565b61034e6004803603604081101561057457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356118cb565b61039b6118d8565b610257600480360360208110156105b557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166118de565b61036a611ad4565b61036a611af0565b610257600480360360e08110156105f857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b0c565b61039b6004803603604081101561065657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611dd8565b610257611df5565b600c546001146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55841515806107075750600084115b61075c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b2f6025913960400191505060405180910390fd5b600080610767610d90565b5091509150816dffffffffffffffffffffffffffff168710801561079a5750806dffffffffffffffffffffffffffff1686105b6107ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b786021913960400191505060405180910390fd5b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff91821691908116908916821480159061085457508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b6108bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a156108d0576108d0828a8d611fdb565b89156108e1576108e1818a8c611fdb565b86156109c3578873ffffffffffffffffffffffffffffffffffffffff166310d1e85c338d8d8c8c6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050505b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8416916370a08231916024808301926020929190829003018186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191955073ffffffffffffffffffffffffffffffffffffffff8316916370a0823191602480820192602092909190829003018186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d6020811015610af557600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a90038311610b1f576000610b35565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610b59576000610b6f565b89856dffffffffffffffffffffffffffff160383035b90506000821180610b805750600081115b610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b546024913960400191505060405180910390fd5b6000610c09610beb84600363ffffffff6121e816565b610bfd876103e863ffffffff6121e816565b9063ffffffff61226e16565b90506000610c21610beb84600363ffffffff6121e816565b9050610c59620f4240610c4d6dffffffffffffffffffffffffffff8b8116908b1663ffffffff6121e816565b9063ffffffff6121e816565b610c69838363ffffffff6121e816565b1015610cd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610ce4848488886122e0565b60408051838152602081018390528082018d9052606081018c9052905173ffffffffffffffffffffffffffffffffffffffff8b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a81526020017f556e69737761702056320000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610df233848461259c565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610ee85773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610eb6908363ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610ef384848461260b565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610fb257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c5460011461108457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611094610d90565b50600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905193955091935060009273ffffffffffffffffffffffffffffffffffffffff909116916370a08231916024808301926020929190829003018186803b15801561110e57600080fd5b505afa158015611122573d6000803e3d6000fd5b505050506040513d602081101561113857600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905192935060009273ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d60208110156111db57600080fd5b505190506000611201836dffffffffffffffffffffffffffff871663ffffffff61226e16565b90506000611225836dffffffffffffffffffffffffffff871663ffffffff61226e16565b9050600061123387876126ec565b600054909150806112705761125c6103e8610bfd611257878763ffffffff6121e816565b612878565b985061126b60006103e86128ca565b6112cd565b6112ca6dffffffffffffffffffffffffffff8916611294868463ffffffff6121e816565b8161129b57fe5b046dffffffffffffffffffffffffffff89166112bd868563ffffffff6121e816565b816112c457fe5b0461297a565b98505b60008911611326576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612bc16028913960400191505060405180910390fd5b6113308a8a6128ca565b61133c86868a8a6122e0565b811561137e5760085461137a906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461146957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611479610d90565b50600654600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905194965092945073ffffffffffffffffffffffffffffffffffffffff9182169391169160009184916370a08231916024808301926020929190829003018186803b1580156114fb57600080fd5b505afa15801561150f573d6000803e3d6000fd5b505050506040513d602081101561152557600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191925060009173ffffffffffffffffffffffffffffffffffffffff8516916370a08231916024808301926020929190829003018186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d60208110156115c357600080fd5b5051306000908152600160205260408120549192506115e288886126ec565b600054909150806115f9848763ffffffff6121e816565b8161160057fe5b049a5080611614848663ffffffff6121e816565b8161161b57fe5b04995060008b11801561162e575060008a115b611683576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612b996028913960400191505060405180910390fd5b61168d3084612992565b611698878d8d611fdb565b6116a3868d8c611fdb565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8916916370a08231916024808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d602081101561173957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191965073ffffffffffffffffffffffffffffffffffffffff8816916370a0823191602480820192602092909190829003018186803b1580156117ab57600080fd5b505afa1580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b505193506117e585858b8b6122e0565b811561182757600854611823906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b604080518c8152602081018c9052815173ffffffffffffffffffffffffffffffffffffffff8f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f554e492d5632000000000000000000000000000000000000000000000000000081525081565b6000610df233848461260b565b6103e881565b600c5460011461194f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654600754600854604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff9485169490931692611a2b9285928792611a26926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff61226e16565b611fdb565b600854604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611aca9284928792611a26926e01000000000000000000000000000090046dffffffffffffffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff8616916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611b7b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff80891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e2808201937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019281900390910190855afa158015611cdc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611d5757508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611dc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611dcd89898961259c565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611e6657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611fd49273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b158015611f7a57600080fd5b505afa158015611f8e573d6000803e3d6000fd5b505050506040513d6020811015611fa457600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166122e0565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e743235362900000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b602083106120e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016120a4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612143576040519150601f19603f3d011682016040523d82523d6000602084013e612148565b606091505b5091509150818015612176575080511580612176575080806020019051602081101561217357600080fd5b50515b6121e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b60008115806122035750508082028282828161220057fe5b04145b610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061230c57506dffffffffffffffffffffffffffff8311155b61237757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906123c757506dffffffffffffffffffffffffffff841615155b80156123e257506dffffffffffffffffffffffffffff831615155b15612492578063ffffffff16612425856123fb86612a57565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169063ffffffff612a7b16565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff8116612465846123fb87612a57565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054612641908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160205260408082209390935590841681522054612683908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561275757600080fd5b505afa15801561276b573d6000803e3d6000fd5b505050506040513d602081101561278157600080fd5b5051600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061286457801561285f5760006127d86112576dffffffffffffffffffffffffffff88811690881663ffffffff6121e816565b905060006127e583612878565b90508082111561285c576000612813612804848463ffffffff61226e16565b6000549063ffffffff6121e816565b905060006128388361282c86600563ffffffff6121e816565b9063ffffffff612abc16565b9050600081838161284557fe5b04905080156128585761285887826128ca565b5050505b50505b612870565b8015612870576000600b555b505092915050565b600060038211156128bb575080600160028204015b818110156128b5578091506002818285816128a457fe5b0401816128ad57fe5b04905061288d565b506128c5565b81156128c5575060015b919050565b6000546128dd908263ffffffff612abc16565b600090815573ffffffffffffffffffffffffffffffffffffffff8316815260016020526040902054612915908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000818310612989578161298b565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020546129c8908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081209190915554612a02908263ffffffff61226e16565b600090815560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff841681612ab457fe5b049392505050565b80820182811015610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158207dca18479e58487606bf70c79e44d8dee62353c9ee6d01f9a9d70885b8765f2264736f6c63430005100032454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e747261637429
608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a7146105da578063d505accf146105e2578063dd62ed3e14610640578063fff6cae91461067b576101b9565b8063ba9a7a5614610597578063bc25cf771461059f578063c45a0155146105d2576101b9565b80637ecebe00116100d35780637ecebe00146104d757806389afcb441461050a57806395d89b4114610556578063a9059cbb1461055e576101b9565b80636a6278421461046957806370a082311461049c5780637464fc3d146104cf576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610416578063485cc9551461041e5780635909c0d5146104595780635a3d549314610461576101b9565b806323b872dd146103ad57806330adf81f146103f0578063313ce567146103f8576101b9565b8063095ea7b311610197578063095ea7b3146103155780630dfe16811461036257806318160ddd14610393576101b9565b8063022c0d9f146101be57806306fdde03146102595780630902f1ac146102d6575b600080fd5b610257600480360360808110156101d457600080fd5b81359160208101359173ffffffffffffffffffffffffffffffffffffffff604083013516919081019060808101606082013564010000000081111561021857600080fd5b82018360208201111561022a57600080fd5b8035906020019184600183028401116401000000008311171561024c57600080fd5b509092509050610683565b005b610261610d57565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029b578181015183820152602001610283565b50505050905090810190601f1680156102c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102de610d90565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b61034e6004803603604081101561032b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de5565b604080519115158252519081900360200190f35b61036a610dfc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61039b610e18565b60408051918252519081900360200190f35b61034e600480360360608110156103c357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e1e565b61039b610efd565b610400610f21565b6040805160ff9092168252519081900360200190f35b61039b610f26565b6102576004803603604081101561043457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610f2c565b61039b611005565b61039b61100b565b61039b6004803603602081101561047f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611011565b61039b600480360360208110156104b257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113cb565b61039b6113dd565b61039b600480360360208110156104ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113e3565b61053d6004803603602081101561052057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113f5565b6040805192835260208301919091528051918290030190f35b610261611892565b61034e6004803603604081101561057457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356118cb565b61039b6118d8565b610257600480360360208110156105b557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166118de565b61036a611ad4565b61036a611af0565b610257600480360360e08110156105f857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b0c565b61039b6004803603604081101561065657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611dd8565b610257611df5565b600c546001146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55841515806107075750600084115b61075c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b2f6025913960400191505060405180910390fd5b600080610767610d90565b5091509150816dffffffffffffffffffffffffffff168710801561079a5750806dffffffffffffffffffffffffffff1686105b6107ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b786021913960400191505060405180910390fd5b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff91821691908116908916821480159061085457508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b6108bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a156108d0576108d0828a8d611fdb565b89156108e1576108e1818a8c611fdb565b86156109c3578873ffffffffffffffffffffffffffffffffffffffff166310d1e85c338d8d8c8c6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050505b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8416916370a08231916024808301926020929190829003018186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191955073ffffffffffffffffffffffffffffffffffffffff8316916370a0823191602480820192602092909190829003018186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d6020811015610af557600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a90038311610b1f576000610b35565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610b59576000610b6f565b89856dffffffffffffffffffffffffffff160383035b90506000821180610b805750600081115b610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b546024913960400191505060405180910390fd5b6000610c09610beb84600363ffffffff6121e816565b610bfd876103e863ffffffff6121e816565b9063ffffffff61226e16565b90506000610c21610beb84600363ffffffff6121e816565b9050610c59620f4240610c4d6dffffffffffffffffffffffffffff8b8116908b1663ffffffff6121e816565b9063ffffffff6121e816565b610c69838363ffffffff6121e816565b1015610cd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610ce4848488886122e0565b60408051838152602081018390528082018d9052606081018c9052905173ffffffffffffffffffffffffffffffffffffffff8b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a81526020017f556e69737761702056320000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610df233848461259c565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610ee85773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610eb6908363ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610ef384848461260b565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610fb257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c5460011461108457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611094610d90565b50600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905193955091935060009273ffffffffffffffffffffffffffffffffffffffff909116916370a08231916024808301926020929190829003018186803b15801561110e57600080fd5b505afa158015611122573d6000803e3d6000fd5b505050506040513d602081101561113857600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905192935060009273ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d60208110156111db57600080fd5b505190506000611201836dffffffffffffffffffffffffffff871663ffffffff61226e16565b90506000611225836dffffffffffffffffffffffffffff871663ffffffff61226e16565b9050600061123387876126ec565b600054909150806112705761125c6103e8610bfd611257878763ffffffff6121e816565b612878565b985061126b60006103e86128ca565b6112cd565b6112ca6dffffffffffffffffffffffffffff8916611294868463ffffffff6121e816565b8161129b57fe5b046dffffffffffffffffffffffffffff89166112bd868563ffffffff6121e816565b816112c457fe5b0461297a565b98505b60008911611326576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612bc16028913960400191505060405180910390fd5b6113308a8a6128ca565b61133c86868a8a6122e0565b811561137e5760085461137a906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461146957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611479610d90565b50600654600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905194965092945073ffffffffffffffffffffffffffffffffffffffff9182169391169160009184916370a08231916024808301926020929190829003018186803b1580156114fb57600080fd5b505afa15801561150f573d6000803e3d6000fd5b505050506040513d602081101561152557600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191925060009173ffffffffffffffffffffffffffffffffffffffff8516916370a08231916024808301926020929190829003018186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d60208110156115c357600080fd5b5051306000908152600160205260408120549192506115e288886126ec565b600054909150806115f9848763ffffffff6121e816565b8161160057fe5b049a5080611614848663ffffffff6121e816565b8161161b57fe5b04995060008b11801561162e575060008a115b611683576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612b996028913960400191505060405180910390fd5b61168d3084612992565b611698878d8d611fdb565b6116a3868d8c611fdb565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8916916370a08231916024808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d602081101561173957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191965073ffffffffffffffffffffffffffffffffffffffff8816916370a0823191602480820192602092909190829003018186803b1580156117ab57600080fd5b505afa1580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b505193506117e585858b8b6122e0565b811561182757600854611823906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b604080518c8152602081018c9052815173ffffffffffffffffffffffffffffffffffffffff8f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f554e492d5632000000000000000000000000000000000000000000000000000081525081565b6000610df233848461260b565b6103e881565b600c5460011461194f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654600754600854604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff9485169490931692611a2b9285928792611a26926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff61226e16565b611fdb565b600854604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611aca9284928792611a26926e01000000000000000000000000000090046dffffffffffffffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff8616916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611b7b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff80891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e2808201937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019281900390910190855afa158015611cdc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611d5757508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611dc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611dcd89898961259c565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611e6657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611fd49273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b158015611f7a57600080fd5b505afa158015611f8e573d6000803e3d6000fd5b505050506040513d6020811015611fa457600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166122e0565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e743235362900000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b602083106120e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016120a4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612143576040519150601f19603f3d011682016040523d82523d6000602084013e612148565b606091505b5091509150818015612176575080511580612176575080806020019051602081101561217357600080fd5b50515b6121e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b60008115806122035750508082028282828161220057fe5b04145b610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061230c57506dffffffffffffffffffffffffffff8311155b61237757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906123c757506dffffffffffffffffffffffffffff841615155b80156123e257506dffffffffffffffffffffffffffff831615155b15612492578063ffffffff16612425856123fb86612a57565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169063ffffffff612a7b16565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff8116612465846123fb87612a57565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054612641908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160205260408082209390935590841681522054612683908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561275757600080fd5b505afa15801561276b573d6000803e3d6000fd5b505050506040513d602081101561278157600080fd5b5051600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061286457801561285f5760006127d86112576dffffffffffffffffffffffffffff88811690881663ffffffff6121e816565b905060006127e583612878565b90508082111561285c576000612813612804848463ffffffff61226e16565b6000549063ffffffff6121e816565b905060006128388361282c86600563ffffffff6121e816565b9063ffffffff612abc16565b9050600081838161284557fe5b04905080156128585761285887826128ca565b5050505b50505b612870565b8015612870576000600b555b505092915050565b600060038211156128bb575080600160028204015b818110156128b5578091506002818285816128a457fe5b0401816128ad57fe5b04905061288d565b506128c5565b81156128c5575060015b919050565b6000546128dd908263ffffffff612abc16565b600090815573ffffffffffffffffffffffffffffffffffffffff8316815260016020526040902054612915908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000818310612989578161298b565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020546129c8908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081209190915554612a02908263ffffffff61226e16565b600090815560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff841681612ab457fe5b049392505050565b80820182811015610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158207dca18479e58487606bf70c79e44d8dee62353c9ee6d01f9a9d70885b8765f2264736f6c63430005100032
// File: contracts/interfaces/IUniswapV2Pair.sol pragma solidity >=0.5.0; interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; } // File: contracts/interfaces/IUniswapV2ERC20.sol pragma solidity >=0.5.0; interface IUniswapV2ERC20 { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; } // File: contracts/libraries/SafeMath.sol pragma solidity =0.5.16; // a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math) library SafeMath { function add(uint x, uint y) internal pure returns (uint z) { require((z = x + y) >= x, 'ds-math-add-overflow'); } function sub(uint x, uint y) internal pure returns (uint z) { require((z = x - y) <= x, 'ds-math-sub-underflow'); } function mul(uint x, uint y) internal pure returns (uint z) { require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow'); } } // File: contracts/UniswapV2ERC20.sol pragma solidity =0.5.16; contract UniswapV2ERC20 is IUniswapV2ERC20 { using SafeMath for uint; string public constant name = 'Uniswap V2'; string public constant symbol = 'UNI-V2'; uint8 public constant decimals = 18; uint public totalSupply; mapping(address => uint) public balanceOf; mapping(address => mapping(address => uint)) public allowance; bytes32 public DOMAIN_SEPARATOR; // keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9; mapping(address => uint) public nonces; event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); constructor() public { uint chainId; assembly { chainId := chainid } DOMAIN_SEPARATOR = keccak256( abi.encode( keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'), keccak256(bytes(name)), keccak256(bytes('1')), chainId, address(this) ) ); } function _mint(address to, uint value) internal { totalSupply = totalSupply.add(value); balanceOf[to] = balanceOf[to].add(value); emit Transfer(address(0), to, value); } function _burn(address from, uint value) internal { balanceOf[from] = balanceOf[from].sub(value); totalSupply = totalSupply.sub(value); emit Transfer(from, address(0), value); } function _approve(address owner, address spender, uint value) private { allowance[owner][spender] = value; emit Approval(owner, spender, value); } function _transfer(address from, address to, uint value) private { balanceOf[from] = balanceOf[from].sub(value); balanceOf[to] = balanceOf[to].add(value); emit Transfer(from, to, value); } function approve(address spender, uint value) external returns (bool) { _approve(msg.sender, spender, value); return true; } function transfer(address to, uint value) external returns (bool) { _transfer(msg.sender, to, value); return true; } function transferFrom(address from, address to, uint value) external returns (bool) { if (allowance[from][msg.sender] != uint(-1)) { allowance[from][msg.sender] = allowance[from][msg.sender].sub(value); } _transfer(from, to, value); return true; } function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external { require(deadline >= block.timestamp, 'UniswapV2: EXPIRED'); bytes32 digest = keccak256( abi.encodePacked( '\x19\x01', DOMAIN_SEPARATOR, keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline)) ) ); address recoveredAddress = ecrecover(digest, v, r, s); require(recoveredAddress != address(0) && recoveredAddress == owner, 'UniswapV2: INVALID_SIGNATURE'); _approve(owner, spender, value); } } // File: contracts/libraries/Math.sol pragma solidity =0.5.16; // a library for performing various math operations library Math { function min(uint x, uint y) internal pure returns (uint z) { z = x < y ? x : y; } // babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method) function sqrt(uint y) internal pure returns (uint z) { if (y > 3) { z = y; uint x = y / 2 + 1; while (x < z) { z = x; x = (y / x + x) / 2; } } else if (y != 0) { z = 1; } } } // File: contracts/libraries/UQ112x112.sol pragma solidity =0.5.16; // a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format)) // range: [0, 2**112 - 1] // resolution: 1 / 2**112 library UQ112x112 { uint224 constant Q112 = 2**112; // encode a uint112 as a UQ112x112 function encode(uint112 y) internal pure returns (uint224 z) { z = uint224(y) * Q112; // never overflows } // divide a UQ112x112 by a uint112, returning a UQ112x112 function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) { z = x / uint224(y); } } // File: contracts/interfaces/IERC20.sol pragma solidity >=0.5.0; interface IERC20 { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); } // File: contracts/interfaces/IUniswapV2Factory.sol pragma solidity >=0.5.0; interface IUniswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint) external view returns (address pair); function allPairsLength() external view returns (uint); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; } // File: contracts/interfaces/IUniswapV2Callee.sol pragma solidity >=0.5.0; interface IUniswapV2Callee { function uniswapV2Call(address sender, uint amount0, uint amount1, bytes calldata data) external; } // File: contracts/UniswapV2Pair.sol pragma solidity =0.5.16; contract UniswapV2Pair is IUniswapV2Pair, UniswapV2ERC20 { using SafeMath for uint; using UQ112x112 for uint224; uint public constant MINIMUM_LIQUIDITY = 10**3; bytes4 private constant SELECTOR = bytes4(keccak256(bytes('transfer(address,uint256)'))); address public factory; address public token0; address public token1; uint112 private reserve0; // uses single storage slot, accessible via getReserves uint112 private reserve1; // uses single storage slot, accessible via getReserves uint32 private blockTimestampLast; // uses single storage slot, accessible via getReserves uint public price0CumulativeLast; uint public price1CumulativeLast; uint public kLast; // reserve0 * reserve1, as of immediately after the most recent liquidity event uint private unlocked = 1; modifier lock() { require(unlocked == 1, 'UniswapV2: LOCKED'); unlocked = 0; _; unlocked = 1; } function getReserves() public view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast) { _reserve0 = reserve0; _reserve1 = reserve1; _blockTimestampLast = blockTimestampLast; } function _safeTransfer(address token, address to, uint value) private { (bool success, bytes memory data) = token.call(abi.encodeWithSelector(SELECTOR, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'UniswapV2: TRANSFER_FAILED'); } event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); constructor() public { factory = msg.sender; } // called once by the factory at time of deployment function initialize(address _token0, address _token1) external { require(msg.sender == factory, 'UniswapV2: FORBIDDEN'); // sufficient check token0 = _token0; token1 = _token1; } // update reserves and, on the first call per block, price accumulators function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private { require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'UniswapV2: OVERFLOW'); uint32 blockTimestamp = uint32(block.timestamp % 2**32); uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) { // * never overflows, and + overflow is desired price0CumulativeLast += uint(UQ112x112.encode(_reserve1).uqdiv(_reserve0)) * timeElapsed; price1CumulativeLast += uint(UQ112x112.encode(_reserve0).uqdiv(_reserve1)) * timeElapsed; } reserve0 = uint112(balance0); reserve1 = uint112(balance1); blockTimestampLast = blockTimestamp; emit Sync(reserve0, reserve1); } // if fee is on, mint liquidity equivalent to 1/6th of the growth in sqrt(k) function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) { address feeTo = IUniswapV2Factory(factory).feeTo(); feeOn = feeTo != address(0); uint _kLast = kLast; // gas savings if (feeOn) { if (_kLast != 0) { uint rootK = Math.sqrt(uint(_reserve0).mul(_reserve1)); uint rootKLast = Math.sqrt(_kLast); if (rootK > rootKLast) { uint numerator = totalSupply.mul(rootK.sub(rootKLast)); uint denominator = rootK.mul(5).add(rootKLast); uint liquidity = numerator / denominator; if (liquidity > 0) _mint(feeTo, liquidity); } } } else if (_kLast != 0) { kLast = 0; } } // this low-level function should be called from a contract which performs important safety checks function mint(address to) external lock returns (uint liquidity) { (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings uint balance0 = IERC20(token0).balanceOf(address(this)); uint balance1 = IERC20(token1).balanceOf(address(this)); uint amount0 = balance0.sub(_reserve0); uint amount1 = balance1.sub(_reserve1); bool feeOn = _mintFee(_reserve0, _reserve1); uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee if (_totalSupply == 0) { liquidity = Math.sqrt(amount0.mul(amount1)).sub(MINIMUM_LIQUIDITY); _mint(address(0), MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens } else { liquidity = Math.min(amount0.mul(_totalSupply) / _reserve0, amount1.mul(_totalSupply) / _reserve1); } require(liquidity > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED'); _mint(to, liquidity); _update(balance0, balance1, _reserve0, _reserve1); if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date emit Mint(msg.sender, amount0, amount1); } // this low-level function should be called from a contract which performs important safety checks function burn(address to) external lock returns (uint amount0, uint amount1) { (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings address _token0 = token0; // gas savings address _token1 = token1; // gas savings uint balance0 = IERC20(_token0).balanceOf(address(this)); uint balance1 = IERC20(_token1).balanceOf(address(this)); uint liquidity = balanceOf[address(this)]; bool feeOn = _mintFee(_reserve0, _reserve1); uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee amount0 = liquidity.mul(balance0) / _totalSupply; // using balances ensures pro-rata distribution amount1 = liquidity.mul(balance1) / _totalSupply; // using balances ensures pro-rata distribution require(amount0 > 0 && amount1 > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED'); _burn(address(this), liquidity); _safeTransfer(_token0, to, amount0); _safeTransfer(_token1, to, amount1); balance0 = IERC20(_token0).balanceOf(address(this)); balance1 = IERC20(_token1).balanceOf(address(this)); _update(balance0, balance1, _reserve0, _reserve1); if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date emit Burn(msg.sender, amount0, amount1, to); } // this low-level function should be called from a contract which performs important safety checks function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external lock { require(amount0Out > 0 || amount1Out > 0, 'UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT'); (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings require(amount0Out < _reserve0 && amount1Out < _reserve1, 'UniswapV2: INSUFFICIENT_LIQUIDITY'); uint balance0; uint balance1; { // scope for _token{0,1}, avoids stack too deep errors address _token0 = token0; address _token1 = token1; require(to != _token0 && to != _token1, 'UniswapV2: INVALID_TO'); if (amount0Out > 0) _safeTransfer(_token0, to, amount0Out); // optimistically transfer tokens if (amount1Out > 0) _safeTransfer(_token1, to, amount1Out); // optimistically transfer tokens if (data.length > 0) IUniswapV2Callee(to).uniswapV2Call(msg.sender, amount0Out, amount1Out, data); balance0 = IERC20(_token0).balanceOf(address(this)); balance1 = IERC20(_token1).balanceOf(address(this)); } uint amount0In = balance0 > _reserve0 - amount0Out ? balance0 - (_reserve0 - amount0Out) : 0; uint amount1In = balance1 > _reserve1 - amount1Out ? balance1 - (_reserve1 - amount1Out) : 0; require(amount0In > 0 || amount1In > 0, 'UniswapV2: INSUFFICIENT_INPUT_AMOUNT'); { // scope for reserve{0,1}Adjusted, avoids stack too deep errors uint balance0Adjusted = balance0.mul(1000).sub(amount0In.mul(3)); uint balance1Adjusted = balance1.mul(1000).sub(amount1In.mul(3)); require(balance0Adjusted.mul(balance1Adjusted) >= uint(_reserve0).mul(_reserve1).mul(1000**2), 'UniswapV2: K'); } _update(balance0, balance1, _reserve0, _reserve1); emit Swap(msg.sender, amount0In, amount1In, amount0Out, amount1Out, to); } // force balances to match reserves function skim(address to) external lock { address _token0 = token0; // gas savings address _token1 = token1; // gas savings _safeTransfer(_token0, to, IERC20(_token0).balanceOf(address(this)).sub(reserve0)); _safeTransfer(_token1, to, IERC20(_token1).balanceOf(address(this)).sub(reserve1)); } // force reserves to match balances function sync() external lock { _update(IERC20(token0).balanceOf(address(this)), IERC20(token1).balanceOf(address(this)), reserve0, reserve1); } }
1
20,290,582
72a99cec2a1da848b58d61b72cf9c9c6e78ab21f9b72d93a875c64af9d74e30d
3e31ae905d1b84575dcf9589093a539d4a90a7c2433e4fea0fee06270baf0fbb
e47f7e1b492fbd8771e8fb3609d1a1afed450072
53ea4448df8bf44a5c8285dcca7d4ac2baae0079
58c4bc83c3d3c2e0473d4f941893eac52343274c
602d3d8160093d39f3363d3d373d3d3d363d73ce52b9142ab2d0d754ad439cdff2cf14f98423455af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73ce52b9142ab2d0d754ad439cdff2cf14f98423455af43d82803e903d91602b57fd5bf3
# @version 0.3.10 """ @title Zharta Renting Vault Contract @author [Zharta](https://zharta.io/) @notice This contract is the vault implementation for the LOTM Renting Protocol. @dev This is the implementation contract for each vault, which is deployed as a minimal proxy (ERC1167) by `RentingV3.vy` and accepts only calls from it. This contract holds the assets (NFTs) ) but does not store any information regarding the token, so pre-conditions must be validated by the caller (`RentingV3.vy`). It implement the functions required for token delegation and staking. Delegations are performed by warm.xyz HotWalletProxy. """ # Interfaces from vyper.interfaces import ERC20 as IERC20 from vyper.interfaces import ERC721 as IERC721 interface IDelegationRegistry: def getHotWallet(cold_wallet: address) -> address: view def setHotWallet(hot_wallet_address: address, expiration_timestamp: uint256, lock_hot_wallet_address: bool): nonpayable def setExpirationTimestamp(expiration_timestamp: uint256): nonpayable # Structs struct SingleNft: tokenId: uint32 amount: uint224 # Global Variables caller: public(address) payment_token: public(immutable(IERC20)) nft_contract: public(immutable(IERC721)) delegation_registry: public(immutable(IDelegationRegistry)) ##### EXTERNAL METHODS - WRITE ##### @payable @external def __init__( _payment_token_addr: address, _nft_contract_addr: address, _delegation_registry_addr: address, ): """ @dev Sets up the contract by initializing the payment token, NFT contract, delegation registry and staking contract addresses. @param _payment_token_addr The address of the payment token contract. @param _nft_contract_addr The address of the NFT contract. @param _delegation_registry_addr The address of the delegation registry contract. """ assert _payment_token_addr != empty(address), "payment token addr not set" assert _nft_contract_addr != empty(address), "nft contract addr not set" assert _delegation_registry_addr != empty(address), "delegation addr not set" payment_token = IERC20(_payment_token_addr) nft_contract = IERC721(_nft_contract_addr) delegation_registry = IDelegationRegistry(_delegation_registry_addr) # Functions @external def initialise(): """ @notice Initialize a vault contract, setting the caller as the contract deployer. @dev Ensures that the vault is not already initialized. """ assert self.caller == empty(address), "already initialised" self.caller = msg.sender @external def deposit(token_id: uint256, nft_owner: address, delegate: address): """ @notice Deposit an NFT into the vault and optionaly sets up delegation. @dev Transfers the NFT from the owner to the vault and optionally sets up delegation. @param token_id The id of the NFT to be deposited. @param nft_owner The address of the NFT owner. @param delegate The address to delegate the NFT to. If empty no delegation is done. """ assert msg.sender == self.caller, "not caller" nft_contract.safeTransferFrom(nft_owner, self, token_id, b"") if delegate != empty(address): self._delegate_to_wallet(delegate, max_value(uint256)) @external def withdraw(token_id: uint256, wallet: address): """ @notice Withdraw an NFT from the vault and transfer it to the wallet. @dev Transfers the NFT from the vault to the wallet and clears the delegation. @param token_id The id of the NFT to be withdrawn. @param wallet The address of the wallet to receive the NFT. """ assert msg.sender == self.caller, "not caller" nft_contract.safeTransferFrom(self, wallet, token_id, b"") self._delegate_to_wallet(empty(address), 0) @external def delegate_to_wallet(delegate: address, expiration: uint256): """ @notice Delegate the NFT to a wallet. @dev Delegates the NFT to the given address. @param delegate The address to delegate the NFT to. @param expiration The expiration timestamp for the delegation. """ assert msg.sender == self.caller, "not caller" self._delegate_to_wallet(delegate, expiration) @external def staking_deposit(sender: address, amount: uint256, token_id: uint256, staking_addr: address, pool_method_id: bytes4): """ @notice Deposit the payment token into the staking contract. @dev Deposits the payment token into the staking contract. @param sender The address of the payment token sender. @param amount The amount of the payment token to deposit. @param token_id The id of the NFT supporting the deposit, which must be deposited in the vault. @param staking_addr The address of the staking contract. @param pool_method_id The method id of the staking pool deposit function. """ assert msg.sender == self.caller, "not caller" self._staking_deposit(sender, amount, token_id, staking_addr, pool_method_id) @external def staking_withdraw(wallet: address, amount: uint256, token_id: uint256, staking_addr: address, pool_method_id: bytes4): """ @notice Withdraw the payment token from the staking contract. @dev Withdraws the payment token from the staking contract. @param wallet The address of the wallet to receive the payment token. @param amount The amount of the payment token to withdraw. @param token_id The id of the NFT supporting the withdrawal, which must be deposited in the vault. @param staking_addr The address of the staking contract. @param pool_method_id The method id of the staking pool withdraw function. """ assert msg.sender == self.caller, "not caller" self._staking_withdraw(wallet, amount, token_id, staking_addr, pool_method_id) @external def staking_claim(wallet: address, token_id: uint256, staking_addr: address, pool_method_id: bytes4): """ @notice Claim the staking rewards. @dev Claims the staking rewards. @param wallet The address of the wallet to receive the staking rewards. @param token_id The id of the NFT supporting the claim, which must be deposited in the vault. @param staking_addr The address of the staking contract. @param pool_method_id The method id of the staking pool claim function. """ assert msg.sender == self.caller, "not caller" self._staking_claim(wallet, token_id, staking_addr, pool_method_id) @external def staking_compound(token_id: uint256, staking_addr: address, pool_claim_method_id: bytes4, pool_deposit_method_id: bytes4): """ @notice Compound the staking rewards. @dev Compounds the staking rewards by claiming and depositing them. No validations are performed regarding staking limits or minimal deposit amounts. @param token_id The id of the NFT supporting the compound, which must be deposited in the vault. @param staking_addr The address of the staking contract. @param pool_claim_method_id The method id of the staking pool claim function. @param pool_deposit_method_id The method id of the staking pool deposit function. """ assert msg.sender == self.caller, "not caller" self._staking_claim(self, token_id, staking_addr, pool_claim_method_id) self._staking_deposit(self, payment_token.balanceOf(self), token_id, staking_addr, pool_deposit_method_id) @view @external def onERC721Received(_operator: address, _from: address, _tokenId: uint256, _data: Bytes[1024]) -> bytes4: """ @notice ERC721 token receiver callback. @dev Returns the ERC721 receiver callback selector. @param _operator The address which called `safeTransferFrom` function. @param _from The address which previously owned the token. @param _tokenId The NFT identifier which is being transferred. @param _data Additional data with no specified format. @return The ERC721 receiver callback selector. """ return method_id("onERC721Received(address,address,uint256,bytes)", output_type=bytes4) @internal def _delegate_to_wallet(delegate: address, expiration: uint256): if delegation_registry.getHotWallet(self) == delegate: delegation_registry.setExpirationTimestamp(expiration) else: delegation_registry.setHotWallet(delegate, expiration, False) @internal def _staking_deposit(wallet: address, amount: uint256, token_id: uint256, staking_addr: address, pool_method_id: bytes4): payment_token.approve(staking_addr, amount) nfts: DynArray[SingleNft, 1] = [SingleNft({tokenId: convert(token_id, uint32), amount: convert(amount, uint224)})] raw_call(staking_addr, concat(pool_method_id, _abi_encode(nfts))) @internal def _staking_withdraw(wallet: address, amount: uint256, token_id: uint256, staking_addr: address, pool_method_id: bytes4): nfts: DynArray[SingleNft, 1] = [SingleNft({tokenId: convert(token_id, uint32), amount: convert(amount, uint224)})] raw_call(staking_addr, concat(pool_method_id, _abi_encode(nfts, wallet))) @internal def _staking_claim(wallet: address, token_id: uint256, staking_addr: address, pool_method_id: bytes4): nfts: DynArray[uint256, 1] = [token_id] raw_call(staking_addr, concat(pool_method_id, _abi_encode(nfts, wallet)))
1
20,290,582
72a99cec2a1da848b58d61b72cf9c9c6e78ab21f9b72d93a875c64af9d74e30d
3e31ae905d1b84575dcf9589093a539d4a90a7c2433e4fea0fee06270baf0fbb
e47f7e1b492fbd8771e8fb3609d1a1afed450072
53ea4448df8bf44a5c8285dcca7d4ac2baae0079
87d67cd21d92630874ab9784d760d529623a763c
602d3d8160093d39f3363d3d373d3d3d363d73ce52b9142ab2d0d754ad439cdff2cf14f98423455af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73ce52b9142ab2d0d754ad439cdff2cf14f98423455af43d82803e903d91602b57fd5bf3
# @version 0.3.10 """ @title Zharta Renting Vault Contract @author [Zharta](https://zharta.io/) @notice This contract is the vault implementation for the LOTM Renting Protocol. @dev This is the implementation contract for each vault, which is deployed as a minimal proxy (ERC1167) by `RentingV3.vy` and accepts only calls from it. This contract holds the assets (NFTs) ) but does not store any information regarding the token, so pre-conditions must be validated by the caller (`RentingV3.vy`). It implement the functions required for token delegation and staking. Delegations are performed by warm.xyz HotWalletProxy. """ # Interfaces from vyper.interfaces import ERC20 as IERC20 from vyper.interfaces import ERC721 as IERC721 interface IDelegationRegistry: def getHotWallet(cold_wallet: address) -> address: view def setHotWallet(hot_wallet_address: address, expiration_timestamp: uint256, lock_hot_wallet_address: bool): nonpayable def setExpirationTimestamp(expiration_timestamp: uint256): nonpayable # Structs struct SingleNft: tokenId: uint32 amount: uint224 # Global Variables caller: public(address) payment_token: public(immutable(IERC20)) nft_contract: public(immutable(IERC721)) delegation_registry: public(immutable(IDelegationRegistry)) ##### EXTERNAL METHODS - WRITE ##### @payable @external def __init__( _payment_token_addr: address, _nft_contract_addr: address, _delegation_registry_addr: address, ): """ @dev Sets up the contract by initializing the payment token, NFT contract, delegation registry and staking contract addresses. @param _payment_token_addr The address of the payment token contract. @param _nft_contract_addr The address of the NFT contract. @param _delegation_registry_addr The address of the delegation registry contract. """ assert _payment_token_addr != empty(address), "payment token addr not set" assert _nft_contract_addr != empty(address), "nft contract addr not set" assert _delegation_registry_addr != empty(address), "delegation addr not set" payment_token = IERC20(_payment_token_addr) nft_contract = IERC721(_nft_contract_addr) delegation_registry = IDelegationRegistry(_delegation_registry_addr) # Functions @external def initialise(): """ @notice Initialize a vault contract, setting the caller as the contract deployer. @dev Ensures that the vault is not already initialized. """ assert self.caller == empty(address), "already initialised" self.caller = msg.sender @external def deposit(token_id: uint256, nft_owner: address, delegate: address): """ @notice Deposit an NFT into the vault and optionaly sets up delegation. @dev Transfers the NFT from the owner to the vault and optionally sets up delegation. @param token_id The id of the NFT to be deposited. @param nft_owner The address of the NFT owner. @param delegate The address to delegate the NFT to. If empty no delegation is done. """ assert msg.sender == self.caller, "not caller" nft_contract.safeTransferFrom(nft_owner, self, token_id, b"") if delegate != empty(address): self._delegate_to_wallet(delegate, max_value(uint256)) @external def withdraw(token_id: uint256, wallet: address): """ @notice Withdraw an NFT from the vault and transfer it to the wallet. @dev Transfers the NFT from the vault to the wallet and clears the delegation. @param token_id The id of the NFT to be withdrawn. @param wallet The address of the wallet to receive the NFT. """ assert msg.sender == self.caller, "not caller" nft_contract.safeTransferFrom(self, wallet, token_id, b"") self._delegate_to_wallet(empty(address), 0) @external def delegate_to_wallet(delegate: address, expiration: uint256): """ @notice Delegate the NFT to a wallet. @dev Delegates the NFT to the given address. @param delegate The address to delegate the NFT to. @param expiration The expiration timestamp for the delegation. """ assert msg.sender == self.caller, "not caller" self._delegate_to_wallet(delegate, expiration) @external def staking_deposit(sender: address, amount: uint256, token_id: uint256, staking_addr: address, pool_method_id: bytes4): """ @notice Deposit the payment token into the staking contract. @dev Deposits the payment token into the staking contract. @param sender The address of the payment token sender. @param amount The amount of the payment token to deposit. @param token_id The id of the NFT supporting the deposit, which must be deposited in the vault. @param staking_addr The address of the staking contract. @param pool_method_id The method id of the staking pool deposit function. """ assert msg.sender == self.caller, "not caller" self._staking_deposit(sender, amount, token_id, staking_addr, pool_method_id) @external def staking_withdraw(wallet: address, amount: uint256, token_id: uint256, staking_addr: address, pool_method_id: bytes4): """ @notice Withdraw the payment token from the staking contract. @dev Withdraws the payment token from the staking contract. @param wallet The address of the wallet to receive the payment token. @param amount The amount of the payment token to withdraw. @param token_id The id of the NFT supporting the withdrawal, which must be deposited in the vault. @param staking_addr The address of the staking contract. @param pool_method_id The method id of the staking pool withdraw function. """ assert msg.sender == self.caller, "not caller" self._staking_withdraw(wallet, amount, token_id, staking_addr, pool_method_id) @external def staking_claim(wallet: address, token_id: uint256, staking_addr: address, pool_method_id: bytes4): """ @notice Claim the staking rewards. @dev Claims the staking rewards. @param wallet The address of the wallet to receive the staking rewards. @param token_id The id of the NFT supporting the claim, which must be deposited in the vault. @param staking_addr The address of the staking contract. @param pool_method_id The method id of the staking pool claim function. """ assert msg.sender == self.caller, "not caller" self._staking_claim(wallet, token_id, staking_addr, pool_method_id) @external def staking_compound(token_id: uint256, staking_addr: address, pool_claim_method_id: bytes4, pool_deposit_method_id: bytes4): """ @notice Compound the staking rewards. @dev Compounds the staking rewards by claiming and depositing them. No validations are performed regarding staking limits or minimal deposit amounts. @param token_id The id of the NFT supporting the compound, which must be deposited in the vault. @param staking_addr The address of the staking contract. @param pool_claim_method_id The method id of the staking pool claim function. @param pool_deposit_method_id The method id of the staking pool deposit function. """ assert msg.sender == self.caller, "not caller" self._staking_claim(self, token_id, staking_addr, pool_claim_method_id) self._staking_deposit(self, payment_token.balanceOf(self), token_id, staking_addr, pool_deposit_method_id) @view @external def onERC721Received(_operator: address, _from: address, _tokenId: uint256, _data: Bytes[1024]) -> bytes4: """ @notice ERC721 token receiver callback. @dev Returns the ERC721 receiver callback selector. @param _operator The address which called `safeTransferFrom` function. @param _from The address which previously owned the token. @param _tokenId The NFT identifier which is being transferred. @param _data Additional data with no specified format. @return The ERC721 receiver callback selector. """ return method_id("onERC721Received(address,address,uint256,bytes)", output_type=bytes4) @internal def _delegate_to_wallet(delegate: address, expiration: uint256): if delegation_registry.getHotWallet(self) == delegate: delegation_registry.setExpirationTimestamp(expiration) else: delegation_registry.setHotWallet(delegate, expiration, False) @internal def _staking_deposit(wallet: address, amount: uint256, token_id: uint256, staking_addr: address, pool_method_id: bytes4): payment_token.approve(staking_addr, amount) nfts: DynArray[SingleNft, 1] = [SingleNft({tokenId: convert(token_id, uint32), amount: convert(amount, uint224)})] raw_call(staking_addr, concat(pool_method_id, _abi_encode(nfts))) @internal def _staking_withdraw(wallet: address, amount: uint256, token_id: uint256, staking_addr: address, pool_method_id: bytes4): nfts: DynArray[SingleNft, 1] = [SingleNft({tokenId: convert(token_id, uint32), amount: convert(amount, uint224)})] raw_call(staking_addr, concat(pool_method_id, _abi_encode(nfts, wallet))) @internal def _staking_claim(wallet: address, token_id: uint256, staking_addr: address, pool_method_id: bytes4): nfts: DynArray[uint256, 1] = [token_id] raw_call(staking_addr, concat(pool_method_id, _abi_encode(nfts, wallet)))
1
20,290,582
72a99cec2a1da848b58d61b72cf9c9c6e78ab21f9b72d93a875c64af9d74e30d
3e31ae905d1b84575dcf9589093a539d4a90a7c2433e4fea0fee06270baf0fbb
e47f7e1b492fbd8771e8fb3609d1a1afed450072
53ea4448df8bf44a5c8285dcca7d4ac2baae0079
d1fd0c9df49d56fed417bb2b740fba07e35e940f
602d3d8160093d39f3363d3d373d3d3d363d73ce52b9142ab2d0d754ad439cdff2cf14f98423455af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73ce52b9142ab2d0d754ad439cdff2cf14f98423455af43d82803e903d91602b57fd5bf3
# @version 0.3.10 """ @title Zharta Renting Vault Contract @author [Zharta](https://zharta.io/) @notice This contract is the vault implementation for the LOTM Renting Protocol. @dev This is the implementation contract for each vault, which is deployed as a minimal proxy (ERC1167) by `RentingV3.vy` and accepts only calls from it. This contract holds the assets (NFTs) ) but does not store any information regarding the token, so pre-conditions must be validated by the caller (`RentingV3.vy`). It implement the functions required for token delegation and staking. Delegations are performed by warm.xyz HotWalletProxy. """ # Interfaces from vyper.interfaces import ERC20 as IERC20 from vyper.interfaces import ERC721 as IERC721 interface IDelegationRegistry: def getHotWallet(cold_wallet: address) -> address: view def setHotWallet(hot_wallet_address: address, expiration_timestamp: uint256, lock_hot_wallet_address: bool): nonpayable def setExpirationTimestamp(expiration_timestamp: uint256): nonpayable # Structs struct SingleNft: tokenId: uint32 amount: uint224 # Global Variables caller: public(address) payment_token: public(immutable(IERC20)) nft_contract: public(immutable(IERC721)) delegation_registry: public(immutable(IDelegationRegistry)) ##### EXTERNAL METHODS - WRITE ##### @payable @external def __init__( _payment_token_addr: address, _nft_contract_addr: address, _delegation_registry_addr: address, ): """ @dev Sets up the contract by initializing the payment token, NFT contract, delegation registry and staking contract addresses. @param _payment_token_addr The address of the payment token contract. @param _nft_contract_addr The address of the NFT contract. @param _delegation_registry_addr The address of the delegation registry contract. """ assert _payment_token_addr != empty(address), "payment token addr not set" assert _nft_contract_addr != empty(address), "nft contract addr not set" assert _delegation_registry_addr != empty(address), "delegation addr not set" payment_token = IERC20(_payment_token_addr) nft_contract = IERC721(_nft_contract_addr) delegation_registry = IDelegationRegistry(_delegation_registry_addr) # Functions @external def initialise(): """ @notice Initialize a vault contract, setting the caller as the contract deployer. @dev Ensures that the vault is not already initialized. """ assert self.caller == empty(address), "already initialised" self.caller = msg.sender @external def deposit(token_id: uint256, nft_owner: address, delegate: address): """ @notice Deposit an NFT into the vault and optionaly sets up delegation. @dev Transfers the NFT from the owner to the vault and optionally sets up delegation. @param token_id The id of the NFT to be deposited. @param nft_owner The address of the NFT owner. @param delegate The address to delegate the NFT to. If empty no delegation is done. """ assert msg.sender == self.caller, "not caller" nft_contract.safeTransferFrom(nft_owner, self, token_id, b"") if delegate != empty(address): self._delegate_to_wallet(delegate, max_value(uint256)) @external def withdraw(token_id: uint256, wallet: address): """ @notice Withdraw an NFT from the vault and transfer it to the wallet. @dev Transfers the NFT from the vault to the wallet and clears the delegation. @param token_id The id of the NFT to be withdrawn. @param wallet The address of the wallet to receive the NFT. """ assert msg.sender == self.caller, "not caller" nft_contract.safeTransferFrom(self, wallet, token_id, b"") self._delegate_to_wallet(empty(address), 0) @external def delegate_to_wallet(delegate: address, expiration: uint256): """ @notice Delegate the NFT to a wallet. @dev Delegates the NFT to the given address. @param delegate The address to delegate the NFT to. @param expiration The expiration timestamp for the delegation. """ assert msg.sender == self.caller, "not caller" self._delegate_to_wallet(delegate, expiration) @external def staking_deposit(sender: address, amount: uint256, token_id: uint256, staking_addr: address, pool_method_id: bytes4): """ @notice Deposit the payment token into the staking contract. @dev Deposits the payment token into the staking contract. @param sender The address of the payment token sender. @param amount The amount of the payment token to deposit. @param token_id The id of the NFT supporting the deposit, which must be deposited in the vault. @param staking_addr The address of the staking contract. @param pool_method_id The method id of the staking pool deposit function. """ assert msg.sender == self.caller, "not caller" self._staking_deposit(sender, amount, token_id, staking_addr, pool_method_id) @external def staking_withdraw(wallet: address, amount: uint256, token_id: uint256, staking_addr: address, pool_method_id: bytes4): """ @notice Withdraw the payment token from the staking contract. @dev Withdraws the payment token from the staking contract. @param wallet The address of the wallet to receive the payment token. @param amount The amount of the payment token to withdraw. @param token_id The id of the NFT supporting the withdrawal, which must be deposited in the vault. @param staking_addr The address of the staking contract. @param pool_method_id The method id of the staking pool withdraw function. """ assert msg.sender == self.caller, "not caller" self._staking_withdraw(wallet, amount, token_id, staking_addr, pool_method_id) @external def staking_claim(wallet: address, token_id: uint256, staking_addr: address, pool_method_id: bytes4): """ @notice Claim the staking rewards. @dev Claims the staking rewards. @param wallet The address of the wallet to receive the staking rewards. @param token_id The id of the NFT supporting the claim, which must be deposited in the vault. @param staking_addr The address of the staking contract. @param pool_method_id The method id of the staking pool claim function. """ assert msg.sender == self.caller, "not caller" self._staking_claim(wallet, token_id, staking_addr, pool_method_id) @external def staking_compound(token_id: uint256, staking_addr: address, pool_claim_method_id: bytes4, pool_deposit_method_id: bytes4): """ @notice Compound the staking rewards. @dev Compounds the staking rewards by claiming and depositing them. No validations are performed regarding staking limits or minimal deposit amounts. @param token_id The id of the NFT supporting the compound, which must be deposited in the vault. @param staking_addr The address of the staking contract. @param pool_claim_method_id The method id of the staking pool claim function. @param pool_deposit_method_id The method id of the staking pool deposit function. """ assert msg.sender == self.caller, "not caller" self._staking_claim(self, token_id, staking_addr, pool_claim_method_id) self._staking_deposit(self, payment_token.balanceOf(self), token_id, staking_addr, pool_deposit_method_id) @view @external def onERC721Received(_operator: address, _from: address, _tokenId: uint256, _data: Bytes[1024]) -> bytes4: """ @notice ERC721 token receiver callback. @dev Returns the ERC721 receiver callback selector. @param _operator The address which called `safeTransferFrom` function. @param _from The address which previously owned the token. @param _tokenId The NFT identifier which is being transferred. @param _data Additional data with no specified format. @return The ERC721 receiver callback selector. """ return method_id("onERC721Received(address,address,uint256,bytes)", output_type=bytes4) @internal def _delegate_to_wallet(delegate: address, expiration: uint256): if delegation_registry.getHotWallet(self) == delegate: delegation_registry.setExpirationTimestamp(expiration) else: delegation_registry.setHotWallet(delegate, expiration, False) @internal def _staking_deposit(wallet: address, amount: uint256, token_id: uint256, staking_addr: address, pool_method_id: bytes4): payment_token.approve(staking_addr, amount) nfts: DynArray[SingleNft, 1] = [SingleNft({tokenId: convert(token_id, uint32), amount: convert(amount, uint224)})] raw_call(staking_addr, concat(pool_method_id, _abi_encode(nfts))) @internal def _staking_withdraw(wallet: address, amount: uint256, token_id: uint256, staking_addr: address, pool_method_id: bytes4): nfts: DynArray[SingleNft, 1] = [SingleNft({tokenId: convert(token_id, uint32), amount: convert(amount, uint224)})] raw_call(staking_addr, concat(pool_method_id, _abi_encode(nfts, wallet))) @internal def _staking_claim(wallet: address, token_id: uint256, staking_addr: address, pool_method_id: bytes4): nfts: DynArray[uint256, 1] = [token_id] raw_call(staking_addr, concat(pool_method_id, _abi_encode(nfts, wallet)))
1
20,290,582
72a99cec2a1da848b58d61b72cf9c9c6e78ab21f9b72d93a875c64af9d74e30d
3e31ae905d1b84575dcf9589093a539d4a90a7c2433e4fea0fee06270baf0fbb
e47f7e1b492fbd8771e8fb3609d1a1afed450072
53ea4448df8bf44a5c8285dcca7d4ac2baae0079
ecfd6be511749517650f77a31804fc2550bf1a6c
602d3d8160093d39f3363d3d373d3d3d363d73ce52b9142ab2d0d754ad439cdff2cf14f98423455af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73ce52b9142ab2d0d754ad439cdff2cf14f98423455af43d82803e903d91602b57fd5bf3
# @version 0.3.10 """ @title Zharta Renting Vault Contract @author [Zharta](https://zharta.io/) @notice This contract is the vault implementation for the LOTM Renting Protocol. @dev This is the implementation contract for each vault, which is deployed as a minimal proxy (ERC1167) by `RentingV3.vy` and accepts only calls from it. This contract holds the assets (NFTs) ) but does not store any information regarding the token, so pre-conditions must be validated by the caller (`RentingV3.vy`). It implement the functions required for token delegation and staking. Delegations are performed by warm.xyz HotWalletProxy. """ # Interfaces from vyper.interfaces import ERC20 as IERC20 from vyper.interfaces import ERC721 as IERC721 interface IDelegationRegistry: def getHotWallet(cold_wallet: address) -> address: view def setHotWallet(hot_wallet_address: address, expiration_timestamp: uint256, lock_hot_wallet_address: bool): nonpayable def setExpirationTimestamp(expiration_timestamp: uint256): nonpayable # Structs struct SingleNft: tokenId: uint32 amount: uint224 # Global Variables caller: public(address) payment_token: public(immutable(IERC20)) nft_contract: public(immutable(IERC721)) delegation_registry: public(immutable(IDelegationRegistry)) ##### EXTERNAL METHODS - WRITE ##### @payable @external def __init__( _payment_token_addr: address, _nft_contract_addr: address, _delegation_registry_addr: address, ): """ @dev Sets up the contract by initializing the payment token, NFT contract, delegation registry and staking contract addresses. @param _payment_token_addr The address of the payment token contract. @param _nft_contract_addr The address of the NFT contract. @param _delegation_registry_addr The address of the delegation registry contract. """ assert _payment_token_addr != empty(address), "payment token addr not set" assert _nft_contract_addr != empty(address), "nft contract addr not set" assert _delegation_registry_addr != empty(address), "delegation addr not set" payment_token = IERC20(_payment_token_addr) nft_contract = IERC721(_nft_contract_addr) delegation_registry = IDelegationRegistry(_delegation_registry_addr) # Functions @external def initialise(): """ @notice Initialize a vault contract, setting the caller as the contract deployer. @dev Ensures that the vault is not already initialized. """ assert self.caller == empty(address), "already initialised" self.caller = msg.sender @external def deposit(token_id: uint256, nft_owner: address, delegate: address): """ @notice Deposit an NFT into the vault and optionaly sets up delegation. @dev Transfers the NFT from the owner to the vault and optionally sets up delegation. @param token_id The id of the NFT to be deposited. @param nft_owner The address of the NFT owner. @param delegate The address to delegate the NFT to. If empty no delegation is done. """ assert msg.sender == self.caller, "not caller" nft_contract.safeTransferFrom(nft_owner, self, token_id, b"") if delegate != empty(address): self._delegate_to_wallet(delegate, max_value(uint256)) @external def withdraw(token_id: uint256, wallet: address): """ @notice Withdraw an NFT from the vault and transfer it to the wallet. @dev Transfers the NFT from the vault to the wallet and clears the delegation. @param token_id The id of the NFT to be withdrawn. @param wallet The address of the wallet to receive the NFT. """ assert msg.sender == self.caller, "not caller" nft_contract.safeTransferFrom(self, wallet, token_id, b"") self._delegate_to_wallet(empty(address), 0) @external def delegate_to_wallet(delegate: address, expiration: uint256): """ @notice Delegate the NFT to a wallet. @dev Delegates the NFT to the given address. @param delegate The address to delegate the NFT to. @param expiration The expiration timestamp for the delegation. """ assert msg.sender == self.caller, "not caller" self._delegate_to_wallet(delegate, expiration) @external def staking_deposit(sender: address, amount: uint256, token_id: uint256, staking_addr: address, pool_method_id: bytes4): """ @notice Deposit the payment token into the staking contract. @dev Deposits the payment token into the staking contract. @param sender The address of the payment token sender. @param amount The amount of the payment token to deposit. @param token_id The id of the NFT supporting the deposit, which must be deposited in the vault. @param staking_addr The address of the staking contract. @param pool_method_id The method id of the staking pool deposit function. """ assert msg.sender == self.caller, "not caller" self._staking_deposit(sender, amount, token_id, staking_addr, pool_method_id) @external def staking_withdraw(wallet: address, amount: uint256, token_id: uint256, staking_addr: address, pool_method_id: bytes4): """ @notice Withdraw the payment token from the staking contract. @dev Withdraws the payment token from the staking contract. @param wallet The address of the wallet to receive the payment token. @param amount The amount of the payment token to withdraw. @param token_id The id of the NFT supporting the withdrawal, which must be deposited in the vault. @param staking_addr The address of the staking contract. @param pool_method_id The method id of the staking pool withdraw function. """ assert msg.sender == self.caller, "not caller" self._staking_withdraw(wallet, amount, token_id, staking_addr, pool_method_id) @external def staking_claim(wallet: address, token_id: uint256, staking_addr: address, pool_method_id: bytes4): """ @notice Claim the staking rewards. @dev Claims the staking rewards. @param wallet The address of the wallet to receive the staking rewards. @param token_id The id of the NFT supporting the claim, which must be deposited in the vault. @param staking_addr The address of the staking contract. @param pool_method_id The method id of the staking pool claim function. """ assert msg.sender == self.caller, "not caller" self._staking_claim(wallet, token_id, staking_addr, pool_method_id) @external def staking_compound(token_id: uint256, staking_addr: address, pool_claim_method_id: bytes4, pool_deposit_method_id: bytes4): """ @notice Compound the staking rewards. @dev Compounds the staking rewards by claiming and depositing them. No validations are performed regarding staking limits or minimal deposit amounts. @param token_id The id of the NFT supporting the compound, which must be deposited in the vault. @param staking_addr The address of the staking contract. @param pool_claim_method_id The method id of the staking pool claim function. @param pool_deposit_method_id The method id of the staking pool deposit function. """ assert msg.sender == self.caller, "not caller" self._staking_claim(self, token_id, staking_addr, pool_claim_method_id) self._staking_deposit(self, payment_token.balanceOf(self), token_id, staking_addr, pool_deposit_method_id) @view @external def onERC721Received(_operator: address, _from: address, _tokenId: uint256, _data: Bytes[1024]) -> bytes4: """ @notice ERC721 token receiver callback. @dev Returns the ERC721 receiver callback selector. @param _operator The address which called `safeTransferFrom` function. @param _from The address which previously owned the token. @param _tokenId The NFT identifier which is being transferred. @param _data Additional data with no specified format. @return The ERC721 receiver callback selector. """ return method_id("onERC721Received(address,address,uint256,bytes)", output_type=bytes4) @internal def _delegate_to_wallet(delegate: address, expiration: uint256): if delegation_registry.getHotWallet(self) == delegate: delegation_registry.setExpirationTimestamp(expiration) else: delegation_registry.setHotWallet(delegate, expiration, False) @internal def _staking_deposit(wallet: address, amount: uint256, token_id: uint256, staking_addr: address, pool_method_id: bytes4): payment_token.approve(staking_addr, amount) nfts: DynArray[SingleNft, 1] = [SingleNft({tokenId: convert(token_id, uint32), amount: convert(amount, uint224)})] raw_call(staking_addr, concat(pool_method_id, _abi_encode(nfts))) @internal def _staking_withdraw(wallet: address, amount: uint256, token_id: uint256, staking_addr: address, pool_method_id: bytes4): nfts: DynArray[SingleNft, 1] = [SingleNft({tokenId: convert(token_id, uint32), amount: convert(amount, uint224)})] raw_call(staking_addr, concat(pool_method_id, _abi_encode(nfts, wallet))) @internal def _staking_claim(wallet: address, token_id: uint256, staking_addr: address, pool_method_id: bytes4): nfts: DynArray[uint256, 1] = [token_id] raw_call(staking_addr, concat(pool_method_id, _abi_encode(nfts, wallet)))
1
20,290,582
72a99cec2a1da848b58d61b72cf9c9c6e78ab21f9b72d93a875c64af9d74e30d
3e31ae905d1b84575dcf9589093a539d4a90a7c2433e4fea0fee06270baf0fbb
e47f7e1b492fbd8771e8fb3609d1a1afed450072
53ea4448df8bf44a5c8285dcca7d4ac2baae0079
449b572da7c01045e83594336593468b177d8177
602d3d8160093d39f3363d3d373d3d3d363d73ce52b9142ab2d0d754ad439cdff2cf14f98423455af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73ce52b9142ab2d0d754ad439cdff2cf14f98423455af43d82803e903d91602b57fd5bf3
# @version 0.3.10 """ @title Zharta Renting Vault Contract @author [Zharta](https://zharta.io/) @notice This contract is the vault implementation for the LOTM Renting Protocol. @dev This is the implementation contract for each vault, which is deployed as a minimal proxy (ERC1167) by `RentingV3.vy` and accepts only calls from it. This contract holds the assets (NFTs) ) but does not store any information regarding the token, so pre-conditions must be validated by the caller (`RentingV3.vy`). It implement the functions required for token delegation and staking. Delegations are performed by warm.xyz HotWalletProxy. """ # Interfaces from vyper.interfaces import ERC20 as IERC20 from vyper.interfaces import ERC721 as IERC721 interface IDelegationRegistry: def getHotWallet(cold_wallet: address) -> address: view def setHotWallet(hot_wallet_address: address, expiration_timestamp: uint256, lock_hot_wallet_address: bool): nonpayable def setExpirationTimestamp(expiration_timestamp: uint256): nonpayable # Structs struct SingleNft: tokenId: uint32 amount: uint224 # Global Variables caller: public(address) payment_token: public(immutable(IERC20)) nft_contract: public(immutable(IERC721)) delegation_registry: public(immutable(IDelegationRegistry)) ##### EXTERNAL METHODS - WRITE ##### @payable @external def __init__( _payment_token_addr: address, _nft_contract_addr: address, _delegation_registry_addr: address, ): """ @dev Sets up the contract by initializing the payment token, NFT contract, delegation registry and staking contract addresses. @param _payment_token_addr The address of the payment token contract. @param _nft_contract_addr The address of the NFT contract. @param _delegation_registry_addr The address of the delegation registry contract. """ assert _payment_token_addr != empty(address), "payment token addr not set" assert _nft_contract_addr != empty(address), "nft contract addr not set" assert _delegation_registry_addr != empty(address), "delegation addr not set" payment_token = IERC20(_payment_token_addr) nft_contract = IERC721(_nft_contract_addr) delegation_registry = IDelegationRegistry(_delegation_registry_addr) # Functions @external def initialise(): """ @notice Initialize a vault contract, setting the caller as the contract deployer. @dev Ensures that the vault is not already initialized. """ assert self.caller == empty(address), "already initialised" self.caller = msg.sender @external def deposit(token_id: uint256, nft_owner: address, delegate: address): """ @notice Deposit an NFT into the vault and optionaly sets up delegation. @dev Transfers the NFT from the owner to the vault and optionally sets up delegation. @param token_id The id of the NFT to be deposited. @param nft_owner The address of the NFT owner. @param delegate The address to delegate the NFT to. If empty no delegation is done. """ assert msg.sender == self.caller, "not caller" nft_contract.safeTransferFrom(nft_owner, self, token_id, b"") if delegate != empty(address): self._delegate_to_wallet(delegate, max_value(uint256)) @external def withdraw(token_id: uint256, wallet: address): """ @notice Withdraw an NFT from the vault and transfer it to the wallet. @dev Transfers the NFT from the vault to the wallet and clears the delegation. @param token_id The id of the NFT to be withdrawn. @param wallet The address of the wallet to receive the NFT. """ assert msg.sender == self.caller, "not caller" nft_contract.safeTransferFrom(self, wallet, token_id, b"") self._delegate_to_wallet(empty(address), 0) @external def delegate_to_wallet(delegate: address, expiration: uint256): """ @notice Delegate the NFT to a wallet. @dev Delegates the NFT to the given address. @param delegate The address to delegate the NFT to. @param expiration The expiration timestamp for the delegation. """ assert msg.sender == self.caller, "not caller" self._delegate_to_wallet(delegate, expiration) @external def staking_deposit(sender: address, amount: uint256, token_id: uint256, staking_addr: address, pool_method_id: bytes4): """ @notice Deposit the payment token into the staking contract. @dev Deposits the payment token into the staking contract. @param sender The address of the payment token sender. @param amount The amount of the payment token to deposit. @param token_id The id of the NFT supporting the deposit, which must be deposited in the vault. @param staking_addr The address of the staking contract. @param pool_method_id The method id of the staking pool deposit function. """ assert msg.sender == self.caller, "not caller" self._staking_deposit(sender, amount, token_id, staking_addr, pool_method_id) @external def staking_withdraw(wallet: address, amount: uint256, token_id: uint256, staking_addr: address, pool_method_id: bytes4): """ @notice Withdraw the payment token from the staking contract. @dev Withdraws the payment token from the staking contract. @param wallet The address of the wallet to receive the payment token. @param amount The amount of the payment token to withdraw. @param token_id The id of the NFT supporting the withdrawal, which must be deposited in the vault. @param staking_addr The address of the staking contract. @param pool_method_id The method id of the staking pool withdraw function. """ assert msg.sender == self.caller, "not caller" self._staking_withdraw(wallet, amount, token_id, staking_addr, pool_method_id) @external def staking_claim(wallet: address, token_id: uint256, staking_addr: address, pool_method_id: bytes4): """ @notice Claim the staking rewards. @dev Claims the staking rewards. @param wallet The address of the wallet to receive the staking rewards. @param token_id The id of the NFT supporting the claim, which must be deposited in the vault. @param staking_addr The address of the staking contract. @param pool_method_id The method id of the staking pool claim function. """ assert msg.sender == self.caller, "not caller" self._staking_claim(wallet, token_id, staking_addr, pool_method_id) @external def staking_compound(token_id: uint256, staking_addr: address, pool_claim_method_id: bytes4, pool_deposit_method_id: bytes4): """ @notice Compound the staking rewards. @dev Compounds the staking rewards by claiming and depositing them. No validations are performed regarding staking limits or minimal deposit amounts. @param token_id The id of the NFT supporting the compound, which must be deposited in the vault. @param staking_addr The address of the staking contract. @param pool_claim_method_id The method id of the staking pool claim function. @param pool_deposit_method_id The method id of the staking pool deposit function. """ assert msg.sender == self.caller, "not caller" self._staking_claim(self, token_id, staking_addr, pool_claim_method_id) self._staking_deposit(self, payment_token.balanceOf(self), token_id, staking_addr, pool_deposit_method_id) @view @external def onERC721Received(_operator: address, _from: address, _tokenId: uint256, _data: Bytes[1024]) -> bytes4: """ @notice ERC721 token receiver callback. @dev Returns the ERC721 receiver callback selector. @param _operator The address which called `safeTransferFrom` function. @param _from The address which previously owned the token. @param _tokenId The NFT identifier which is being transferred. @param _data Additional data with no specified format. @return The ERC721 receiver callback selector. """ return method_id("onERC721Received(address,address,uint256,bytes)", output_type=bytes4) @internal def _delegate_to_wallet(delegate: address, expiration: uint256): if delegation_registry.getHotWallet(self) == delegate: delegation_registry.setExpirationTimestamp(expiration) else: delegation_registry.setHotWallet(delegate, expiration, False) @internal def _staking_deposit(wallet: address, amount: uint256, token_id: uint256, staking_addr: address, pool_method_id: bytes4): payment_token.approve(staking_addr, amount) nfts: DynArray[SingleNft, 1] = [SingleNft({tokenId: convert(token_id, uint32), amount: convert(amount, uint224)})] raw_call(staking_addr, concat(pool_method_id, _abi_encode(nfts))) @internal def _staking_withdraw(wallet: address, amount: uint256, token_id: uint256, staking_addr: address, pool_method_id: bytes4): nfts: DynArray[SingleNft, 1] = [SingleNft({tokenId: convert(token_id, uint32), amount: convert(amount, uint224)})] raw_call(staking_addr, concat(pool_method_id, _abi_encode(nfts, wallet))) @internal def _staking_claim(wallet: address, token_id: uint256, staking_addr: address, pool_method_id: bytes4): nfts: DynArray[uint256, 1] = [token_id] raw_call(staking_addr, concat(pool_method_id, _abi_encode(nfts, wallet)))
1
20,290,582
72a99cec2a1da848b58d61b72cf9c9c6e78ab21f9b72d93a875c64af9d74e30d
93826bea0443460877adaede31068fdf9336238fd19048aff3657dac047c8dd6
00bdb5699745f5b860228c8f939abf1b9ae374ed
ffa397285ce46fb78c588a9e993286aac68c37cd
a57110342176a8fa10d956aca85ac290927b6aa2
3d602d80600a3d3981f3363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3
pragma solidity 0.7.5; /* The MIT License (MIT) Copyright (c) 2018 Murray Software, LLC. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //solhint-disable max-line-length //solhint-disable no-inline-assembly contract CloneFactory { function createClone(address target, bytes32 salt) internal returns (address payable result) { bytes20 targetBytes = bytes20(target); assembly { // load the next free memory slot as a place to store the clone contract data let clone := mload(0x40) // The bytecode block below is responsible for contract initialization // during deployment, it is worth noting the proxied contract constructor will not be called during // the cloning procedure and that is why an initialization function needs to be called after the // clone is created mstore( clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000 ) // This stores the address location of the implementation contract // so that the proxy knows where to delegate call logic to mstore(add(clone, 0x14), targetBytes) // The bytecode block is the actual code that is deployed for each clone created. // It forwards all calls to the already deployed implementation via a delegatecall mstore( add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000 ) // deploy the contract using the CREATE2 opcode // this deploys the minimal proxy defined above, which will proxy all // calls to use the logic defined in the implementation contract `target` result := create2(0, clone, 0x37, salt) } } function isClone(address target, address query) internal view returns (bool result) { bytes20 targetBytes = bytes20(target); assembly { // load the next free memory slot as a place to store the comparison clone let clone := mload(0x40) // The next three lines store the expected bytecode for a miniml proxy // that targets `target` as its implementation contract mstore( clone, 0x363d3d373d3d3d363d7300000000000000000000000000000000000000000000 ) mstore(add(clone, 0xa), targetBytes) mstore( add(clone, 0x1e), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000 ) // the next two lines store the bytecode of the contract that we are checking in memory let other := add(clone, 0x40) extcodecopy(query, other, 0, 0x2d) // Check if the expected bytecode equals the actual bytecode and return the result result := and( eq(mload(clone), mload(other)), eq(mload(add(clone, 0xd)), mload(add(other, 0xd))) ) } } } /** * Contract that exposes the needed erc20 token functions */ abstract contract ERC20Interface { // Send _value amount of tokens to address _to function transfer(address _to, uint256 _value) public virtual returns (bool success); // Get the account balance of another account with address _owner function balanceOf(address _owner) public virtual view returns (uint256 balance); } // helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false library TransferHelper { function safeApprove( address token, address to, uint256 value ) internal { // bytes4(keccak256(bytes('approve(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::safeApprove: approve failed' ); } function safeTransfer( address token, address to, uint256 value ) internal { // bytes4(keccak256(bytes('transfer(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::safeTransfer: transfer failed' ); } function safeTransferFrom( address token, address from, address to, uint256 value ) internal { // bytes4(keccak256(bytes('transferFrom(address,address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::transferFrom: transferFrom failed' ); } function safeTransferETH(address to, uint256 value) internal { (bool success, ) = to.call{value: value}(new bytes(0)); require(success, 'TransferHelper::safeTransferETH: ETH transfer failed'); } } /** * Contract that will forward any incoming Ether to the creator of the contract * */ contract Forwarder { // Address to which any funds sent to this contract will be forwarded address public parentAddress; event ForwarderDeposited(address from, uint256 value, bytes data); /** * Initialize the contract, and sets the destination address to that of the creator */ function init(address _parentAddress) external onlyUninitialized { parentAddress = _parentAddress; uint256 value = address(this).balance; if (value == 0) { return; } (bool success, ) = parentAddress.call{ value: value }(''); require(success, 'Flush failed'); // NOTE: since we are forwarding on initialization, // we don't have the context of the original sender. // We still emit an event about the forwarding but set // the sender to the forwarder itself emit ForwarderDeposited(address(this), value, msg.data); } /** * Modifier that will execute internal code block only if the sender is the parent address */ modifier onlyParent { require(msg.sender == parentAddress, 'Only Parent'); _; } /** * Modifier that will execute internal code block only if the contract has not been initialized yet */ modifier onlyUninitialized { require(parentAddress == address(0x0), 'Already initialized'); _; } /** * Default function; Gets called when data is sent but does not match any other function */ fallback() external payable { flush(); } /** * Default function; Gets called when Ether is deposited with no data, and forwards it to the parent address */ receive() external payable { flush(); } /** * Execute a token transfer of the full balance from the forwarder token to the parent address * @param tokenContractAddress the address of the erc20 token contract */ function flushTokens(address tokenContractAddress) external onlyParent { ERC20Interface instance = ERC20Interface(tokenContractAddress); address forwarderAddress = address(this); uint256 forwarderBalance = instance.balanceOf(forwarderAddress); if (forwarderBalance == 0) { return; } TransferHelper.safeTransfer( tokenContractAddress, parentAddress, forwarderBalance ); } /** * Flush the entire balance of the contract to the parent address. */ function flush() public { uint256 value = address(this).balance; if (value == 0) { return; } (bool success, ) = parentAddress.call{ value: value }(''); require(success, 'Flush failed'); emit ForwarderDeposited(msg.sender, value, msg.data); } } contract ForwarderFactory is CloneFactory { address public implementationAddress; event ForwarderCreated(address newForwarderAddress, address parentAddress); constructor(address _implementationAddress) { implementationAddress = _implementationAddress; } function createForwarder(address parent, bytes32 salt) external { // include the signers in the salt so any contract deployed to a given address must have the same signers bytes32 finalSalt = keccak256(abi.encodePacked(parent, salt)); address payable clone = createClone(implementationAddress, finalSalt); Forwarder(clone).init(parent); emit ForwarderCreated(clone, parent); } }
1
20,290,582
72a99cec2a1da848b58d61b72cf9c9c6e78ab21f9b72d93a875c64af9d74e30d
e82c06fa9b5377fd9c4082b1417787be0a53c83b824c8a8f616e56be49ebadb4
c9aad2fc90eddacf02bd11fa690e3b44e318aa9b
a2a1bf5a83f9daec2dc364e1c561e937163cb613
a7a29e3fafb837e2f1ef046213ff064951b8bff0
3d602d80600a3d3981f3363d3d373d3d3d363d7387ae9be718aa310323042ab9806bd6692c1129b75af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7387ae9be718aa310323042ab9806bd6692c1129b75af43d82803e903d91602b57fd5bf3
1
20,290,583
58d0826365e2ca453da76c770fb464597d6a4d766693c542aa287facd3d66f8c
571ca03813e02ea3917a85c35b84a01f81e0fe212871d45099f77620d3864849
4e565f63257d90f988e5ec9d065bab00f94d2dfd
9fa5c5733b53814692de4fb31fd592070de5f5f0
76aaf84bc5ca37b0828db623129847e790a3ccb1
608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe
1
20,290,583
58d0826365e2ca453da76c770fb464597d6a4d766693c542aa287facd3d66f8c
2f59b42fed3611a7125eb7e4eafee5394ed7736f4dac73becb5dd7d1a06d661f
4e565f63257d90f988e5ec9d065bab00f94d2dfd
9fa5c5733b53814692de4fb31fd592070de5f5f0
1049f1ffdf18438bbb7f2a16e4d643244065bf47
608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe
1
20,290,584
4e1732b7a40abec595c04186b0a5452294cc882d599f95221775a15dcc34e88c
acee0b02ec5a700417dfe5b366ecc18656b278972bdb3904e930c9afadba7d29
a7fb5ca286fc3fd67525629048a4de3ba24cba2e
c77ad0a71008d7094a62cfbd250a2eb2afdf2776
fe32bf6b86ff73c91c9157c661df2afaf20ae01a
608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe
1
20,290,585
7cfbc7efd1153f1dc06a76fa1b79d2fcf53dc78d9166f1e2c6a818181c61f5ab
3861873e82530f3c8041f230fbcd04ad9266c54b6874529b01075a28150624ea
f758c8a58c50981f8c92c04efabc3d89147e9448
5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f
0338c10b0ff476b77b945cf88b080e250ed17779
60806040526001600c5534801561001557600080fd5b506040514690806052612d228239604080519182900360520182208282018252600a8352692ab734b9bbb0b8102b1960b11b6020938401528151808301835260018152603160f81b908401528151808401919091527fbfcc8ef98ffbf7b6c3fec7bf5185b566b9863e35a9d83acd49ad6824b5969738818301527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606082015260808101949094523060a0808601919091528151808603909101815260c09094019052825192019190912060035550600580546001600160a01b03191633179055612c1d806101056000396000f3fe608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a7146105da578063d505accf146105e2578063dd62ed3e14610640578063fff6cae91461067b576101b9565b8063ba9a7a5614610597578063bc25cf771461059f578063c45a0155146105d2576101b9565b80637ecebe00116100d35780637ecebe00146104d757806389afcb441461050a57806395d89b4114610556578063a9059cbb1461055e576101b9565b80636a6278421461046957806370a082311461049c5780637464fc3d146104cf576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610416578063485cc9551461041e5780635909c0d5146104595780635a3d549314610461576101b9565b806323b872dd146103ad57806330adf81f146103f0578063313ce567146103f8576101b9565b8063095ea7b311610197578063095ea7b3146103155780630dfe16811461036257806318160ddd14610393576101b9565b8063022c0d9f146101be57806306fdde03146102595780630902f1ac146102d6575b600080fd5b610257600480360360808110156101d457600080fd5b81359160208101359173ffffffffffffffffffffffffffffffffffffffff604083013516919081019060808101606082013564010000000081111561021857600080fd5b82018360208201111561022a57600080fd5b8035906020019184600183028401116401000000008311171561024c57600080fd5b509092509050610683565b005b610261610d57565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029b578181015183820152602001610283565b50505050905090810190601f1680156102c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102de610d90565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b61034e6004803603604081101561032b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de5565b604080519115158252519081900360200190f35b61036a610dfc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61039b610e18565b60408051918252519081900360200190f35b61034e600480360360608110156103c357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e1e565b61039b610efd565b610400610f21565b6040805160ff9092168252519081900360200190f35b61039b610f26565b6102576004803603604081101561043457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610f2c565b61039b611005565b61039b61100b565b61039b6004803603602081101561047f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611011565b61039b600480360360208110156104b257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113cb565b61039b6113dd565b61039b600480360360208110156104ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113e3565b61053d6004803603602081101561052057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113f5565b6040805192835260208301919091528051918290030190f35b610261611892565b61034e6004803603604081101561057457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356118cb565b61039b6118d8565b610257600480360360208110156105b557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166118de565b61036a611ad4565b61036a611af0565b610257600480360360e08110156105f857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b0c565b61039b6004803603604081101561065657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611dd8565b610257611df5565b600c546001146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55841515806107075750600084115b61075c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b2f6025913960400191505060405180910390fd5b600080610767610d90565b5091509150816dffffffffffffffffffffffffffff168710801561079a5750806dffffffffffffffffffffffffffff1686105b6107ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b786021913960400191505060405180910390fd5b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff91821691908116908916821480159061085457508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b6108bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a156108d0576108d0828a8d611fdb565b89156108e1576108e1818a8c611fdb565b86156109c3578873ffffffffffffffffffffffffffffffffffffffff166310d1e85c338d8d8c8c6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050505b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8416916370a08231916024808301926020929190829003018186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191955073ffffffffffffffffffffffffffffffffffffffff8316916370a0823191602480820192602092909190829003018186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d6020811015610af557600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a90038311610b1f576000610b35565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610b59576000610b6f565b89856dffffffffffffffffffffffffffff160383035b90506000821180610b805750600081115b610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b546024913960400191505060405180910390fd5b6000610c09610beb84600363ffffffff6121e816565b610bfd876103e863ffffffff6121e816565b9063ffffffff61226e16565b90506000610c21610beb84600363ffffffff6121e816565b9050610c59620f4240610c4d6dffffffffffffffffffffffffffff8b8116908b1663ffffffff6121e816565b9063ffffffff6121e816565b610c69838363ffffffff6121e816565b1015610cd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610ce4848488886122e0565b60408051838152602081018390528082018d9052606081018c9052905173ffffffffffffffffffffffffffffffffffffffff8b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a81526020017f556e69737761702056320000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610df233848461259c565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610ee85773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610eb6908363ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610ef384848461260b565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610fb257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c5460011461108457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611094610d90565b50600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905193955091935060009273ffffffffffffffffffffffffffffffffffffffff909116916370a08231916024808301926020929190829003018186803b15801561110e57600080fd5b505afa158015611122573d6000803e3d6000fd5b505050506040513d602081101561113857600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905192935060009273ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d60208110156111db57600080fd5b505190506000611201836dffffffffffffffffffffffffffff871663ffffffff61226e16565b90506000611225836dffffffffffffffffffffffffffff871663ffffffff61226e16565b9050600061123387876126ec565b600054909150806112705761125c6103e8610bfd611257878763ffffffff6121e816565b612878565b985061126b60006103e86128ca565b6112cd565b6112ca6dffffffffffffffffffffffffffff8916611294868463ffffffff6121e816565b8161129b57fe5b046dffffffffffffffffffffffffffff89166112bd868563ffffffff6121e816565b816112c457fe5b0461297a565b98505b60008911611326576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612bc16028913960400191505060405180910390fd5b6113308a8a6128ca565b61133c86868a8a6122e0565b811561137e5760085461137a906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461146957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611479610d90565b50600654600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905194965092945073ffffffffffffffffffffffffffffffffffffffff9182169391169160009184916370a08231916024808301926020929190829003018186803b1580156114fb57600080fd5b505afa15801561150f573d6000803e3d6000fd5b505050506040513d602081101561152557600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191925060009173ffffffffffffffffffffffffffffffffffffffff8516916370a08231916024808301926020929190829003018186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d60208110156115c357600080fd5b5051306000908152600160205260408120549192506115e288886126ec565b600054909150806115f9848763ffffffff6121e816565b8161160057fe5b049a5080611614848663ffffffff6121e816565b8161161b57fe5b04995060008b11801561162e575060008a115b611683576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612b996028913960400191505060405180910390fd5b61168d3084612992565b611698878d8d611fdb565b6116a3868d8c611fdb565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8916916370a08231916024808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d602081101561173957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191965073ffffffffffffffffffffffffffffffffffffffff8816916370a0823191602480820192602092909190829003018186803b1580156117ab57600080fd5b505afa1580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b505193506117e585858b8b6122e0565b811561182757600854611823906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b604080518c8152602081018c9052815173ffffffffffffffffffffffffffffffffffffffff8f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f554e492d5632000000000000000000000000000000000000000000000000000081525081565b6000610df233848461260b565b6103e881565b600c5460011461194f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654600754600854604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff9485169490931692611a2b9285928792611a26926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff61226e16565b611fdb565b600854604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611aca9284928792611a26926e01000000000000000000000000000090046dffffffffffffffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff8616916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611b7b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff80891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e2808201937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019281900390910190855afa158015611cdc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611d5757508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611dc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611dcd89898961259c565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611e6657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611fd49273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b158015611f7a57600080fd5b505afa158015611f8e573d6000803e3d6000fd5b505050506040513d6020811015611fa457600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166122e0565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e743235362900000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b602083106120e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016120a4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612143576040519150601f19603f3d011682016040523d82523d6000602084013e612148565b606091505b5091509150818015612176575080511580612176575080806020019051602081101561217357600080fd5b50515b6121e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b60008115806122035750508082028282828161220057fe5b04145b610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061230c57506dffffffffffffffffffffffffffff8311155b61237757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906123c757506dffffffffffffffffffffffffffff841615155b80156123e257506dffffffffffffffffffffffffffff831615155b15612492578063ffffffff16612425856123fb86612a57565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169063ffffffff612a7b16565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff8116612465846123fb87612a57565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054612641908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160205260408082209390935590841681522054612683908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561275757600080fd5b505afa15801561276b573d6000803e3d6000fd5b505050506040513d602081101561278157600080fd5b5051600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061286457801561285f5760006127d86112576dffffffffffffffffffffffffffff88811690881663ffffffff6121e816565b905060006127e583612878565b90508082111561285c576000612813612804848463ffffffff61226e16565b6000549063ffffffff6121e816565b905060006128388361282c86600563ffffffff6121e816565b9063ffffffff612abc16565b9050600081838161284557fe5b04905080156128585761285887826128ca565b5050505b50505b612870565b8015612870576000600b555b505092915050565b600060038211156128bb575080600160028204015b818110156128b5578091506002818285816128a457fe5b0401816128ad57fe5b04905061288d565b506128c5565b81156128c5575060015b919050565b6000546128dd908263ffffffff612abc16565b600090815573ffffffffffffffffffffffffffffffffffffffff8316815260016020526040902054612915908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000818310612989578161298b565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020546129c8908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081209190915554612a02908263ffffffff61226e16565b600090815560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff841681612ab457fe5b049392505050565b80820182811015610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158207dca18479e58487606bf70c79e44d8dee62353c9ee6d01f9a9d70885b8765f2264736f6c63430005100032454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e747261637429
608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a7146105da578063d505accf146105e2578063dd62ed3e14610640578063fff6cae91461067b576101b9565b8063ba9a7a5614610597578063bc25cf771461059f578063c45a0155146105d2576101b9565b80637ecebe00116100d35780637ecebe00146104d757806389afcb441461050a57806395d89b4114610556578063a9059cbb1461055e576101b9565b80636a6278421461046957806370a082311461049c5780637464fc3d146104cf576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610416578063485cc9551461041e5780635909c0d5146104595780635a3d549314610461576101b9565b806323b872dd146103ad57806330adf81f146103f0578063313ce567146103f8576101b9565b8063095ea7b311610197578063095ea7b3146103155780630dfe16811461036257806318160ddd14610393576101b9565b8063022c0d9f146101be57806306fdde03146102595780630902f1ac146102d6575b600080fd5b610257600480360360808110156101d457600080fd5b81359160208101359173ffffffffffffffffffffffffffffffffffffffff604083013516919081019060808101606082013564010000000081111561021857600080fd5b82018360208201111561022a57600080fd5b8035906020019184600183028401116401000000008311171561024c57600080fd5b509092509050610683565b005b610261610d57565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029b578181015183820152602001610283565b50505050905090810190601f1680156102c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102de610d90565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b61034e6004803603604081101561032b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de5565b604080519115158252519081900360200190f35b61036a610dfc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61039b610e18565b60408051918252519081900360200190f35b61034e600480360360608110156103c357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e1e565b61039b610efd565b610400610f21565b6040805160ff9092168252519081900360200190f35b61039b610f26565b6102576004803603604081101561043457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610f2c565b61039b611005565b61039b61100b565b61039b6004803603602081101561047f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611011565b61039b600480360360208110156104b257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113cb565b61039b6113dd565b61039b600480360360208110156104ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113e3565b61053d6004803603602081101561052057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113f5565b6040805192835260208301919091528051918290030190f35b610261611892565b61034e6004803603604081101561057457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356118cb565b61039b6118d8565b610257600480360360208110156105b557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166118de565b61036a611ad4565b61036a611af0565b610257600480360360e08110156105f857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b0c565b61039b6004803603604081101561065657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611dd8565b610257611df5565b600c546001146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55841515806107075750600084115b61075c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b2f6025913960400191505060405180910390fd5b600080610767610d90565b5091509150816dffffffffffffffffffffffffffff168710801561079a5750806dffffffffffffffffffffffffffff1686105b6107ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b786021913960400191505060405180910390fd5b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff91821691908116908916821480159061085457508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b6108bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a156108d0576108d0828a8d611fdb565b89156108e1576108e1818a8c611fdb565b86156109c3578873ffffffffffffffffffffffffffffffffffffffff166310d1e85c338d8d8c8c6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050505b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8416916370a08231916024808301926020929190829003018186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191955073ffffffffffffffffffffffffffffffffffffffff8316916370a0823191602480820192602092909190829003018186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d6020811015610af557600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a90038311610b1f576000610b35565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610b59576000610b6f565b89856dffffffffffffffffffffffffffff160383035b90506000821180610b805750600081115b610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b546024913960400191505060405180910390fd5b6000610c09610beb84600363ffffffff6121e816565b610bfd876103e863ffffffff6121e816565b9063ffffffff61226e16565b90506000610c21610beb84600363ffffffff6121e816565b9050610c59620f4240610c4d6dffffffffffffffffffffffffffff8b8116908b1663ffffffff6121e816565b9063ffffffff6121e816565b610c69838363ffffffff6121e816565b1015610cd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610ce4848488886122e0565b60408051838152602081018390528082018d9052606081018c9052905173ffffffffffffffffffffffffffffffffffffffff8b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a81526020017f556e69737761702056320000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610df233848461259c565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610ee85773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610eb6908363ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610ef384848461260b565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610fb257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c5460011461108457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611094610d90565b50600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905193955091935060009273ffffffffffffffffffffffffffffffffffffffff909116916370a08231916024808301926020929190829003018186803b15801561110e57600080fd5b505afa158015611122573d6000803e3d6000fd5b505050506040513d602081101561113857600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905192935060009273ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d60208110156111db57600080fd5b505190506000611201836dffffffffffffffffffffffffffff871663ffffffff61226e16565b90506000611225836dffffffffffffffffffffffffffff871663ffffffff61226e16565b9050600061123387876126ec565b600054909150806112705761125c6103e8610bfd611257878763ffffffff6121e816565b612878565b985061126b60006103e86128ca565b6112cd565b6112ca6dffffffffffffffffffffffffffff8916611294868463ffffffff6121e816565b8161129b57fe5b046dffffffffffffffffffffffffffff89166112bd868563ffffffff6121e816565b816112c457fe5b0461297a565b98505b60008911611326576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612bc16028913960400191505060405180910390fd5b6113308a8a6128ca565b61133c86868a8a6122e0565b811561137e5760085461137a906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461146957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611479610d90565b50600654600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905194965092945073ffffffffffffffffffffffffffffffffffffffff9182169391169160009184916370a08231916024808301926020929190829003018186803b1580156114fb57600080fd5b505afa15801561150f573d6000803e3d6000fd5b505050506040513d602081101561152557600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191925060009173ffffffffffffffffffffffffffffffffffffffff8516916370a08231916024808301926020929190829003018186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d60208110156115c357600080fd5b5051306000908152600160205260408120549192506115e288886126ec565b600054909150806115f9848763ffffffff6121e816565b8161160057fe5b049a5080611614848663ffffffff6121e816565b8161161b57fe5b04995060008b11801561162e575060008a115b611683576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612b996028913960400191505060405180910390fd5b61168d3084612992565b611698878d8d611fdb565b6116a3868d8c611fdb565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8916916370a08231916024808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d602081101561173957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191965073ffffffffffffffffffffffffffffffffffffffff8816916370a0823191602480820192602092909190829003018186803b1580156117ab57600080fd5b505afa1580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b505193506117e585858b8b6122e0565b811561182757600854611823906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b604080518c8152602081018c9052815173ffffffffffffffffffffffffffffffffffffffff8f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f554e492d5632000000000000000000000000000000000000000000000000000081525081565b6000610df233848461260b565b6103e881565b600c5460011461194f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654600754600854604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff9485169490931692611a2b9285928792611a26926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff61226e16565b611fdb565b600854604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611aca9284928792611a26926e01000000000000000000000000000090046dffffffffffffffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff8616916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611b7b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff80891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e2808201937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019281900390910190855afa158015611cdc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611d5757508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611dc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611dcd89898961259c565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611e6657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611fd49273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b158015611f7a57600080fd5b505afa158015611f8e573d6000803e3d6000fd5b505050506040513d6020811015611fa457600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166122e0565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e743235362900000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b602083106120e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016120a4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612143576040519150601f19603f3d011682016040523d82523d6000602084013e612148565b606091505b5091509150818015612176575080511580612176575080806020019051602081101561217357600080fd5b50515b6121e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b60008115806122035750508082028282828161220057fe5b04145b610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061230c57506dffffffffffffffffffffffffffff8311155b61237757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906123c757506dffffffffffffffffffffffffffff841615155b80156123e257506dffffffffffffffffffffffffffff831615155b15612492578063ffffffff16612425856123fb86612a57565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169063ffffffff612a7b16565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff8116612465846123fb87612a57565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054612641908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160205260408082209390935590841681522054612683908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561275757600080fd5b505afa15801561276b573d6000803e3d6000fd5b505050506040513d602081101561278157600080fd5b5051600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061286457801561285f5760006127d86112576dffffffffffffffffffffffffffff88811690881663ffffffff6121e816565b905060006127e583612878565b90508082111561285c576000612813612804848463ffffffff61226e16565b6000549063ffffffff6121e816565b905060006128388361282c86600563ffffffff6121e816565b9063ffffffff612abc16565b9050600081838161284557fe5b04905080156128585761285887826128ca565b5050505b50505b612870565b8015612870576000600b555b505092915050565b600060038211156128bb575080600160028204015b818110156128b5578091506002818285816128a457fe5b0401816128ad57fe5b04905061288d565b506128c5565b81156128c5575060015b919050565b6000546128dd908263ffffffff612abc16565b600090815573ffffffffffffffffffffffffffffffffffffffff8316815260016020526040902054612915908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000818310612989578161298b565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020546129c8908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081209190915554612a02908263ffffffff61226e16565b600090815560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff841681612ab457fe5b049392505050565b80820182811015610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158207dca18479e58487606bf70c79e44d8dee62353c9ee6d01f9a9d70885b8765f2264736f6c63430005100032
// File: contracts/interfaces/IUniswapV2Pair.sol pragma solidity >=0.5.0; interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; } // File: contracts/interfaces/IUniswapV2ERC20.sol pragma solidity >=0.5.0; interface IUniswapV2ERC20 { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; } // File: contracts/libraries/SafeMath.sol pragma solidity =0.5.16; // a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math) library SafeMath { function add(uint x, uint y) internal pure returns (uint z) { require((z = x + y) >= x, 'ds-math-add-overflow'); } function sub(uint x, uint y) internal pure returns (uint z) { require((z = x - y) <= x, 'ds-math-sub-underflow'); } function mul(uint x, uint y) internal pure returns (uint z) { require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow'); } } // File: contracts/UniswapV2ERC20.sol pragma solidity =0.5.16; contract UniswapV2ERC20 is IUniswapV2ERC20 { using SafeMath for uint; string public constant name = 'Uniswap V2'; string public constant symbol = 'UNI-V2'; uint8 public constant decimals = 18; uint public totalSupply; mapping(address => uint) public balanceOf; mapping(address => mapping(address => uint)) public allowance; bytes32 public DOMAIN_SEPARATOR; // keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9; mapping(address => uint) public nonces; event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); constructor() public { uint chainId; assembly { chainId := chainid } DOMAIN_SEPARATOR = keccak256( abi.encode( keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'), keccak256(bytes(name)), keccak256(bytes('1')), chainId, address(this) ) ); } function _mint(address to, uint value) internal { totalSupply = totalSupply.add(value); balanceOf[to] = balanceOf[to].add(value); emit Transfer(address(0), to, value); } function _burn(address from, uint value) internal { balanceOf[from] = balanceOf[from].sub(value); totalSupply = totalSupply.sub(value); emit Transfer(from, address(0), value); } function _approve(address owner, address spender, uint value) private { allowance[owner][spender] = value; emit Approval(owner, spender, value); } function _transfer(address from, address to, uint value) private { balanceOf[from] = balanceOf[from].sub(value); balanceOf[to] = balanceOf[to].add(value); emit Transfer(from, to, value); } function approve(address spender, uint value) external returns (bool) { _approve(msg.sender, spender, value); return true; } function transfer(address to, uint value) external returns (bool) { _transfer(msg.sender, to, value); return true; } function transferFrom(address from, address to, uint value) external returns (bool) { if (allowance[from][msg.sender] != uint(-1)) { allowance[from][msg.sender] = allowance[from][msg.sender].sub(value); } _transfer(from, to, value); return true; } function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external { require(deadline >= block.timestamp, 'UniswapV2: EXPIRED'); bytes32 digest = keccak256( abi.encodePacked( '\x19\x01', DOMAIN_SEPARATOR, keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline)) ) ); address recoveredAddress = ecrecover(digest, v, r, s); require(recoveredAddress != address(0) && recoveredAddress == owner, 'UniswapV2: INVALID_SIGNATURE'); _approve(owner, spender, value); } } // File: contracts/libraries/Math.sol pragma solidity =0.5.16; // a library for performing various math operations library Math { function min(uint x, uint y) internal pure returns (uint z) { z = x < y ? x : y; } // babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method) function sqrt(uint y) internal pure returns (uint z) { if (y > 3) { z = y; uint x = y / 2 + 1; while (x < z) { z = x; x = (y / x + x) / 2; } } else if (y != 0) { z = 1; } } } // File: contracts/libraries/UQ112x112.sol pragma solidity =0.5.16; // a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format)) // range: [0, 2**112 - 1] // resolution: 1 / 2**112 library UQ112x112 { uint224 constant Q112 = 2**112; // encode a uint112 as a UQ112x112 function encode(uint112 y) internal pure returns (uint224 z) { z = uint224(y) * Q112; // never overflows } // divide a UQ112x112 by a uint112, returning a UQ112x112 function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) { z = x / uint224(y); } } // File: contracts/interfaces/IERC20.sol pragma solidity >=0.5.0; interface IERC20 { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); } // File: contracts/interfaces/IUniswapV2Factory.sol pragma solidity >=0.5.0; interface IUniswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint) external view returns (address pair); function allPairsLength() external view returns (uint); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; } // File: contracts/interfaces/IUniswapV2Callee.sol pragma solidity >=0.5.0; interface IUniswapV2Callee { function uniswapV2Call(address sender, uint amount0, uint amount1, bytes calldata data) external; } // File: contracts/UniswapV2Pair.sol pragma solidity =0.5.16; contract UniswapV2Pair is IUniswapV2Pair, UniswapV2ERC20 { using SafeMath for uint; using UQ112x112 for uint224; uint public constant MINIMUM_LIQUIDITY = 10**3; bytes4 private constant SELECTOR = bytes4(keccak256(bytes('transfer(address,uint256)'))); address public factory; address public token0; address public token1; uint112 private reserve0; // uses single storage slot, accessible via getReserves uint112 private reserve1; // uses single storage slot, accessible via getReserves uint32 private blockTimestampLast; // uses single storage slot, accessible via getReserves uint public price0CumulativeLast; uint public price1CumulativeLast; uint public kLast; // reserve0 * reserve1, as of immediately after the most recent liquidity event uint private unlocked = 1; modifier lock() { require(unlocked == 1, 'UniswapV2: LOCKED'); unlocked = 0; _; unlocked = 1; } function getReserves() public view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast) { _reserve0 = reserve0; _reserve1 = reserve1; _blockTimestampLast = blockTimestampLast; } function _safeTransfer(address token, address to, uint value) private { (bool success, bytes memory data) = token.call(abi.encodeWithSelector(SELECTOR, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'UniswapV2: TRANSFER_FAILED'); } event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); constructor() public { factory = msg.sender; } // called once by the factory at time of deployment function initialize(address _token0, address _token1) external { require(msg.sender == factory, 'UniswapV2: FORBIDDEN'); // sufficient check token0 = _token0; token1 = _token1; } // update reserves and, on the first call per block, price accumulators function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private { require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'UniswapV2: OVERFLOW'); uint32 blockTimestamp = uint32(block.timestamp % 2**32); uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) { // * never overflows, and + overflow is desired price0CumulativeLast += uint(UQ112x112.encode(_reserve1).uqdiv(_reserve0)) * timeElapsed; price1CumulativeLast += uint(UQ112x112.encode(_reserve0).uqdiv(_reserve1)) * timeElapsed; } reserve0 = uint112(balance0); reserve1 = uint112(balance1); blockTimestampLast = blockTimestamp; emit Sync(reserve0, reserve1); } // if fee is on, mint liquidity equivalent to 1/6th of the growth in sqrt(k) function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) { address feeTo = IUniswapV2Factory(factory).feeTo(); feeOn = feeTo != address(0); uint _kLast = kLast; // gas savings if (feeOn) { if (_kLast != 0) { uint rootK = Math.sqrt(uint(_reserve0).mul(_reserve1)); uint rootKLast = Math.sqrt(_kLast); if (rootK > rootKLast) { uint numerator = totalSupply.mul(rootK.sub(rootKLast)); uint denominator = rootK.mul(5).add(rootKLast); uint liquidity = numerator / denominator; if (liquidity > 0) _mint(feeTo, liquidity); } } } else if (_kLast != 0) { kLast = 0; } } // this low-level function should be called from a contract which performs important safety checks function mint(address to) external lock returns (uint liquidity) { (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings uint balance0 = IERC20(token0).balanceOf(address(this)); uint balance1 = IERC20(token1).balanceOf(address(this)); uint amount0 = balance0.sub(_reserve0); uint amount1 = balance1.sub(_reserve1); bool feeOn = _mintFee(_reserve0, _reserve1); uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee if (_totalSupply == 0) { liquidity = Math.sqrt(amount0.mul(amount1)).sub(MINIMUM_LIQUIDITY); _mint(address(0), MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens } else { liquidity = Math.min(amount0.mul(_totalSupply) / _reserve0, amount1.mul(_totalSupply) / _reserve1); } require(liquidity > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED'); _mint(to, liquidity); _update(balance0, balance1, _reserve0, _reserve1); if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date emit Mint(msg.sender, amount0, amount1); } // this low-level function should be called from a contract which performs important safety checks function burn(address to) external lock returns (uint amount0, uint amount1) { (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings address _token0 = token0; // gas savings address _token1 = token1; // gas savings uint balance0 = IERC20(_token0).balanceOf(address(this)); uint balance1 = IERC20(_token1).balanceOf(address(this)); uint liquidity = balanceOf[address(this)]; bool feeOn = _mintFee(_reserve0, _reserve1); uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee amount0 = liquidity.mul(balance0) / _totalSupply; // using balances ensures pro-rata distribution amount1 = liquidity.mul(balance1) / _totalSupply; // using balances ensures pro-rata distribution require(amount0 > 0 && amount1 > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED'); _burn(address(this), liquidity); _safeTransfer(_token0, to, amount0); _safeTransfer(_token1, to, amount1); balance0 = IERC20(_token0).balanceOf(address(this)); balance1 = IERC20(_token1).balanceOf(address(this)); _update(balance0, balance1, _reserve0, _reserve1); if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date emit Burn(msg.sender, amount0, amount1, to); } // this low-level function should be called from a contract which performs important safety checks function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external lock { require(amount0Out > 0 || amount1Out > 0, 'UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT'); (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings require(amount0Out < _reserve0 && amount1Out < _reserve1, 'UniswapV2: INSUFFICIENT_LIQUIDITY'); uint balance0; uint balance1; { // scope for _token{0,1}, avoids stack too deep errors address _token0 = token0; address _token1 = token1; require(to != _token0 && to != _token1, 'UniswapV2: INVALID_TO'); if (amount0Out > 0) _safeTransfer(_token0, to, amount0Out); // optimistically transfer tokens if (amount1Out > 0) _safeTransfer(_token1, to, amount1Out); // optimistically transfer tokens if (data.length > 0) IUniswapV2Callee(to).uniswapV2Call(msg.sender, amount0Out, amount1Out, data); balance0 = IERC20(_token0).balanceOf(address(this)); balance1 = IERC20(_token1).balanceOf(address(this)); } uint amount0In = balance0 > _reserve0 - amount0Out ? balance0 - (_reserve0 - amount0Out) : 0; uint amount1In = balance1 > _reserve1 - amount1Out ? balance1 - (_reserve1 - amount1Out) : 0; require(amount0In > 0 || amount1In > 0, 'UniswapV2: INSUFFICIENT_INPUT_AMOUNT'); { // scope for reserve{0,1}Adjusted, avoids stack too deep errors uint balance0Adjusted = balance0.mul(1000).sub(amount0In.mul(3)); uint balance1Adjusted = balance1.mul(1000).sub(amount1In.mul(3)); require(balance0Adjusted.mul(balance1Adjusted) >= uint(_reserve0).mul(_reserve1).mul(1000**2), 'UniswapV2: K'); } _update(balance0, balance1, _reserve0, _reserve1); emit Swap(msg.sender, amount0In, amount1In, amount0Out, amount1Out, to); } // force balances to match reserves function skim(address to) external lock { address _token0 = token0; // gas savings address _token1 = token1; // gas savings _safeTransfer(_token0, to, IERC20(_token0).balanceOf(address(this)).sub(reserve0)); _safeTransfer(_token1, to, IERC20(_token1).balanceOf(address(this)).sub(reserve1)); } // force reserves to match balances function sync() external lock { _update(IERC20(token0).balanceOf(address(this)), IERC20(token1).balanceOf(address(this)), reserve0, reserve1); } }
1
20,290,585
7cfbc7efd1153f1dc06a76fa1b79d2fcf53dc78d9166f1e2c6a818181c61f5ab
1da3d9f6447caa922b0ac3cdc52d649e3f362df8caaaea7acf65639c59ccaed9
3d16ee6d46edb674e728b5923e2ecac4092f5920
3d16ee6d46edb674e728b5923e2ecac4092f5920
3835625494f04eaeaa41f6ca160d6773af79f89c
60806040526004361061014a575f3560e01c8063715018a6116100b3578063a9059cbb1161006d578063a9059cbb1461037b578063bf474bed1461039a578063c97c1821146103af578063dd62ed3e146103ce578063ec1f3f6314610412578063fb201b1d14610431575f80fd5b8063715018a6146102f85780637d1db4a51461030c5780638cd4426d146103215780638da5cb5b146103405780638f9a55c01461036657806395d89b411461016b575f80fd5b806323b872dd1161010457806323b872dd1461022b578063313ce5671461024a5780633bbac5791461026557806351bc3c851461029c57806362256589146102b057806370a08231146102c4575f80fd5b806302fa1f4a1461015557806306fdde031461016b578063095ea7b3146101a65780630faee56f146101d557806318160ddd146101f857806321bbcbb11461020c575f80fd5b3661015157005b5f80fd5b348015610160575f80fd5b50610169610445565b005b348015610176575f80fd5b5060408051808201825260048152634d41474160e01b6020820152905161019d91906117a6565b60405180910390f35b3480156101b1575f80fd5b506101c56101c0366004611819565b6104b3565b604051901515815260200161019d565b3480156101e0575f80fd5b506101ea60125481565b60405190815260200161019d565b348015610203575f80fd5b506101ea6104c9565b348015610217575f80fd5b50610169610226366004611857565b6104ea565b348015610236575f80fd5b506101c5610245366004611917565b610572565b348015610255575f80fd5b506040516009815260200161019d565b348015610270575f80fd5b506101c561027f366004611955565b6001600160a01b03165f9081526004602052604090205460ff1690565b3480156102a7575f80fd5b506101696105d9565b3480156102bb575f80fd5b5061016961063d565b3480156102cf575f80fd5b506101ea6102de366004611955565b6001600160a01b03165f9081526001602052604090205490565b348015610303575f80fd5b506101696106ec565b348015610317575f80fd5b506101ea600f5481565b34801561032c575f80fd5b5061016961033b366004611819565b61075d565b34801561034b575f80fd5b505f546040516001600160a01b03909116815260200161019d565b348015610371575f80fd5b506101ea60105481565b348015610386575f80fd5b506101c5610395366004611819565b610879565b3480156103a5575f80fd5b506101ea60115481565b3480156103ba575f80fd5b506101696103c9366004611857565b610885565b3480156103d9575f80fd5b506101ea6103e8366004611970565b6001600160a01b039182165f90815260026020908152604080832093909416825291909152205490565b34801561041d575f80fd5b5061016961042c3660046119a7565b610908565b34801561043c575f80fd5b5061016961094d565b5f546001600160a01b031633146104775760405162461bcd60e51b815260040161046e906119be565b60405180910390fd5b5f600d8190556040519081527fe9b79e1a6c2dc43b4c0c6ff01ce9e3332d810e482270f464c0a21ad6c5fc6de3906020015b60405180910390a1565b5f6104bf338484610cf7565b5060015b92915050565b5f6104d66009600a611ae7565b6104e5906461f313f880611af5565b905090565b5f546001600160a01b031633146105135760405162461bcd60e51b815260040161046e906119be565b5f5b815181101561056e57600160045f84848151811061053557610535611b0c565b6020908102919091018101516001600160a01b031682528101919091526040015f20805460ff1916911515919091179055600101610515565b5050565b5f61057e848484610e1a565b6105cf84336105ca85604051806060016040528060288152602001611c6b602891396001600160a01b038a165f9081526002602090815260408083203384529091529020549190611422565b610cf7565b5060019392505050565b6005546001600160a01b0316336001600160a01b0316146105f8575f80fd5b305f90815260016020526040902054801580159061061f5750601454600160b01b900460ff165b1561062d5761062d8161145a565b47801561056e5761056e816115ca565b5f546001600160a01b031633146106665760405162461bcd60e51b815260040161046e906119be565b6106726009600a611ae7565b610681906461f313f880611af5565b600f556106906009600a611ae7565b61069f906461f313f880611af5565b6010557f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6106cf6009600a611ae7565b6106de906461f313f880611af5565b6040519081526020016104a9565b5f546001600160a01b031633146107155760405162461bcd60e51b815260040161046e906119be565b5f80546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a35f80546001600160a01b0319169055565b6005546001600160a01b0316336001600160a01b03161461077c575f80fd5b6040516370a0823160e01b81523060048201525f906107fd906064906107f79085906001600160a01b038816906370a0823190602401602060405180830381865afa1580156107cd573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107f19190611b20565b90611601565b90611686565b60055460405163a9059cbb60e01b81526001600160a01b0391821660048201526024810183905291925084169063a9059cbb906044016020604051808303815f875af115801561084f573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108739190611b37565b50505050565b5f6104bf338484610e1a565b5f546001600160a01b031633146108ae5760405162461bcd60e51b815260040161046e906119be565b5f5b815181101561056e575f60045f8484815181106108cf576108cf611b0c565b6020908102919091018101516001600160a01b031682528101919091526040015f20805460ff19169115159190911790556001016108b0565b6005546001600160a01b0316336001600160a01b031614610927575f80fd5b600854811115801561093b57506009548111155b610943575f80fd5b6008819055600955565b5f546001600160a01b031633146109765760405162461bcd60e51b815260040161046e906119be565b601454600160a01b900460ff16156109d05760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161046e565b601380546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610a1a903090610a0b6009600a611ae7565b6105ca906461f313f880611af5565b60135f9054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a6a573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a8e9190611b56565b6001600160a01b031663c9c653963060135f9054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610aed573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b119190611b56565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303815f875af1158015610b5b573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b7f9190611b56565b601480546001600160a01b039283166001600160a01b03199091161790556013541663f305d7194730610bc6816001600160a01b03165f9081526001602052604090205490565b5f80610bd95f546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610c3f573d5f803e3d5ffd5b50505050506040513d601f19601f82011682018060405250810190610c649190611b71565b505060145460135460405163095ea7b360e01b81526001600160a01b0391821660048201525f1960248201529116915063095ea7b3906044016020604051808303815f875af1158015610cb9573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610cdd9190611b37565b506014805462ff00ff60a01b19166201000160a01b179055565b6001600160a01b038316610d595760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161046e565b6001600160a01b038216610dba5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161046e565b6001600160a01b038381165f8181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610e7e5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161046e565b6001600160a01b038216610ee05760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161046e565b5f8111610f415760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161046e565b5f80546001600160a01b03858116911614801590610f6c57505f546001600160a01b03848116911614155b8015610f8657506005546001600160a01b03848116911614155b156112e5576001600160a01b0384165f9081526004602052604090205460ff16158015610fcb57506001600160a01b0383165f9081526004602052604090205460ff16155b610fd3575f80fd5b600e545f036110055761100260646107f7600a54600e5411610ff757600654610ffb565b6008545b8590611601565b90505b600e541561102a5761102760646107f7600d548561160190919063ffffffff16565b90505b6014546001600160a01b03858116911614801561105557506013546001600160a01b03848116911614155b801561107957506001600160a01b0383165f9081526003602052604090205460ff16155b1561117c57600f548211156110d05760405162461bcd60e51b815260206004820152601960248201527f4578636565647320746865205f6d61785478416d6f756e742e00000000000000604482015260640161046e565b601054826110f2856001600160a01b03165f9081526001602052604090205490565b6110fc9190611b9c565b111561114a5760405162461bcd60e51b815260206004820152601a60248201527f4578636565647320746865206d617857616c6c657453697a652e000000000000604482015260640161046e565b61116560646107f7600a54600e5411610ff757600654610ffb565b600e80549192505f61117683611baf565b91905055505b6014546001600160a01b0384811691161480156111a257506001600160a01b0384163014155b156111cf576111cc60646107f7600b54600e54116111c257600754610ffb565b6009548590611601565b90505b305f90815260016020526040902054601454600160a81b900460ff1615801561120557506014546001600160a01b038581169116145b801561121a5750601454600160b01b900460ff165b8015611227575060115481115b80156112365750600c54600e54115b156112e35760165443111561124a575f6015555b60036015541061129c5760405162461bcd60e51b815260206004820152601760248201527f4f6e6c7920332073656c6c732070657220626c6f636b21000000000000000000604482015260640161046e565b6112b96112b4846112af846012546116c7565b6116c7565b61145a565b4780156112c9576112c9476115ca565b60158054905f6112d883611baf565b909155505043601655505b505b801561135d57305f9081526001602052604090205461130490826116db565b305f81815260016020526040908190209290925590516001600160a01b038616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906113549085815260200190565b60405180910390a35b6001600160a01b0384165f9081526001602052604090205461137f9083611739565b6001600160a01b0385165f908152600160205260409020556113c26113a48383611739565b6001600160a01b0385165f90815260016020526040902054906116db565b6001600160a01b038085165f8181526001602052604090209290925585167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef61140b8585611739565b60405190815260200160405180910390a350505050565b5f81848411156114455760405162461bcd60e51b815260040161046e91906117a6565b505f6114518486611bc7565b95945050505050565b6014805460ff60a81b1916600160a81b1790556040805160028082526060820183525f9260208301908036833701905050905030815f815181106114a0576114a0611b0c565b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156114f7573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061151b9190611b56565b8160018151811061152e5761152e611b0c565b6001600160a01b0392831660209182029290920101526013546115549130911684610cf7565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac9479061158c9085905f90869030904290600401611bda565b5f604051808303815f87803b1580156115a3575f80fd5b505af11580156115b5573d5f803e3d5ffd5b50506014805460ff60a81b1916905550505050565b6005546040516001600160a01b039091169082156108fc029083905f818181858888f1935050505015801561056e573d5f803e3d5ffd5b5f825f0361161057505f6104c3565b5f61161b8385611af5565b9050826116288583611c4b565b1461167f5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161046e565b9392505050565b5f61167f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061177a565b5f8183116116d5578261167f565b50919050565b5f806116e78385611b9c565b90508381101561167f5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161046e565b5f61167f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611422565b5f818361179a5760405162461bcd60e51b815260040161046e91906117a6565b505f6114518486611c4b565b5f602080835283518060208501525f5b818110156117d2578581018301518582016040015282016117b6565b505f604082860101526040601f19601f8301168501019250505092915050565b6001600160a01b0381168114611806575f80fd5b50565b8035611814816117f2565b919050565b5f806040838503121561182a575f80fd5b8235611835816117f2565b946020939093013593505050565b634e487b7160e01b5f52604160045260245ffd5b5f6020808385031215611868575f80fd5b823567ffffffffffffffff8082111561187f575f80fd5b818501915085601f830112611892575f80fd5b8135818111156118a4576118a4611843565b8060051b604051601f19603f830116810181811085821117156118c9576118c9611843565b6040529182528482019250838101850191888311156118e6575f80fd5b938501935b8285101561190b576118fc85611809565b845293850193928501926118eb565b98975050505050505050565b5f805f60608486031215611929575f80fd5b8335611934816117f2565b92506020840135611944816117f2565b929592945050506040919091013590565b5f60208284031215611965575f80fd5b813561167f816117f2565b5f8060408385031215611981575f80fd5b823561198c816117f2565b9150602083013561199c816117f2565b809150509250929050565b5f602082840312156119b7575f80fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b5f52601160045260245ffd5b600181815b80851115611a4157815f1904821115611a2757611a276119f3565b80851615611a3457918102915b93841c9390800290611a0c565b509250929050565b5f82611a57575060016104c3565b81611a6357505f6104c3565b8160018114611a795760028114611a8357611a9f565b60019150506104c3565b60ff841115611a9457611a946119f3565b50506001821b6104c3565b5060208310610133831016604e8410600b8410161715611ac2575081810a6104c3565b611acc8383611a07565b805f1904821115611adf57611adf6119f3565b029392505050565b5f61167f60ff841683611a49565b80820281158282048414176104c3576104c36119f3565b634e487b7160e01b5f52603260045260245ffd5b5f60208284031215611b30575f80fd5b5051919050565b5f60208284031215611b47575f80fd5b8151801515811461167f575f80fd5b5f60208284031215611b66575f80fd5b815161167f816117f2565b5f805f60608486031215611b83575f80fd5b8351925060208401519150604084015190509250925092565b808201808211156104c3576104c36119f3565b5f60018201611bc057611bc06119f3565b5060010190565b818103818111156104c3576104c36119f3565b5f60a08201878352602087602085015260a0604085015281875180845260c0860191506020890193505f5b81811015611c2a5784516001600160a01b031683529383019391830191600101611c05565b50506001600160a01b03969096166060850152505050608001529392505050565b5f82611c6557634e487b7160e01b5f52601260045260245ffd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220cda68a5834302f1400126889902f4ea067acfe81af4d0069f0bc2b9550ee3d2b64736f6c63430008170033
1
20,290,588
087cf71fe6162c583dc21261bce1d65cd4236b81ccf579794e203f59ecff807a
9cb25ba852aaaac3c6ab8f903b2e7d1513443cc157fb5114862acb0b08020a8c
a7fb5ca286fc3fd67525629048a4de3ba24cba2e
c77ad0a71008d7094a62cfbd250a2eb2afdf2776
0a028e93bd6f836d2d359ff30e549301d17b2342
608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe
1
20,290,591
627b650bdc2dc7e51134861ed44b8a4fda1ce713fff65e35151275c0d843ed8f
5a14d5669417672dfc4224602ae94bb8f0022974d8109bd12542e990948a0669
07ca54b301deca9c8bc9af4e4cd6a87531018031
07042134d4dc295cbf3ab08a4a0eff847a528171
e86375beb77c8bbf59e37a493ca2358ec8175efd
608060405234801561001057600080fd5b5060405161020538038061020583398101604081905261002f916101d4565b8060005b604051636312ab1360e11b8152600481018290526000906001600160a01b0384169063c625562690602401602060405180830381865afa15801561007b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061009f91906101d4565b6001600160a01b0316146101475761013f82600019846001600160a01b031663c6255626856040518263ffffffff1660e01b81526004016100e291815260200190565b602060405180830381865afa1580156100ff573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061012391906101d4565b6001600160a01b031661014a60201b610009179092919060201c565b600101610033565b33ff5b600060405163095ea7b360e01b81526001600160a01b0384166004820152826024820152602060006044836000895af13d15601f3d11600160005114161716915050806101ce5760405162461bcd60e51b815260206004820152600e60248201526d1054141493d59157d1905253115160921b604482015260640160405180910390fd5b50505050565b6000602082840312156101e657600080fd5b81516001600160a01b03811681146101fd57600080fd5b939250505056fe00000000000000000000000007042134d4dc295cbf3ab08a4a0eff847a528171
1
20,290,591
627b650bdc2dc7e51134861ed44b8a4fda1ce713fff65e35151275c0d843ed8f
6bee44c65fa5879f1eaed9ac500e8ffe754348a60a010f026277de338821a8ef
62ad5465a4605e58bc914d7a812cdfef1ca16011
a6b71e26c5e0845f74c812102ca7114b6a896ab2
72de0b2515a7b64e9c7a093ec06847c2d8a4dfda
608060405234801561001057600080fd5b506040516101e63803806101e68339818101604052602081101561003357600080fd5b8101908080519060200190929190505050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156100ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806101c46022913960400191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505060ab806101196000396000f3fe608060405273ffffffffffffffffffffffffffffffffffffffff600054167fa619486e0000000000000000000000000000000000000000000000000000000060003514156050578060005260206000f35b3660008037600080366000845af43d6000803e60008114156070573d6000fd5b3d6000f3fea2646970667358221220d1429297349653a4918076d650332de1a1068c5f3e07c5c82360c277770b955264736f6c63430007060033496e76616c69642073696e676c65746f6e20616464726573732070726f7669646564000000000000000000000000d9db270c1b5e3bd161e8c8503c55ceabee709552
608060405273ffffffffffffffffffffffffffffffffffffffff600054167fa619486e0000000000000000000000000000000000000000000000000000000060003514156050578060005260206000f35b3660008037600080366000845af43d6000803e60008114156070573d6000fd5b3d6000f3fea2646970667358221220d1429297349653a4918076d650332de1a1068c5f3e07c5c82360c277770b955264736f6c63430007060033
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.7.0 <0.9.0; /// @title IProxy - Helper interface to access masterCopy of the Proxy on-chain /// @author Richard Meissner - <[email protected]> interface IProxy { function masterCopy() external view returns (address); } /// @title GnosisSafeProxy - Generic proxy contract allows to execute all transactions applying the code of a master contract. /// @author Stefan George - <[email protected]> /// @author Richard Meissner - <[email protected]> contract GnosisSafeProxy { // singleton always needs to be first declared variable, to ensure that it is at the same location in the contracts to which calls are delegated. // To reduce deployment costs this variable is internal and needs to be retrieved via `getStorageAt` address internal singleton; /// @dev Constructor function sets address of singleton contract. /// @param _singleton Singleton address. constructor(address _singleton) { require(_singleton != address(0), "Invalid singleton address provided"); singleton = _singleton; } /// @dev Fallback function forwards all transactions and returns all received return data. fallback() external payable { // solhint-disable-next-line no-inline-assembly assembly { let _singleton := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff) // 0xa619486e == keccak("masterCopy()"). The value is right padded to 32-bytes with 0s if eq(calldataload(0), 0xa619486e00000000000000000000000000000000000000000000000000000000) { mstore(0, _singleton) return(0, 0x20) } calldatacopy(0, 0, calldatasize()) let success := delegatecall(gas(), _singleton, 0, calldatasize(), 0, 0) returndatacopy(0, 0, returndatasize()) if eq(success, 0) { revert(0, returndatasize()) } return(0, returndatasize()) } } } /// @title Proxy Factory - Allows to create new proxy contact and execute a message call to the new proxy within one transaction. /// @author Stefan George - <[email protected]> contract GnosisSafeProxyFactory { event ProxyCreation(GnosisSafeProxy proxy, address singleton); /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction. /// @param singleton Address of singleton contract. /// @param data Payload for message call sent to new proxy contract. function createProxy(address singleton, bytes memory data) public returns (GnosisSafeProxy proxy) { proxy = new GnosisSafeProxy(singleton); if (data.length > 0) // solhint-disable-next-line no-inline-assembly assembly { if eq(call(gas(), proxy, 0, add(data, 0x20), mload(data), 0, 0), 0) { revert(0, 0) } } emit ProxyCreation(proxy, singleton); } /// @dev Allows to retrieve the runtime code of a deployed Proxy. This can be used to check that the expected Proxy was deployed. function proxyRuntimeCode() public pure returns (bytes memory) { return type(GnosisSafeProxy).runtimeCode; } /// @dev Allows to retrieve the creation code used for the Proxy deployment. With this it is easily possible to calculate predicted address. function proxyCreationCode() public pure returns (bytes memory) { return type(GnosisSafeProxy).creationCode; } /// @dev Allows to create new proxy contact using CREATE2 but it doesn't run the initializer. /// This method is only meant as an utility to be called from other methods /// @param _singleton Address of singleton contract. /// @param initializer Payload for message call sent to new proxy contract. /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. function deployProxyWithNonce( address _singleton, bytes memory initializer, uint256 saltNonce ) internal returns (GnosisSafeProxy proxy) { // If the initializer changes the proxy address should change too. Hashing the initializer data is cheaper than just concatinating it bytes32 salt = keccak256(abi.encodePacked(keccak256(initializer), saltNonce)); bytes memory deploymentData = abi.encodePacked(type(GnosisSafeProxy).creationCode, uint256(uint160(_singleton))); // solhint-disable-next-line no-inline-assembly assembly { proxy := create2(0x0, add(0x20, deploymentData), mload(deploymentData), salt) } require(address(proxy) != address(0), "Create2 call failed"); } /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction. /// @param _singleton Address of singleton contract. /// @param initializer Payload for message call sent to new proxy contract. /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. function createProxyWithNonce( address _singleton, bytes memory initializer, uint256 saltNonce ) public returns (GnosisSafeProxy proxy) { proxy = deployProxyWithNonce(_singleton, initializer, saltNonce); if (initializer.length > 0) // solhint-disable-next-line no-inline-assembly assembly { if eq(call(gas(), proxy, 0, add(initializer, 0x20), mload(initializer), 0, 0), 0) { revert(0, 0) } } emit ProxyCreation(proxy, _singleton); } /// @dev Allows to create new proxy contact, execute a message call to the new proxy and call a specified callback within one transaction /// @param _singleton Address of singleton contract. /// @param initializer Payload for message call sent to new proxy contract. /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. /// @param callback Callback that will be invoced after the new proxy contract has been successfully deployed and initialized. function createProxyWithCallback( address _singleton, bytes memory initializer, uint256 saltNonce, IProxyCreationCallback callback ) public returns (GnosisSafeProxy proxy) { uint256 saltNonceWithCallback = uint256(keccak256(abi.encodePacked(saltNonce, callback))); proxy = createProxyWithNonce(_singleton, initializer, saltNonceWithCallback); if (address(callback) != address(0)) callback.proxyCreated(proxy, _singleton, initializer, saltNonce); } /// @dev Allows to get the address for a new proxy contact created via `createProxyWithNonce` /// This method is only meant for address calculation purpose when you use an initializer that would revert, /// therefore the response is returned with a revert. When calling this method set `from` to the address of the proxy factory. /// @param _singleton Address of singleton contract. /// @param initializer Payload for message call sent to new proxy contract. /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. function calculateCreateProxyWithNonceAddress( address _singleton, bytes calldata initializer, uint256 saltNonce ) external returns (GnosisSafeProxy proxy) { proxy = deployProxyWithNonce(_singleton, initializer, saltNonce); revert(string(abi.encodePacked(proxy))); } } interface IProxyCreationCallback { function proxyCreated( GnosisSafeProxy proxy, address _singleton, bytes calldata initializer, uint256 saltNonce ) external; }
1
20,290,595
a18a80c146cf9abed45abd18fd3da590daaebd6b8d09660916876e9b24825669
770e2b94161f61fcc6e2c6bbe2bfa77a8bead8444ffff13ac238368daac973d6
371281c9b7bb14bab2bc4e65b3fe21c6af1a0438
ffa397285ce46fb78c588a9e993286aac68c37cd
13713cbaa84ca669bad9487b5240e87b83534d91
3d602d80600a3d3981f3363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3
pragma solidity 0.7.5; /* The MIT License (MIT) Copyright (c) 2018 Murray Software, LLC. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //solhint-disable max-line-length //solhint-disable no-inline-assembly contract CloneFactory { function createClone(address target, bytes32 salt) internal returns (address payable result) { bytes20 targetBytes = bytes20(target); assembly { // load the next free memory slot as a place to store the clone contract data let clone := mload(0x40) // The bytecode block below is responsible for contract initialization // during deployment, it is worth noting the proxied contract constructor will not be called during // the cloning procedure and that is why an initialization function needs to be called after the // clone is created mstore( clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000 ) // This stores the address location of the implementation contract // so that the proxy knows where to delegate call logic to mstore(add(clone, 0x14), targetBytes) // The bytecode block is the actual code that is deployed for each clone created. // It forwards all calls to the already deployed implementation via a delegatecall mstore( add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000 ) // deploy the contract using the CREATE2 opcode // this deploys the minimal proxy defined above, which will proxy all // calls to use the logic defined in the implementation contract `target` result := create2(0, clone, 0x37, salt) } } function isClone(address target, address query) internal view returns (bool result) { bytes20 targetBytes = bytes20(target); assembly { // load the next free memory slot as a place to store the comparison clone let clone := mload(0x40) // The next three lines store the expected bytecode for a miniml proxy // that targets `target` as its implementation contract mstore( clone, 0x363d3d373d3d3d363d7300000000000000000000000000000000000000000000 ) mstore(add(clone, 0xa), targetBytes) mstore( add(clone, 0x1e), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000 ) // the next two lines store the bytecode of the contract that we are checking in memory let other := add(clone, 0x40) extcodecopy(query, other, 0, 0x2d) // Check if the expected bytecode equals the actual bytecode and return the result result := and( eq(mload(clone), mload(other)), eq(mload(add(clone, 0xd)), mload(add(other, 0xd))) ) } } } /** * Contract that exposes the needed erc20 token functions */ abstract contract ERC20Interface { // Send _value amount of tokens to address _to function transfer(address _to, uint256 _value) public virtual returns (bool success); // Get the account balance of another account with address _owner function balanceOf(address _owner) public virtual view returns (uint256 balance); } // helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false library TransferHelper { function safeApprove( address token, address to, uint256 value ) internal { // bytes4(keccak256(bytes('approve(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::safeApprove: approve failed' ); } function safeTransfer( address token, address to, uint256 value ) internal { // bytes4(keccak256(bytes('transfer(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::safeTransfer: transfer failed' ); } function safeTransferFrom( address token, address from, address to, uint256 value ) internal { // bytes4(keccak256(bytes('transferFrom(address,address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::transferFrom: transferFrom failed' ); } function safeTransferETH(address to, uint256 value) internal { (bool success, ) = to.call{value: value}(new bytes(0)); require(success, 'TransferHelper::safeTransferETH: ETH transfer failed'); } } /** * Contract that will forward any incoming Ether to the creator of the contract * */ contract Forwarder { // Address to which any funds sent to this contract will be forwarded address public parentAddress; event ForwarderDeposited(address from, uint256 value, bytes data); /** * Initialize the contract, and sets the destination address to that of the creator */ function init(address _parentAddress) external onlyUninitialized { parentAddress = _parentAddress; uint256 value = address(this).balance; if (value == 0) { return; } (bool success, ) = parentAddress.call{ value: value }(''); require(success, 'Flush failed'); // NOTE: since we are forwarding on initialization, // we don't have the context of the original sender. // We still emit an event about the forwarding but set // the sender to the forwarder itself emit ForwarderDeposited(address(this), value, msg.data); } /** * Modifier that will execute internal code block only if the sender is the parent address */ modifier onlyParent { require(msg.sender == parentAddress, 'Only Parent'); _; } /** * Modifier that will execute internal code block only if the contract has not been initialized yet */ modifier onlyUninitialized { require(parentAddress == address(0x0), 'Already initialized'); _; } /** * Default function; Gets called when data is sent but does not match any other function */ fallback() external payable { flush(); } /** * Default function; Gets called when Ether is deposited with no data, and forwards it to the parent address */ receive() external payable { flush(); } /** * Execute a token transfer of the full balance from the forwarder token to the parent address * @param tokenContractAddress the address of the erc20 token contract */ function flushTokens(address tokenContractAddress) external onlyParent { ERC20Interface instance = ERC20Interface(tokenContractAddress); address forwarderAddress = address(this); uint256 forwarderBalance = instance.balanceOf(forwarderAddress); if (forwarderBalance == 0) { return; } TransferHelper.safeTransfer( tokenContractAddress, parentAddress, forwarderBalance ); } /** * Flush the entire balance of the contract to the parent address. */ function flush() public { uint256 value = address(this).balance; if (value == 0) { return; } (bool success, ) = parentAddress.call{ value: value }(''); require(success, 'Flush failed'); emit ForwarderDeposited(msg.sender, value, msg.data); } } contract ForwarderFactory is CloneFactory { address public implementationAddress; event ForwarderCreated(address newForwarderAddress, address parentAddress); constructor(address _implementationAddress) { implementationAddress = _implementationAddress; } function createForwarder(address parent, bytes32 salt) external { // include the signers in the salt so any contract deployed to a given address must have the same signers bytes32 finalSalt = keccak256(abi.encodePacked(parent, salt)); address payable clone = createClone(implementationAddress, finalSalt); Forwarder(clone).init(parent); emit ForwarderCreated(clone, parent); } }
1
20,290,596
0f8a070cceb88378609fbb4003bae9e7e1f2dc8058d85e4ed74a11b622b2c9ac
33daa22da94f09549423ae30885d774791a5729963db92b053a8173e3f607a87
b7af86d7b49ca0c618288723ea95c932e4fb4451
b7af86d7b49ca0c618288723ea95c932e4fb4451
fba8bfd1ed275dcbef65520834d1162b9d149cf5
608060405234801561001057600080fd5b5061001c60003361004b565b6100467f49158e7755ab83c8f0d2c16d9b586860364c40036a4c4efc69271654391b62a63361004b565b6100f7565b6100558282610059565b5050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16610055576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556100b33390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b610c91806101066000396000f3fe608060405234801561001057600080fd5b50600436106100d45760003560e01c806387df557411610081578063a217fddf1161005b578063a217fddf14610240578063b3066d4914610248578063d547741f1461025b57600080fd5b806387df5574146101c057806391d14854146101de5780639f8fbf071461022257600080fd5b806336568abe116100b257806336568abe146101475780634f47c9421461015a578063693545211461019957600080fd5b806301ffc9a7146100d9578063248a9ca3146101015780632f2ff15d14610132575b600080fd5b6100ec6100e73660046109af565b61026e565b60405190151581526020015b60405180910390f35b61012461010f3660046109f1565b60009081526020819052604090206001015490565b6040519081526020016100f8565b610145610140366004610a33565b610307565b005b610145610155366004610a33565b610331565b60015473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100f8565b6101247f49158e7755ab83c8f0d2c16d9b586860364c40036a4c4efc69271654391b62a681565b60035473ffffffffffffffffffffffffffffffffffffffff16610174565b6100ec6101ec366004610a33565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b60025473ffffffffffffffffffffffffffffffffffffffff16610174565b610124600081565b610145610256366004610a5f565b6103e9565b610145610269366004610a33565b6104b5565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061030157507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b600082815260208190526040902060010154610322816104da565b61032c83836104e7565b505050565b73ffffffffffffffffffffffffffffffffffffffff811633146103db576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6103e582826105d7565b5050565b3360009081527faa6c0a25fc961c6f84735ac1d3ac91e9c233b52a9f4aaa0cd1d67a40c7ddfd28602052604090205460ff16610451576040517fc0fc8a8a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001805473ffffffffffffffffffffffffffffffffffffffff9485167fffffffffffffffffffffffff000000000000000000000000000000000000000091821617909155600280549385169382169390931790925560038054919093169116179055565b6000828152602081905260409020600101546104d0816104da565b61032c83836105d7565b6104e4813361068e565b50565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166103e55760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556105793390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16156103e55760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166103e5576106cc81610746565b6106d7836020610765565b6040516020016106e8929190610ac6565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a00000000000000000000000000000000000000000000000000000000082526103d291600401610b47565b606061030173ffffffffffffffffffffffffffffffffffffffff831660145b60606000610774836002610bc7565b61077f906002610bde565b67ffffffffffffffff81111561079757610797610bf1565b6040519080825280601f01601f1916602001820160405280156107c1576020820181803683370190505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106107f8576107f8610c20565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f78000000000000000000000000000000000000000000000000000000000000008160018151811061085b5761085b610c20565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000610897846002610bc7565b6108a2906001610bde565b90505b600181111561093f577f303132333435363738396162636465660000000000000000000000000000000085600f16601081106108e3576108e3610c20565b1a60f81b8282815181106108f9576108f9610c20565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c9361093881610c4f565b90506108a5565b5083156109a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016103d2565b9392505050565b6000602082840312156109c157600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146109a857600080fd5b600060208284031215610a0357600080fd5b5035919050565b803573ffffffffffffffffffffffffffffffffffffffff81168114610a2e57600080fd5b919050565b60008060408385031215610a4657600080fd5b82359150610a5660208401610a0a565b90509250929050565b600080600060608486031215610a7457600080fd5b610a7d84610a0a565b9250610a8b60208501610a0a565b9150610a9960408501610a0a565b90509250925092565b60005b83811015610abd578181015183820152602001610aa5565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351610afe816017850160208801610aa2565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351610b3b816028840160208801610aa2565b01602801949350505050565b6020815260008251806020840152610b66816040850160208701610aa2565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808202811582820484141761030157610301610b98565b8082018082111561030157610301610b98565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081610c5e57610c5e610b98565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019056fea164736f6c6343000819000a
608060405234801561001057600080fd5b50600436106100d45760003560e01c806387df557411610081578063a217fddf1161005b578063a217fddf14610240578063b3066d4914610248578063d547741f1461025b57600080fd5b806387df5574146101c057806391d14854146101de5780639f8fbf071461022257600080fd5b806336568abe116100b257806336568abe146101475780634f47c9421461015a578063693545211461019957600080fd5b806301ffc9a7146100d9578063248a9ca3146101015780632f2ff15d14610132575b600080fd5b6100ec6100e73660046109af565b61026e565b60405190151581526020015b60405180910390f35b61012461010f3660046109f1565b60009081526020819052604090206001015490565b6040519081526020016100f8565b610145610140366004610a33565b610307565b005b610145610155366004610a33565b610331565b60015473ffffffffffffffffffffffffffffffffffffffff165b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100f8565b6101247f49158e7755ab83c8f0d2c16d9b586860364c40036a4c4efc69271654391b62a681565b60035473ffffffffffffffffffffffffffffffffffffffff16610174565b6100ec6101ec366004610a33565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b60025473ffffffffffffffffffffffffffffffffffffffff16610174565b610124600081565b610145610256366004610a5f565b6103e9565b610145610269366004610a33565b6104b5565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061030157507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b600082815260208190526040902060010154610322816104da565b61032c83836104e7565b505050565b73ffffffffffffffffffffffffffffffffffffffff811633146103db576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6103e582826105d7565b5050565b3360009081527faa6c0a25fc961c6f84735ac1d3ac91e9c233b52a9f4aaa0cd1d67a40c7ddfd28602052604090205460ff16610451576040517fc0fc8a8a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001805473ffffffffffffffffffffffffffffffffffffffff9485167fffffffffffffffffffffffff000000000000000000000000000000000000000091821617909155600280549385169382169390931790925560038054919093169116179055565b6000828152602081905260409020600101546104d0816104da565b61032c83836105d7565b6104e4813361068e565b50565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166103e55760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556105793390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16156103e55760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166103e5576106cc81610746565b6106d7836020610765565b6040516020016106e8929190610ac6565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a00000000000000000000000000000000000000000000000000000000082526103d291600401610b47565b606061030173ffffffffffffffffffffffffffffffffffffffff831660145b60606000610774836002610bc7565b61077f906002610bde565b67ffffffffffffffff81111561079757610797610bf1565b6040519080825280601f01601f1916602001820160405280156107c1576020820181803683370190505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106107f8576107f8610c20565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f78000000000000000000000000000000000000000000000000000000000000008160018151811061085b5761085b610c20565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000610897846002610bc7565b6108a2906001610bde565b90505b600181111561093f577f303132333435363738396162636465660000000000000000000000000000000085600f16601081106108e3576108e3610c20565b1a60f81b8282815181106108f9576108f9610c20565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c9361093881610c4f565b90506108a5565b5083156109a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016103d2565b9392505050565b6000602082840312156109c157600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146109a857600080fd5b600060208284031215610a0357600080fd5b5035919050565b803573ffffffffffffffffffffffffffffffffffffffff81168114610a2e57600080fd5b919050565b60008060408385031215610a4657600080fd5b82359150610a5660208401610a0a565b90509250929050565b600080600060608486031215610a7457600080fd5b610a7d84610a0a565b9250610a8b60208501610a0a565b9150610a9960408501610a0a565b90509250925092565b60005b83811015610abd578181015183820152602001610aa5565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351610afe816017850160208801610aa2565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351610b3b816028840160208801610aa2565b01602801949350505050565b6020815260008251806020840152610b66816040850160208701610aa2565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808202811582820484141761030157610301610b98565b8082018082111561030157610301610b98565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081610c5e57610c5e610b98565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019056fea164736f6c6343000819000a
{{ "language": "Solidity", "sources": { "openzeppelin-contracts/contracts/access/AccessControl.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControl.sol\";\nimport \"../utils/Context.sol\";\nimport \"../utils/Strings.sol\";\nimport \"../utils/introspection/ERC165.sol\";\n\n/**\n * @dev 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 * ```solidity\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 * ```solidity\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. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\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 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]{40}) is missing role (0x[0-9a-f]{64})$/\n *\n * _Available since v4.1._\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\n return _roles[role].members[account];\n }\n\n /**\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\n * Overriding this function changes the behavior of the {onlyRole} modifier.\n *\n * Format of the revert message is described in {_checkRole}.\n *\n * _Available since v4.6._\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\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]{40}) is missing role (0x[0-9a-f]{64})$/\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert(\n string(\n abi.encodePacked(\n \"AccessControl: account \",\n Strings.toHexString(account),\n \" is missing role \",\n Strings.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 virtual override 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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual override 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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual override 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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address account) public virtual override {\n require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\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 * May emit a {RoleGranted} event.\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 * NOTE: This function is deprecated in favor of {_grantRole}.\n */\n function _setupRole(bytes32 role, address account) internal virtual {\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 virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n emit RoleGranted(role, account, _msgSender());\n }\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n }\n }\n}\n" }, "openzeppelin-contracts/contracts/access/IAccessControl.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControl {\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 {AccessControl-_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 Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) external view returns (bool);\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 {AccessControl-_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\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;\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;\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}\n" }, "openzeppelin-contracts/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/contracts/utils/introspection/ERC165.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" }, "openzeppelin-contracts/contracts/utils/introspection/IERC165.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" }, "openzeppelin-contracts/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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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 256, 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 << 3) < value ? 1 : 0);\n }\n }\n}\n" }, "openzeppelin-contracts/contracts/utils/math/SignedMath.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" }, "openzeppelin-contracts/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\";\nimport \"./math/SignedMath.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 `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value))));\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 /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" }, "src/DCBReference.sol": { "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.25;\n\nimport { AccessControl } from \"openzeppelin-contracts/contracts/access/AccessControl.sol\";\n\ncontract DCBReference is AccessControl {\n bytes32 public constant CONTRACT_MODIFIER_ROLE = keccak256(\"CONTRACT_MODIFIER_ROLE\");\n\n address internal idoImpl;\n address internal l2eImpl;\n address internal vestingImpl;\n\n error NotManager();\n\n constructor() {\n _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());\n _setupRole(CONTRACT_MODIFIER_ROLE, _msgSender());\n }\n\n function setContracts(address _idoImpl, address _l2eImpl, address _vestingImpl) external {\n if (!hasRole(CONTRACT_MODIFIER_ROLE, _msgSender())) revert NotManager();\n idoImpl = _idoImpl;\n l2eImpl = _l2eImpl;\n vestingImpl = _vestingImpl;\n }\n\n function getIdoImpl() external view returns (address) {\n return idoImpl;\n }\n\n function getL2eImpl() external view returns (address) {\n return l2eImpl;\n }\n\n function getVestingImpl() external view returns (address) {\n return vestingImpl;\n }\n}\n" } }, "settings": { "metadata": { "bytecodeHash": "none" }, "optimizer": { "enabled": true, "runs": 10000 }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} } }}
1
20,290,596
0f8a070cceb88378609fbb4003bae9e7e1f2dc8058d85e4ed74a11b622b2c9ac
f2b96dca2ad8fd6317d019d37655192f475cdb2314b32cf152912552ab085432
c9aad2fc90eddacf02bd11fa690e3b44e318aa9b
a2a1bf5a83f9daec2dc364e1c561e937163cb613
497e5b99184f6a24fd7396619225933d58121813
3d602d80600a3d3981f3363d3d373d3d3d363d7387ae9be718aa310323042ab9806bd6692c1129b75af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7387ae9be718aa310323042ab9806bd6692c1129b75af43d82803e903d91602b57fd5bf3
1
20,290,596
0f8a070cceb88378609fbb4003bae9e7e1f2dc8058d85e4ed74a11b622b2c9ac
3e4f2cf5c1d34fe6c9670bd9f6573f7f2991fe0902021a0106a42d5c9be46263
00bdb5699745f5b860228c8f939abf1b9ae374ed
ffa397285ce46fb78c588a9e993286aac68c37cd
8e3ba529fac67757ddc34ea04372450c653f34f0
3d602d80600a3d3981f3363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3
pragma solidity 0.7.5; /* The MIT License (MIT) Copyright (c) 2018 Murray Software, LLC. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //solhint-disable max-line-length //solhint-disable no-inline-assembly contract CloneFactory { function createClone(address target, bytes32 salt) internal returns (address payable result) { bytes20 targetBytes = bytes20(target); assembly { // load the next free memory slot as a place to store the clone contract data let clone := mload(0x40) // The bytecode block below is responsible for contract initialization // during deployment, it is worth noting the proxied contract constructor will not be called during // the cloning procedure and that is why an initialization function needs to be called after the // clone is created mstore( clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000 ) // This stores the address location of the implementation contract // so that the proxy knows where to delegate call logic to mstore(add(clone, 0x14), targetBytes) // The bytecode block is the actual code that is deployed for each clone created. // It forwards all calls to the already deployed implementation via a delegatecall mstore( add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000 ) // deploy the contract using the CREATE2 opcode // this deploys the minimal proxy defined above, which will proxy all // calls to use the logic defined in the implementation contract `target` result := create2(0, clone, 0x37, salt) } } function isClone(address target, address query) internal view returns (bool result) { bytes20 targetBytes = bytes20(target); assembly { // load the next free memory slot as a place to store the comparison clone let clone := mload(0x40) // The next three lines store the expected bytecode for a miniml proxy // that targets `target` as its implementation contract mstore( clone, 0x363d3d373d3d3d363d7300000000000000000000000000000000000000000000 ) mstore(add(clone, 0xa), targetBytes) mstore( add(clone, 0x1e), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000 ) // the next two lines store the bytecode of the contract that we are checking in memory let other := add(clone, 0x40) extcodecopy(query, other, 0, 0x2d) // Check if the expected bytecode equals the actual bytecode and return the result result := and( eq(mload(clone), mload(other)), eq(mload(add(clone, 0xd)), mload(add(other, 0xd))) ) } } } /** * Contract that exposes the needed erc20 token functions */ abstract contract ERC20Interface { // Send _value amount of tokens to address _to function transfer(address _to, uint256 _value) public virtual returns (bool success); // Get the account balance of another account with address _owner function balanceOf(address _owner) public virtual view returns (uint256 balance); } // helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false library TransferHelper { function safeApprove( address token, address to, uint256 value ) internal { // bytes4(keccak256(bytes('approve(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::safeApprove: approve failed' ); } function safeTransfer( address token, address to, uint256 value ) internal { // bytes4(keccak256(bytes('transfer(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::safeTransfer: transfer failed' ); } function safeTransferFrom( address token, address from, address to, uint256 value ) internal { // bytes4(keccak256(bytes('transferFrom(address,address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::transferFrom: transferFrom failed' ); } function safeTransferETH(address to, uint256 value) internal { (bool success, ) = to.call{value: value}(new bytes(0)); require(success, 'TransferHelper::safeTransferETH: ETH transfer failed'); } } /** * Contract that will forward any incoming Ether to the creator of the contract * */ contract Forwarder { // Address to which any funds sent to this contract will be forwarded address public parentAddress; event ForwarderDeposited(address from, uint256 value, bytes data); /** * Initialize the contract, and sets the destination address to that of the creator */ function init(address _parentAddress) external onlyUninitialized { parentAddress = _parentAddress; uint256 value = address(this).balance; if (value == 0) { return; } (bool success, ) = parentAddress.call{ value: value }(''); require(success, 'Flush failed'); // NOTE: since we are forwarding on initialization, // we don't have the context of the original sender. // We still emit an event about the forwarding but set // the sender to the forwarder itself emit ForwarderDeposited(address(this), value, msg.data); } /** * Modifier that will execute internal code block only if the sender is the parent address */ modifier onlyParent { require(msg.sender == parentAddress, 'Only Parent'); _; } /** * Modifier that will execute internal code block only if the contract has not been initialized yet */ modifier onlyUninitialized { require(parentAddress == address(0x0), 'Already initialized'); _; } /** * Default function; Gets called when data is sent but does not match any other function */ fallback() external payable { flush(); } /** * Default function; Gets called when Ether is deposited with no data, and forwards it to the parent address */ receive() external payable { flush(); } /** * Execute a token transfer of the full balance from the forwarder token to the parent address * @param tokenContractAddress the address of the erc20 token contract */ function flushTokens(address tokenContractAddress) external onlyParent { ERC20Interface instance = ERC20Interface(tokenContractAddress); address forwarderAddress = address(this); uint256 forwarderBalance = instance.balanceOf(forwarderAddress); if (forwarderBalance == 0) { return; } TransferHelper.safeTransfer( tokenContractAddress, parentAddress, forwarderBalance ); } /** * Flush the entire balance of the contract to the parent address. */ function flush() public { uint256 value = address(this).balance; if (value == 0) { return; } (bool success, ) = parentAddress.call{ value: value }(''); require(success, 'Flush failed'); emit ForwarderDeposited(msg.sender, value, msg.data); } } contract ForwarderFactory is CloneFactory { address public implementationAddress; event ForwarderCreated(address newForwarderAddress, address parentAddress); constructor(address _implementationAddress) { implementationAddress = _implementationAddress; } function createForwarder(address parent, bytes32 salt) external { // include the signers in the salt so any contract deployed to a given address must have the same signers bytes32 finalSalt = keccak256(abi.encodePacked(parent, salt)); address payable clone = createClone(implementationAddress, finalSalt); Forwarder(clone).init(parent); emit ForwarderCreated(clone, parent); } }
1
20,290,597
9ee757be9a67b86472149ea6300dcf54bf5b9e426888908c60d05db358471a93
b0d1f64cadff1bba607a84a1c0b99d2e0fa577da0ef106ca291e19d42bd21f2b
b7af86d7b49ca0c618288723ea95c932e4fb4451
b7af86d7b49ca0c618288723ea95c932e4fb4451
c5e5018f5a7f7f064744db50da721983f8607d5e
6080604052348015600f57600080fd5b506016601a565b60d8565b600054610100900460ff161560855760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff908116101560d6576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b61341f806100e76000396000f3fe608060405234801561001057600080fd5b50600436106102265760003560e01c80639d76ea581161012a578063c6e82e12116100bd578063dbc300cf1161008c578063e57edded11610071578063e57edded146104eb578063f0333f7c146104fe578063f746c6a11461050757600080fd5b8063dbc300cf146104c5578063e5445c31146104d857600080fd5b8063c6e82e1214610483578063cea531e314610496578063d547741f1461049f578063d602a671146104b257600080fd5b8063ba62b8a7116100f9578063ba62b8a714610437578063bd0934f31461044a578063c306b3781461045d578063c556c32a1461047057600080fd5b80639d76ea58146103f6578063a217fddf14610409578063b077e73614610411578063b456dac91461042457600080fd5b80634c937ce2116101bd5780637aed2b001161018c57806391d148541161017157806391d148541461039757806395249c58146103d05780639759164a146103e357600080fd5b80637aed2b0014610371578063857184d11461038457600080fd5b80634c937ce2146103255780635e6f6045146103385780636c587f191461034b5780637226e62b1461035e57600080fd5b806329d16a67116101f957806329d16a67146102bf5780632f2ff15d146102ea57806336568abe146102ff5780633a2dde8d1461031257600080fd5b806301ffc9a71461022b5780631002521114610253578063248a9ca31461027b578063269b08de146102ac575b600080fd5b61023e61023936600461261e565b610532565b60405190151581526020015b60405180910390f35b610266610261366004612675565b6105cb565b6040805192835260208301919091520161024a565b61029e610289366004612692565b60009081526065602052604090206001015490565b60405190815260200161024a565b61029e6102ba366004612675565b6106b0565b6098546102d2906001600160a01b031681565b6040516001600160a01b03909116815260200161024a565b6102fd6102f83660046126ab565b6106c2565b005b6102fd61030d3660046126ab565b6106ec565b6097546102d2906001600160a01b031681565b6102fd610333366004612720565b610797565b609e546102d2906001600160a01b031681565b6102666103593660046127ba565b6108ad565b6102fd61036c3660046127e8565b610b22565b6102fd61037f366004612867565b610c94565b610266610392366004612675565b610d46565b61023e6103a53660046126ab565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6102666103de3660046127ba565b61110b565b609d546102d2906001600160a01b031681565b60a1546102d2906001600160a01b031681565b61029e600081565b6102fd61041f3660046127e8565b611396565b6102666104323660046127ba565b6114bd565b609c546102d2906001600160a01b031681565b6099546102d2906001600160a01b031681565b6102fd61046b366004612895565b611850565b61026661047e366004612675565b611aef565b609f546102d2906001600160a01b031681565b61029e60a25481565b6102fd6104ad3660046126ab565b611c55565b609b546102d2906001600160a01b031681565b609a546102d2906001600160a01b031681565b6102666104e6366004612965565b611c7a565b6102fd6104f93660046129b0565b6120b6565b61029e60a35481565b61029e6105153660046129d2565b60a060209081526000928352604080842090915290825290205481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b0000000000000000000000000000000000000000000000000000000014806105c557507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b609f546000908190819081906105eb9086906001600160a01b03166108ad565b90925090506105fa8285612a2d565b93506106068184612a2d565b609c549093506106229086906001600160a01b03166000611c7a565b90925090506106318285612a2d565b935061063d8184612a2d565b609b549093506106579086906001600160a01b031661110b565b90925090506106668285612a2d565b93506106728184612a2d565b609d5490935061068c9086906001600160a01b03166114bd565b909250905061069b8285612a2d565b93506106a78184612a2d565b92505050915091565b60006106bb82610d46565b9392505050565b6000828152606560205260409020600101546106dd81612129565b6106e78383612136565b505050565b6001600160a01b0381163314610789576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b61079382826121f6565b5050565b3360009081527fcee91eb23e767f0f440dd9fce5554f355614443931e9ac5ce78c67b9e06e6f70602052604090205460ff166107ff576040517fc0b2335a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b858110156108a45782828281811061081c5761081c612a40565b9050602002013560a0600089898581811061083957610839612a40565b905060200201602081019061084e9190612675565b6001600160a01b03166001600160a01b03168152602001908152602001600020600087878581811061088257610882612a40565b6020908102929092013583525081019190915260400160002055600101610802565b50505050505050565b6000806001600160a01b03831615610b1b576000808490506000816001600160a01b031663081e3eda6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610905573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109299190612a6f565b905060005b81811015610b16576040517f1526fe27000000000000000000000000000000000000000000000000000000008152600481018290526000906001600160a01b03851690631526fe279060240161014060405180830381865afa158015610998573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109bc9190612ac9565b5060a1549099506001600160a01b03908116908a16039750610b0d9650505050505050576040517fb9d02df4000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b038a8116602483015285169063b9d02df49060440160a060405180830381865afa158015610a46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6a9190612b84565b50929750610a7e9250879150889050612a2d565b9550600085118015610ab257506001600160a01b038416600090815260a06020908152604080832085845290915290205415155b15610b00576001600160a01b038416600090815260a0602090815260408083208584529091529020546103e890610ae99087612bd4565b610af39190612beb565b610afd9086612a2d565b94505b610b0a8588612a2d565b96505b5060010161092e565b505050505b9250929050565b3360009081527fcee91eb23e767f0f440dd9fce5554f355614443931e9ac5ce78c67b9e06e6f70602052604090205460ff16610b8a576040517fc0b2335a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038116610bca576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b609780546001600160a01b038781167fffffffffffffffffffffffff00000000000000000000000000000000000000009283168117909355609a8054888316908416811790915560988054888416908516811790915560998054888516908616811790915560a1805494881694909516841790945560408051958652602086019290925290840152606083019190915260808201527f29f479723657db0dce5c61112a080c51487f6794a0a7826f0db4219b3b7414469060a0015b60405180910390a15050505050565b6000610c9f81612129565b8115610cd457610ccf7f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b08846106c2565b610cfe565b610cfe7f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0884611c55565b604080516001600160a01b038516815283151560208201527f4e0821e9e83e6ed2861d90c07a96114379e9c5b5e6ea2afec5ac6e49d745314c910160405180910390a1505050565b600080610d5283611aef565b9092509050600080610d63856105cb565b609e549193509150600090819081906001600160a01b03161561107957610dcd6040518060e0016040528060006001600160a01b03168152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b609e54604080517f79bf4a6300000000000000000000000000000000000000000000000000000000815290516000926001600160a01b0316916379bf4a6391600480830192869291908290030181865afa158015610e2f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610e579190810190612e07565b805190915060005b8181101561107457609e546040517fafee1ff1000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b038e811660248301529091169063afee1ff190604401602060405180830381865afa158015610ed1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef59190612f80565b1561106c57609e546040517fc47c9f3c000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b038e811660248301529091169063c47c9f3c9060440160e060405180830381865afa158015610f64573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f889190612f9d565b93508360400151846020015110610fb25783604001518460200151610fad9190613039565b610fb5565b60005b9650610fc1878b612a2d565b9950610fcd8787612a2d565b95506000871180156110035750609e546001600160a01b0316600090815260a06020908152604080832084845290915290205415155b1561105357609e546001600160a01b0316600090815260a0602090815260408083208484529091529020546103e89061103c9089612bd4565b6110469190612beb565b6110509088612a2d565b96505b61105d878c612a2d565b9a506110698786612a2d565b94505b600101610e5f565b505050505b6110838588612a2d565b965061108f8487612a2d565b955060a2548710611101576103e860a3546103e86110ad9190613039565b6110b79083612bd4565b6110c19190612beb565b6110cb9088613039565b96506103e860a3546103e86110e09190613039565b6110ea9084612bd4565b6110f49190612beb565b6110fe9087613039565b95505b5050505050915091565b6000806001600160a01b03831615610b1b576000806000859050806001600160a01b031663081e3eda6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611163573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111879190612a6f565b604080518082019091526000808252602082015290935060005b8481101561138a576040517f1526fe27000000000000000000000000000000000000000000000000000000008152600481018290526001600160a01b03841690631526fe27906024016101a060405180830381865afa158015611208573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061122c91906130b1565b505060a1548451949b506001600160a01b0390811694169390930397506113829650505050505050576040517fb9d02df4000000000000000000000000000000000000000000000000000000008152600481018290526001600160a01b038a8116602483015284169063b9d02df49060440160a060405180830381865afa1580156112bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112df919061315c565b509296506112f39250869150889050612a2d565b955060008411801561132757506001600160a01b038316600090815260a06020908152604080832084845290915290205415155b15611375576001600160a01b038316600090815260a0602090815260408083208484529091529020546103e89061135e9086612bd4565b6113689190612beb565b6113729085612a2d565b93505b61137f8488612a2d565b96505b6001016111a1565b50505050509250929050565b3360009081527fcee91eb23e767f0f440dd9fce5554f355614443931e9ac5ce78c67b9e06e6f70602052604090205460ff166113fe576040517fc0b2335a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b609b80546001600160a01b038781167fffffffffffffffffffffffff00000000000000000000000000000000000000009283168117909355609c80548883169084168117909155609d80548884169085168117909155609e80548885169086168117909155609f805494881694909516841790945560408051958652602086019290925290840152606083019190915260808201527fd8dd2c0add7ec1b00dd0c6e49b2d6336d6191311bcc26e8cf48dc5c063e998f89060a001610c85565b6000806001600160a01b03831615610b1b576000806000859050806001600160a01b031663081e3eda6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611515573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115399190612a6f565b92506000805b8481101561138a576040517fac4afa38000000000000000000000000000000000000000000000000000000008152600481018290526001600160a01b0384169063ac4afa389060240161014060405180830381865afa1580156115a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115ca9190612ac9565b5060a154604080517f0dfe16810000000000000000000000000000000000000000000000000000000081529051929c508c9a506001600160a01b039182169950908a169750630dfe16819650600480820196506020955091935083900301905081865afa15801561163f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611663919061319c565b6001600160a01b03161480611707575060a154604080517fd21220a700000000000000000000000000000000000000000000000000000000815290516001600160a01b039283169284169163d21220a79160048083019260209291908290030181865afa1580156116d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116fc919061319c565b6001600160a01b0316145b15611847576040517f56eeafd9000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b038b811660248301528516906356eeafd990604401602060405180830381865afa158015611772573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117969190612a6f565b94506117a3856002612bd4565b6117ad9088612a2d565b96506000851180156117e157506001600160a01b038416600090815260a06020908152604080832085845290915290205415155b1561182f576001600160a01b038416600090815260a0602090815260408083208584529091529020546103e8906118189087612bd4565b6118229190612beb565b61182c9086612a2d565b94505b61183a856002612bd4565b6118449089612a2d565b97505b5060010161153f565b600054610100900460ff16158080156118705750600054600160ff909116105b8061188a5750303b15801561188a575060005460ff166001145b611916576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610780565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055801561197457600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b61197c612297565b611987600033612330565b6119b17f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0833612330565b609780547fffffffffffffffffffffffff00000000000000000000000000000000000000009081166001600160a01b038e811691909117909255609a805482168b84161790556098805482168d84161790556099805482168c8416179055609b805482168a8416179055609c80548216898416179055609d80548216888416179055609e80548216878416179055609f8054821686841617905560a180549091169184169190911790557fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60a2558015611ae257600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050505050565b609a5460009081908190819081906001600160a01b031615611bad57609a546040517fe9081ec70000000000000000000000000000000000000000000000000000000081526001600160a01b0388811660048301529091169063e9081ec790602401602060405180830381865afa158015611b6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b929190612a6f565b9250611b9e8386612a2d565b9450611baa8385612a2d565b93505b609854611bc69087906001600160a01b03166001611c7a565b9092509050611bd58286612a2d565b9450611be18185612a2d565b609754909450611bfb9087906001600160a01b031661110b565b9092509050611c0a8286612a2d565b9450611c168185612a2d565b609954909450611c309087906001600160a01b03166114bd565b9092509050611c3f8286612a2d565b9450611c4b8185612a2d565b9350505050915091565b600082815260656020526040902060010154611c7081612129565b6106e783836121f6565b6000806001600160a01b038416156120ae576000806000808790506000816001600160a01b031663fb1db2786040518163ffffffff1660e01b8152600401602060405180830381865afa158015611cd5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cf9919061319c565b9050806001600160a01b031663081e3eda6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611d39573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d5d9190612a6f565b945060005b858110156120a7578815611e6c576000836001600160a01b031663fb1db2786040518163ffffffff1660e01b8152600401602060405180830381865afa158015611db0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dd4919061319c565b6040517f1526fe27000000000000000000000000000000000000000000000000000000008152600481018490529091506001600160a01b03821690631526fe27906024016101a060405180830381865afa158015611e36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e5a91906131b9565b9d50611f5f9950505050505050505050565b6000836001600160a01b031663fb1db2786040518163ffffffff1660e01b8152600401602060405180830381865afa158015611eac573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ed0919061319c565b6040517f1526fe27000000000000000000000000000000000000000000000000000000008152600481018490529091506001600160a01b03821690631526fe279060240160e060405180830381865afa158015611f31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f559190613293565b9a50505050505050505b60a1546001600160a01b039081169085160361209f576040517fb9d02df4000000000000000000000000000000000000000000000000000000008152600481018290526001600160a01b038c8116602483015284169063b9d02df490604401608060405180830381865afa158015611fdb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fff91906132f3565b509650612010915086905088612a2d565b965060008511801561204457506001600160a01b038316600090815260a06020908152604080832084845290915290205415155b15612092576001600160a01b038316600090815260a0602090815260408083208484529091529020546103e89061207b9087612bd4565b6120859190612beb565b61208f9086612a2d565b94505b61209c8589612a2d565b97505b600101611d62565b5050505050505b935093915050565b3360009081527fcee91eb23e767f0f440dd9fce5554f355614443931e9ac5ce78c67b9e06e6f70602052604090205460ff1661211e576040517fc0b2335a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60a29190915560a355565b612133813361233a565b50565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff166107935760008281526065602090815260408083206001600160a01b0385168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556121b23390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff16156107935760008281526065602090815260408083206001600160a01b038516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600054610100900460ff1661232e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610780565b565b6107938282612136565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff166107935761236d816123c9565b6123788360206123db565b604051602001612389929190613329565b60408051601f19818403018152908290527f08c379a0000000000000000000000000000000000000000000000000000000008252610780916004016133aa565b60606105c56001600160a01b03831660145b606060006123ea836002612bd4565b6123f5906002612a2d565b67ffffffffffffffff81111561240d5761240d612c26565b6040519080825280601f01601f191660200182016040528015612437576020820181803683370190505b5090507f30000000000000000000000000000000000000000000000000000000000000008160008151811061246e5761246e612a40565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106124d1576124d1612a40565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600061250d846002612bd4565b612518906001612a2d565b90505b60018111156125b5577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061255957612559612a40565b1a60f81b82828151811061256f5761256f612a40565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c936125ae816133dd565b905061251b565b5083156106bb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610780565b60006020828403121561263057600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146106bb57600080fd5b6001600160a01b038116811461213357600080fd5b60006020828403121561268757600080fd5b81356106bb81612660565b6000602082840312156126a457600080fd5b5035919050565b600080604083850312156126be57600080fd5b8235915060208301356126d081612660565b809150509250929050565b60008083601f8401126126ed57600080fd5b50813567ffffffffffffffff81111561270557600080fd5b6020830191508360208260051b8501011115610b1b57600080fd5b6000806000806000806060878903121561273957600080fd5b863567ffffffffffffffff8082111561275157600080fd5b61275d8a838b016126db565b9098509650602089013591508082111561277657600080fd5b6127828a838b016126db565b9096509450604089013591508082111561279b57600080fd5b506127a889828a016126db565b979a9699509497509295939492505050565b600080604083850312156127cd57600080fd5b82356127d881612660565b915060208301356126d081612660565b600080600080600060a0868803121561280057600080fd5b853561280b81612660565b9450602086013561281b81612660565b9350604086013561282b81612660565b9250606086013561283b81612660565b9150608086013561284b81612660565b809150509295509295909350565b801515811461213357600080fd5b6000806040838503121561287a57600080fd5b823561288581612660565b915060208301356126d081612859565b6000806000806000806000806000806101408b8d0312156128b557600080fd5b8a356128c081612660565b995060208b01356128d081612660565b985060408b01356128e081612660565b975060608b01356128f081612660565b965060808b013561290081612660565b955060a08b013561291081612660565b945060c08b013561292081612660565b935060e08b013561293081612660565b92506101008b013561294181612660565b91506101208b013561295281612660565b809150509295989b9194979a5092959850565b60008060006060848603121561297a57600080fd5b833561298581612660565b9250602084013561299581612660565b915060408401356129a581612859565b809150509250925092565b600080604083850312156129c357600080fd5b50508035926020909101359150565b600080604083850312156129e557600080fd5b82356129f081612660565b946020939093013593505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808201808211156105c5576105c56129fe565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215612a8157600080fd5b5051919050565b8051612a9381612859565b919050565b805161ffff81168114612a9357600080fd5b805163ffffffff81168114612a9357600080fd5b8051612a9381612660565b6000806000806000806000806000806101408b8d031215612ae957600080fd5b8a51612af481612859565b9950612b0260208c01612a98565b9850612b1060408c01612aaa565b9750612b1e60608c01612aaa565b9650612b2c60808c01612aaa565b955060a08b01516fffffffffffffffffffffffffffffffff81168114612b5157600080fd5b8095505060c08b0151935060e08b015192506101008b0151612b7281612660565b6101208c015190925061295281612660565b600080600080600060a08688031215612b9c57600080fd5b8551945060208601519350612bb360408701612aaa565b9250612bc160608701612aaa565b9150608086015190509295509295909350565b80820281158282048414176105c5576105c56129fe565b600082612c21577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051610140810167ffffffffffffffff81118282101715612c7957612c79612c26565b60405290565b6040516080810167ffffffffffffffff81118282101715612c7957612c79612c26565b604051601f8201601f1916810167ffffffffffffffff81118282101715612ccb57612ccb612c26565b604052919050565b600067ffffffffffffffff821115612ced57612ced612c26565b5060051b60200190565b60005b83811015612d12578181015183820152602001612cfa565b50506000910152565b600082601f830112612d2c57600080fd5b815167ffffffffffffffff811115612d4657612d46612c26565b612d596020601f19601f84011601612ca2565b818152846020838601011115612d6e57600080fd5b612d7f826020830160208701612cf7565b949350505050565b805160ff81168114612a9357600080fd5b600082601f830112612da957600080fd5b81516020612dbe612db983612cd3565b612ca2565b8083825260208201915060208460051b870101935086841115612de057600080fd5b602086015b84811015612dfc5780518352918301918301612de5565b509695505050505050565b60006020808385031215612e1a57600080fd5b825167ffffffffffffffff80821115612e3257600080fd5b818501915085601f830112612e4657600080fd5b8151612e54612db982612cd3565b81815260059190911b83018401908481019088831115612e7357600080fd5b8585015b83811015612f7357805185811115612e8f5760008081fd5b8601610140818c03601f1901811315612ea85760008081fd5b612eb0612c55565b8983015188811115612ec25760008081fd5b612ed08e8c83870101612d1b565b8252506040808401518b830152606080850151828401526080915081850151818401525060a0808501518284015260c09150612f0d828601612a88565b9083015260e0612f1e858201612d87565b828401526101009150818501518184015250610120808501518284015283850151935089841115612f5157600091508182fd5b612f5f8f8d86880101612d98565b908301525085525050918601918601612e77565b5098975050505050505050565b600060208284031215612f9257600080fd5b81516106bb81612859565b600060e08284031215612faf57600080fd5b60405160e0810181811067ffffffffffffffff82111715612fd257612fd2612c26565b6040528251612fe081612660565b808252506020830151602082015260408301516040820152606083015160608201526080830151608082015260a083015161301a81612859565b60a082015260c083015161302d81612859565b60c08201529392505050565b818103818111156105c5576105c56129fe565b60006040828403121561305e57600080fd5b6040516040810181811067ffffffffffffffff8211171561308157613081612c26565b8060405250809150825161309481612660565b815260208301516130a481612660565b6020919091015292915050565b60008060008060008060008060008060006101a08c8e0312156130d357600080fd5b8b519a5060208c0151995060408c0151985060608c0151975060808c015196506131008d60a08e0161304c565b955061310f8d60e08e0161304c565b94506101208c015193506101408c015161312881612660565b92506131376101608d01612aaa565b91506101808c015161314881612859565b809150509295989b509295989b9093969950565b600080600080600060a0868803121561317457600080fd5b5050835160208501516040860151606087015160809097015192989197509594509092509050565b6000602082840312156131ae57600080fd5b81516106bb81612660565b6000806000806000806000806000808a8c036101a08112156131da57600080fd5b8b519a506080601f19820112156131f057600080fd5b506131f9612c7f565b60208c015161320781612859565b815261321560408d01612a98565b602082015261322660608d01612a98565b604082015261323760808d01612a98565b60608201528099505060a08b0151975060c08b0151965060e08b015195506101008b015194506101208b015193506101408b015192506101608b015191506132826101808c01612abe565b90509295989b9194979a5092959850565b600080600080600080600060e0888a0312156132ae57600080fd5b875196506020880151955060408801519450606088015193506080880151925060a0880151915060c08801516132e381612660565b8091505092959891949750929550565b6000806000806080858703121561330957600080fd5b505082516020840151604085015160609095015191969095509092509050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351613361816017850160208801612cf7565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000601791840191820152835161339e816028840160208801612cf7565b01602801949350505050565b60208152600082518060208401526133c9816040850160208701612cf7565b601f01601f19169190910160400192915050565b6000816133ec576133ec6129fe565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019056fea164736f6c6343000819000a
608060405234801561001057600080fd5b50600436106102265760003560e01c80639d76ea581161012a578063c6e82e12116100bd578063dbc300cf1161008c578063e57edded11610071578063e57edded146104eb578063f0333f7c146104fe578063f746c6a11461050757600080fd5b8063dbc300cf146104c5578063e5445c31146104d857600080fd5b8063c6e82e1214610483578063cea531e314610496578063d547741f1461049f578063d602a671146104b257600080fd5b8063ba62b8a7116100f9578063ba62b8a714610437578063bd0934f31461044a578063c306b3781461045d578063c556c32a1461047057600080fd5b80639d76ea58146103f6578063a217fddf14610409578063b077e73614610411578063b456dac91461042457600080fd5b80634c937ce2116101bd5780637aed2b001161018c57806391d148541161017157806391d148541461039757806395249c58146103d05780639759164a146103e357600080fd5b80637aed2b0014610371578063857184d11461038457600080fd5b80634c937ce2146103255780635e6f6045146103385780636c587f191461034b5780637226e62b1461035e57600080fd5b806329d16a67116101f957806329d16a67146102bf5780632f2ff15d146102ea57806336568abe146102ff5780633a2dde8d1461031257600080fd5b806301ffc9a71461022b5780631002521114610253578063248a9ca31461027b578063269b08de146102ac575b600080fd5b61023e61023936600461261e565b610532565b60405190151581526020015b60405180910390f35b610266610261366004612675565b6105cb565b6040805192835260208301919091520161024a565b61029e610289366004612692565b60009081526065602052604090206001015490565b60405190815260200161024a565b61029e6102ba366004612675565b6106b0565b6098546102d2906001600160a01b031681565b6040516001600160a01b03909116815260200161024a565b6102fd6102f83660046126ab565b6106c2565b005b6102fd61030d3660046126ab565b6106ec565b6097546102d2906001600160a01b031681565b6102fd610333366004612720565b610797565b609e546102d2906001600160a01b031681565b6102666103593660046127ba565b6108ad565b6102fd61036c3660046127e8565b610b22565b6102fd61037f366004612867565b610c94565b610266610392366004612675565b610d46565b61023e6103a53660046126ab565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6102666103de3660046127ba565b61110b565b609d546102d2906001600160a01b031681565b60a1546102d2906001600160a01b031681565b61029e600081565b6102fd61041f3660046127e8565b611396565b6102666104323660046127ba565b6114bd565b609c546102d2906001600160a01b031681565b6099546102d2906001600160a01b031681565b6102fd61046b366004612895565b611850565b61026661047e366004612675565b611aef565b609f546102d2906001600160a01b031681565b61029e60a25481565b6102fd6104ad3660046126ab565b611c55565b609b546102d2906001600160a01b031681565b609a546102d2906001600160a01b031681565b6102666104e6366004612965565b611c7a565b6102fd6104f93660046129b0565b6120b6565b61029e60a35481565b61029e6105153660046129d2565b60a060209081526000928352604080842090915290825290205481565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b0000000000000000000000000000000000000000000000000000000014806105c557507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b609f546000908190819081906105eb9086906001600160a01b03166108ad565b90925090506105fa8285612a2d565b93506106068184612a2d565b609c549093506106229086906001600160a01b03166000611c7a565b90925090506106318285612a2d565b935061063d8184612a2d565b609b549093506106579086906001600160a01b031661110b565b90925090506106668285612a2d565b93506106728184612a2d565b609d5490935061068c9086906001600160a01b03166114bd565b909250905061069b8285612a2d565b93506106a78184612a2d565b92505050915091565b60006106bb82610d46565b9392505050565b6000828152606560205260409020600101546106dd81612129565b6106e78383612136565b505050565b6001600160a01b0381163314610789576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b61079382826121f6565b5050565b3360009081527fcee91eb23e767f0f440dd9fce5554f355614443931e9ac5ce78c67b9e06e6f70602052604090205460ff166107ff576040517fc0b2335a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b858110156108a45782828281811061081c5761081c612a40565b9050602002013560a0600089898581811061083957610839612a40565b905060200201602081019061084e9190612675565b6001600160a01b03166001600160a01b03168152602001908152602001600020600087878581811061088257610882612a40565b6020908102929092013583525081019190915260400160002055600101610802565b50505050505050565b6000806001600160a01b03831615610b1b576000808490506000816001600160a01b031663081e3eda6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610905573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109299190612a6f565b905060005b81811015610b16576040517f1526fe27000000000000000000000000000000000000000000000000000000008152600481018290526000906001600160a01b03851690631526fe279060240161014060405180830381865afa158015610998573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109bc9190612ac9565b5060a1549099506001600160a01b03908116908a16039750610b0d9650505050505050576040517fb9d02df4000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b038a8116602483015285169063b9d02df49060440160a060405180830381865afa158015610a46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6a9190612b84565b50929750610a7e9250879150889050612a2d565b9550600085118015610ab257506001600160a01b038416600090815260a06020908152604080832085845290915290205415155b15610b00576001600160a01b038416600090815260a0602090815260408083208584529091529020546103e890610ae99087612bd4565b610af39190612beb565b610afd9086612a2d565b94505b610b0a8588612a2d565b96505b5060010161092e565b505050505b9250929050565b3360009081527fcee91eb23e767f0f440dd9fce5554f355614443931e9ac5ce78c67b9e06e6f70602052604090205460ff16610b8a576040517fc0b2335a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038116610bca576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b609780546001600160a01b038781167fffffffffffffffffffffffff00000000000000000000000000000000000000009283168117909355609a8054888316908416811790915560988054888416908516811790915560998054888516908616811790915560a1805494881694909516841790945560408051958652602086019290925290840152606083019190915260808201527f29f479723657db0dce5c61112a080c51487f6794a0a7826f0db4219b3b7414469060a0015b60405180910390a15050505050565b6000610c9f81612129565b8115610cd457610ccf7f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b08846106c2565b610cfe565b610cfe7f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0884611c55565b604080516001600160a01b038516815283151560208201527f4e0821e9e83e6ed2861d90c07a96114379e9c5b5e6ea2afec5ac6e49d745314c910160405180910390a1505050565b600080610d5283611aef565b9092509050600080610d63856105cb565b609e549193509150600090819081906001600160a01b03161561107957610dcd6040518060e0016040528060006001600160a01b03168152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b609e54604080517f79bf4a6300000000000000000000000000000000000000000000000000000000815290516000926001600160a01b0316916379bf4a6391600480830192869291908290030181865afa158015610e2f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610e579190810190612e07565b805190915060005b8181101561107457609e546040517fafee1ff1000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b038e811660248301529091169063afee1ff190604401602060405180830381865afa158015610ed1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef59190612f80565b1561106c57609e546040517fc47c9f3c000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b038e811660248301529091169063c47c9f3c9060440160e060405180830381865afa158015610f64573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f889190612f9d565b93508360400151846020015110610fb25783604001518460200151610fad9190613039565b610fb5565b60005b9650610fc1878b612a2d565b9950610fcd8787612a2d565b95506000871180156110035750609e546001600160a01b0316600090815260a06020908152604080832084845290915290205415155b1561105357609e546001600160a01b0316600090815260a0602090815260408083208484529091529020546103e89061103c9089612bd4565b6110469190612beb565b6110509088612a2d565b96505b61105d878c612a2d565b9a506110698786612a2d565b94505b600101610e5f565b505050505b6110838588612a2d565b965061108f8487612a2d565b955060a2548710611101576103e860a3546103e86110ad9190613039565b6110b79083612bd4565b6110c19190612beb565b6110cb9088613039565b96506103e860a3546103e86110e09190613039565b6110ea9084612bd4565b6110f49190612beb565b6110fe9087613039565b95505b5050505050915091565b6000806001600160a01b03831615610b1b576000806000859050806001600160a01b031663081e3eda6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611163573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111879190612a6f565b604080518082019091526000808252602082015290935060005b8481101561138a576040517f1526fe27000000000000000000000000000000000000000000000000000000008152600481018290526001600160a01b03841690631526fe27906024016101a060405180830381865afa158015611208573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061122c91906130b1565b505060a1548451949b506001600160a01b0390811694169390930397506113829650505050505050576040517fb9d02df4000000000000000000000000000000000000000000000000000000008152600481018290526001600160a01b038a8116602483015284169063b9d02df49060440160a060405180830381865afa1580156112bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112df919061315c565b509296506112f39250869150889050612a2d565b955060008411801561132757506001600160a01b038316600090815260a06020908152604080832084845290915290205415155b15611375576001600160a01b038316600090815260a0602090815260408083208484529091529020546103e89061135e9086612bd4565b6113689190612beb565b6113729085612a2d565b93505b61137f8488612a2d565b96505b6001016111a1565b50505050509250929050565b3360009081527fcee91eb23e767f0f440dd9fce5554f355614443931e9ac5ce78c67b9e06e6f70602052604090205460ff166113fe576040517fc0b2335a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b609b80546001600160a01b038781167fffffffffffffffffffffffff00000000000000000000000000000000000000009283168117909355609c80548883169084168117909155609d80548884169085168117909155609e80548885169086168117909155609f805494881694909516841790945560408051958652602086019290925290840152606083019190915260808201527fd8dd2c0add7ec1b00dd0c6e49b2d6336d6191311bcc26e8cf48dc5c063e998f89060a001610c85565b6000806001600160a01b03831615610b1b576000806000859050806001600160a01b031663081e3eda6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611515573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115399190612a6f565b92506000805b8481101561138a576040517fac4afa38000000000000000000000000000000000000000000000000000000008152600481018290526001600160a01b0384169063ac4afa389060240161014060405180830381865afa1580156115a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115ca9190612ac9565b5060a154604080517f0dfe16810000000000000000000000000000000000000000000000000000000081529051929c508c9a506001600160a01b039182169950908a169750630dfe16819650600480820196506020955091935083900301905081865afa15801561163f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611663919061319c565b6001600160a01b03161480611707575060a154604080517fd21220a700000000000000000000000000000000000000000000000000000000815290516001600160a01b039283169284169163d21220a79160048083019260209291908290030181865afa1580156116d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116fc919061319c565b6001600160a01b0316145b15611847576040517f56eeafd9000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b038b811660248301528516906356eeafd990604401602060405180830381865afa158015611772573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117969190612a6f565b94506117a3856002612bd4565b6117ad9088612a2d565b96506000851180156117e157506001600160a01b038416600090815260a06020908152604080832085845290915290205415155b1561182f576001600160a01b038416600090815260a0602090815260408083208584529091529020546103e8906118189087612bd4565b6118229190612beb565b61182c9086612a2d565b94505b61183a856002612bd4565b6118449089612a2d565b97505b5060010161153f565b600054610100900460ff16158080156118705750600054600160ff909116105b8061188a5750303b15801561188a575060005460ff166001145b611916576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610780565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055801561197457600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b61197c612297565b611987600033612330565b6119b17f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0833612330565b609780547fffffffffffffffffffffffff00000000000000000000000000000000000000009081166001600160a01b038e811691909117909255609a805482168b84161790556098805482168d84161790556099805482168c8416179055609b805482168a8416179055609c80548216898416179055609d80548216888416179055609e80548216878416179055609f8054821686841617905560a180549091169184169190911790557fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60a2558015611ae257600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050505050565b609a5460009081908190819081906001600160a01b031615611bad57609a546040517fe9081ec70000000000000000000000000000000000000000000000000000000081526001600160a01b0388811660048301529091169063e9081ec790602401602060405180830381865afa158015611b6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b929190612a6f565b9250611b9e8386612a2d565b9450611baa8385612a2d565b93505b609854611bc69087906001600160a01b03166001611c7a565b9092509050611bd58286612a2d565b9450611be18185612a2d565b609754909450611bfb9087906001600160a01b031661110b565b9092509050611c0a8286612a2d565b9450611c168185612a2d565b609954909450611c309087906001600160a01b03166114bd565b9092509050611c3f8286612a2d565b9450611c4b8185612a2d565b9350505050915091565b600082815260656020526040902060010154611c7081612129565b6106e783836121f6565b6000806001600160a01b038416156120ae576000806000808790506000816001600160a01b031663fb1db2786040518163ffffffff1660e01b8152600401602060405180830381865afa158015611cd5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cf9919061319c565b9050806001600160a01b031663081e3eda6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611d39573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d5d9190612a6f565b945060005b858110156120a7578815611e6c576000836001600160a01b031663fb1db2786040518163ffffffff1660e01b8152600401602060405180830381865afa158015611db0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dd4919061319c565b6040517f1526fe27000000000000000000000000000000000000000000000000000000008152600481018490529091506001600160a01b03821690631526fe27906024016101a060405180830381865afa158015611e36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e5a91906131b9565b9d50611f5f9950505050505050505050565b6000836001600160a01b031663fb1db2786040518163ffffffff1660e01b8152600401602060405180830381865afa158015611eac573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ed0919061319c565b6040517f1526fe27000000000000000000000000000000000000000000000000000000008152600481018490529091506001600160a01b03821690631526fe279060240160e060405180830381865afa158015611f31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f559190613293565b9a50505050505050505b60a1546001600160a01b039081169085160361209f576040517fb9d02df4000000000000000000000000000000000000000000000000000000008152600481018290526001600160a01b038c8116602483015284169063b9d02df490604401608060405180830381865afa158015611fdb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fff91906132f3565b509650612010915086905088612a2d565b965060008511801561204457506001600160a01b038316600090815260a06020908152604080832084845290915290205415155b15612092576001600160a01b038316600090815260a0602090815260408083208484529091529020546103e89061207b9087612bd4565b6120859190612beb565b61208f9086612a2d565b94505b61209c8589612a2d565b97505b600101611d62565b5050505050505b935093915050565b3360009081527fcee91eb23e767f0f440dd9fce5554f355614443931e9ac5ce78c67b9e06e6f70602052604090205460ff1661211e576040517fc0b2335a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60a29190915560a355565b612133813361233a565b50565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff166107935760008281526065602090815260408083206001600160a01b0385168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556121b23390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff16156107935760008281526065602090815260408083206001600160a01b038516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600054610100900460ff1661232e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610780565b565b6107938282612136565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff166107935761236d816123c9565b6123788360206123db565b604051602001612389929190613329565b60408051601f19818403018152908290527f08c379a0000000000000000000000000000000000000000000000000000000008252610780916004016133aa565b60606105c56001600160a01b03831660145b606060006123ea836002612bd4565b6123f5906002612a2d565b67ffffffffffffffff81111561240d5761240d612c26565b6040519080825280601f01601f191660200182016040528015612437576020820181803683370190505b5090507f30000000000000000000000000000000000000000000000000000000000000008160008151811061246e5761246e612a40565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106124d1576124d1612a40565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600061250d846002612bd4565b612518906001612a2d565b90505b60018111156125b5577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061255957612559612a40565b1a60f81b82828151811061256f5761256f612a40565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c936125ae816133dd565b905061251b565b5083156106bb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610780565b60006020828403121561263057600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146106bb57600080fd5b6001600160a01b038116811461213357600080fd5b60006020828403121561268757600080fd5b81356106bb81612660565b6000602082840312156126a457600080fd5b5035919050565b600080604083850312156126be57600080fd5b8235915060208301356126d081612660565b809150509250929050565b60008083601f8401126126ed57600080fd5b50813567ffffffffffffffff81111561270557600080fd5b6020830191508360208260051b8501011115610b1b57600080fd5b6000806000806000806060878903121561273957600080fd5b863567ffffffffffffffff8082111561275157600080fd5b61275d8a838b016126db565b9098509650602089013591508082111561277657600080fd5b6127828a838b016126db565b9096509450604089013591508082111561279b57600080fd5b506127a889828a016126db565b979a9699509497509295939492505050565b600080604083850312156127cd57600080fd5b82356127d881612660565b915060208301356126d081612660565b600080600080600060a0868803121561280057600080fd5b853561280b81612660565b9450602086013561281b81612660565b9350604086013561282b81612660565b9250606086013561283b81612660565b9150608086013561284b81612660565b809150509295509295909350565b801515811461213357600080fd5b6000806040838503121561287a57600080fd5b823561288581612660565b915060208301356126d081612859565b6000806000806000806000806000806101408b8d0312156128b557600080fd5b8a356128c081612660565b995060208b01356128d081612660565b985060408b01356128e081612660565b975060608b01356128f081612660565b965060808b013561290081612660565b955060a08b013561291081612660565b945060c08b013561292081612660565b935060e08b013561293081612660565b92506101008b013561294181612660565b91506101208b013561295281612660565b809150509295989b9194979a5092959850565b60008060006060848603121561297a57600080fd5b833561298581612660565b9250602084013561299581612660565b915060408401356129a581612859565b809150509250925092565b600080604083850312156129c357600080fd5b50508035926020909101359150565b600080604083850312156129e557600080fd5b82356129f081612660565b946020939093013593505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808201808211156105c5576105c56129fe565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215612a8157600080fd5b5051919050565b8051612a9381612859565b919050565b805161ffff81168114612a9357600080fd5b805163ffffffff81168114612a9357600080fd5b8051612a9381612660565b6000806000806000806000806000806101408b8d031215612ae957600080fd5b8a51612af481612859565b9950612b0260208c01612a98565b9850612b1060408c01612aaa565b9750612b1e60608c01612aaa565b9650612b2c60808c01612aaa565b955060a08b01516fffffffffffffffffffffffffffffffff81168114612b5157600080fd5b8095505060c08b0151935060e08b015192506101008b0151612b7281612660565b6101208c015190925061295281612660565b600080600080600060a08688031215612b9c57600080fd5b8551945060208601519350612bb360408701612aaa565b9250612bc160608701612aaa565b9150608086015190509295509295909350565b80820281158282048414176105c5576105c56129fe565b600082612c21577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051610140810167ffffffffffffffff81118282101715612c7957612c79612c26565b60405290565b6040516080810167ffffffffffffffff81118282101715612c7957612c79612c26565b604051601f8201601f1916810167ffffffffffffffff81118282101715612ccb57612ccb612c26565b604052919050565b600067ffffffffffffffff821115612ced57612ced612c26565b5060051b60200190565b60005b83811015612d12578181015183820152602001612cfa565b50506000910152565b600082601f830112612d2c57600080fd5b815167ffffffffffffffff811115612d4657612d46612c26565b612d596020601f19601f84011601612ca2565b818152846020838601011115612d6e57600080fd5b612d7f826020830160208701612cf7565b949350505050565b805160ff81168114612a9357600080fd5b600082601f830112612da957600080fd5b81516020612dbe612db983612cd3565b612ca2565b8083825260208201915060208460051b870101935086841115612de057600080fd5b602086015b84811015612dfc5780518352918301918301612de5565b509695505050505050565b60006020808385031215612e1a57600080fd5b825167ffffffffffffffff80821115612e3257600080fd5b818501915085601f830112612e4657600080fd5b8151612e54612db982612cd3565b81815260059190911b83018401908481019088831115612e7357600080fd5b8585015b83811015612f7357805185811115612e8f5760008081fd5b8601610140818c03601f1901811315612ea85760008081fd5b612eb0612c55565b8983015188811115612ec25760008081fd5b612ed08e8c83870101612d1b565b8252506040808401518b830152606080850151828401526080915081850151818401525060a0808501518284015260c09150612f0d828601612a88565b9083015260e0612f1e858201612d87565b828401526101009150818501518184015250610120808501518284015283850151935089841115612f5157600091508182fd5b612f5f8f8d86880101612d98565b908301525085525050918601918601612e77565b5098975050505050505050565b600060208284031215612f9257600080fd5b81516106bb81612859565b600060e08284031215612faf57600080fd5b60405160e0810181811067ffffffffffffffff82111715612fd257612fd2612c26565b6040528251612fe081612660565b808252506020830151602082015260408301516040820152606083015160608201526080830151608082015260a083015161301a81612859565b60a082015260c083015161302d81612859565b60c08201529392505050565b818103818111156105c5576105c56129fe565b60006040828403121561305e57600080fd5b6040516040810181811067ffffffffffffffff8211171561308157613081612c26565b8060405250809150825161309481612660565b815260208301516130a481612660565b6020919091015292915050565b60008060008060008060008060008060006101a08c8e0312156130d357600080fd5b8b519a5060208c0151995060408c0151985060608c0151975060808c015196506131008d60a08e0161304c565b955061310f8d60e08e0161304c565b94506101208c015193506101408c015161312881612660565b92506131376101608d01612aaa565b91506101808c015161314881612859565b809150509295989b509295989b9093969950565b600080600080600060a0868803121561317457600080fd5b5050835160208501516040860151606087015160809097015192989197509594509092509050565b6000602082840312156131ae57600080fd5b81516106bb81612660565b6000806000806000806000806000808a8c036101a08112156131da57600080fd5b8b519a506080601f19820112156131f057600080fd5b506131f9612c7f565b60208c015161320781612859565b815261321560408d01612a98565b602082015261322660608d01612a98565b604082015261323760808d01612a98565b60608201528099505060a08b0151975060c08b0151965060e08b015195506101008b015194506101208b015193506101408b015192506101608b015191506132826101808c01612abe565b90509295989b9194979a5092959850565b600080600080600080600060e0888a0312156132ae57600080fd5b875196506020880151955060408801519450606088015193506080880151925060a0880151915060c08801516132e381612660565b8091505092959891949750929550565b6000806000806080858703121561330957600080fd5b505082516020840151604085015160609095015191969095509092509050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351613361816017850160208801612cf7565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000601791840191820152835161339e816028840160208801612cf7565b01602801949350505050565b60208152600082518060208401526133c9816040850160208701612cf7565b601f01601f19169190910160400192915050565b6000816133ec576133ec6129fe565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019056fea164736f6c6343000819000a
{{ "language": "Solidity", "sources": { "openzeppelin-contracts-upgradeable/contracts/access/AccessControlUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControlUpgradeable.sol\";\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../utils/StringsUpgradeable.sol\";\nimport \"../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev 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 */\nabstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {\n function __AccessControl_init() internal onlyInitializing {\n }\n\n function __AccessControl_init_unchained() internal onlyInitializing {\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 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]{40}) is missing role (0x[0-9a-f]{64})$/\n *\n * _Available since v4.1._\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\n return _roles[role].members[account];\n }\n\n /**\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\n * Overriding this function changes the behavior of the {onlyRole} modifier.\n *\n * Format of the revert message is described in {_checkRole}.\n *\n * _Available since v4.6._\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\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]{40}) is missing role (0x[0-9a-f]{64})$/\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert(\n string(\n abi.encodePacked(\n \"AccessControl: account \",\n StringsUpgradeable.toHexString(account),\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 virtual override 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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual override 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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual override 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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address account) public virtual override {\n require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\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 * May emit a {RoleGranted} event.\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 * NOTE: This function is deprecated in favor of {_grantRole}.\n */\n function _setupRole(bytes32 role, address account) internal virtual {\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 virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n emit RoleGranted(role, account, _msgSender());\n }\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n }\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/contracts/access/IAccessControlUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControlUpgradeable {\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 {AccessControl-_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 Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) external view returns (bool);\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 {AccessControl-_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\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;\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;\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}\n" }, "openzeppelin-contracts-upgradeable/contracts/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/contracts/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/contracts/utils/ContextUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\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/contracts/utils/introspection/ERC165Upgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\n function __ERC165_init() internal onlyInitializing {\n }\n\n function __ERC165_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165Upgradeable).interfaceId;\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/contracts/utils/introspection/IERC165Upgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165Upgradeable {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" }, "openzeppelin-contracts-upgradeable/contracts/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/contracts/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" }, "src/DCBTiers.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.25;\n\nimport { AccessControlUpgradeable } from\n \"openzeppelin-contracts-upgradeable/contracts/access/AccessControlUpgradeable.sol\";\nimport { IUniswapV2Pair } from \"./interfaces/IUniswapV2Pair.sol\";\nimport { IDCBMasterChef } from \"./interfaces/IDCBMasterChef.sol\";\nimport { IDCBPowerBoost } from \"./interfaces/IDCBPowerBoost.sol\";\nimport { IDCBStaking, IDecubateStaking } from \"./interfaces/IDCBStaking.sol\";\nimport { IDCBVault } from \"./interfaces/IDCBVault.sol\";\nimport { IDCBLiqLocker } from \"./interfaces/IDCBLiqLocker.sol\";\nimport { IDCBLegacyMasterChef } from \"./interfaces/IDCBLegacyMasterChef.sol\";\nimport { IDCBVestingV2, DecubateVestingV2 } from \"./interfaces/IDCBVestingV2.sol\";\nimport { IDCBMultiFarm } from \"./interfaces/IDCBMultiFarm.sol\";\n\ncontract DCBTiers is AccessControlUpgradeable {\n // Instances of different contracts\n IDCBStaking public legacyMultiAssetStakingContract; // Old Multi asset Staking contract instance\n IDCBVault public legacyCompounderContract; // Old vault contract instance\n IDCBLiqLocker public legacyLiquidityLocker; // Old Liquidity locker contract\n IDCBPowerBoost public powerBoostContract; // Tier boost contract instance\n IDCBStaking public multiAssetStakingContract; // Multi asset staking contract instance\n IDCBVault public compounderContract; // Vault contract instance\n IDCBLiqLocker public liquidityLocker; // Liquidity locker contract instance\n IDCBVestingV2 public vestingContract; // Vesting contract instance\n IDCBMultiFarm public multiFarmContract; // Multifarm contract instance\n\n // Boost values mapping\n mapping(address => mapping(uint256 => uint256)) public boostValues; // Boost %, /1000\n\n address public tokenAddress; // DCB token instance\n uint256 public reductionThreshold; // Reduction threshold\n uint256 public reductionPercent; // Reduction percent\n\n // Constants\n uint256 internal constant DIVISOR = 1000;\n bytes32 internal constant MANAGER_ROLE = keccak256(\"MANAGER_ROLE\");\n\n // Custom errors\n error ZeroAddress();\n error OnlyManager();\n\n // Events\n event ManagerRoleSet(address _user, bool _status);\n event LegacyContractSet(\n address _legacyMultiAssetStakingContract,\n address _powerBoostContract,\n address _legacyCompounder,\n address _legacyLiqContract,\n address _token\n );\n event NewContractSet(\n address _multiAssetStakingContract,\n address _compounderContract,\n address _liquidityLocker,\n address _vestingContract,\n address _multiFarmContract\n );\n\n // Modifier to restrict functions to only managers\n modifier onlyManager() {\n if (!hasRole(MANAGER_ROLE, msg.sender)) revert OnlyManager(); // Revert with custom error if not a manager\n _;\n }\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() {\n _disableInitializers();\n }\n\n /**\n * @dev Set boost values for different contracts and pool IDs.\n * @param _contract Array of contract addresses.\n * @param _poolId Array of pool IDs.\n * @param _value Array of boost values.\n */\n function setBoostValues(\n address[] calldata _contract,\n uint256[] calldata _poolId,\n uint256[] calldata _value\n )\n external\n onlyManager\n {\n for (uint256 i = 0; i < _contract.length; i++) {\n boostValues[_contract[i]][_poolId[i]] = _value[i];\n }\n }\n\n /**\n * @dev Assign or revoke manager role to a user.\n * @param _user Address of the user.\n * @param _status Boolean indicating whether to grant or revoke the role.\n */\n function setManagerRole(address _user, bool _status) external onlyRole(DEFAULT_ADMIN_ROLE) {\n if (_status) {\n grantRole(MANAGER_ROLE, _user);\n } else {\n revokeRole(MANAGER_ROLE, _user);\n }\n emit ManagerRoleSet(_user, _status);\n }\n\n /**\n * @dev Set legacy contract addresses.\n * @param _legacyMultiAssetStakingContract Address of the legacy multi-asset staking contract.\n * @param _powerBoostContract Address of the power boost contract.\n * @param _legacyCompounder Address of the legacy compounder contract.\n * @param _legacyLiqContract Address of the legacy liquidity locker contract.\n * @param _token Address of the token contract.\n */\n function setLegacyContracts(\n address _legacyMultiAssetStakingContract,\n address _powerBoostContract,\n address _legacyCompounder,\n address _legacyLiqContract,\n address _token\n )\n external\n onlyManager\n {\n if (_token == address(0)) revert ZeroAddress(); // Revert with custom error if token address is zero\n legacyMultiAssetStakingContract = IDCBStaking(_legacyMultiAssetStakingContract);\n powerBoostContract = IDCBPowerBoost(_powerBoostContract);\n legacyCompounderContract = IDCBVault(_legacyCompounder);\n legacyLiquidityLocker = IDCBLiqLocker(_legacyLiqContract);\n tokenAddress = _token;\n\n emit LegacyContractSet(\n _legacyMultiAssetStakingContract, _powerBoostContract, _legacyCompounder, _legacyLiqContract, _token\n );\n }\n\n /**\n * @dev Set new contract addresses.\n * @param _multiAssetStakingContract Address of the new multi-asset staking contract.\n * @param _compounderContract Address of the new compounder contract.\n * @param _liquidityLocker Address of the new liquidity locker contract.\n * @param _vestingContract Address of the new vesting contract.\n * @param _multiFarmContract Address of the new multi-farm contract.\n */\n function setNewContracts(\n address _multiAssetStakingContract,\n address _compounderContract,\n address _liquidityLocker,\n address _vestingContract,\n address _multiFarmContract\n )\n external\n onlyManager\n {\n multiAssetStakingContract = IDCBStaking(_multiAssetStakingContract);\n compounderContract = IDCBVault(_compounderContract);\n liquidityLocker = IDCBLiqLocker(_liquidityLocker);\n vestingContract = IDCBVestingV2(_vestingContract);\n multiFarmContract = IDCBMultiFarm(_multiFarmContract);\n\n emit NewContractSet(\n _multiAssetStakingContract, _compounderContract, _liquidityLocker, _vestingContract, _multiFarmContract\n );\n }\n\n /**\n * @dev Set reduction threshold and percent.\n * @param _newThreshold New reduction threshold.\n * @param _newPercent New reduction percent.\n */\n function setReductionValues(uint256 _newThreshold, uint256 _newPercent) external onlyManager {\n reductionThreshold = _newThreshold;\n reductionPercent = _newPercent;\n }\n\n /**\n * @dev Initialize the contract with the given parameters.\n * @param _legacyMultiAssetStakingContract Address of the legacy multi-asset staking contract.\n * @param _legacyCompounderContract Address of the legacy compounder contract.\n * @param _legacyLiquidityLocker Address of the legacy liquidity locker contract.\n * @param _powerBoostContract Address of the power boost contract.\n * @param _multiAssetStakingContract Address of the new multi-asset staking contract.\n * @param _compounderContract Address of the new compounder contract.\n * @param _liquidityLocker Address of the new liquidity locker contract.\n * @param _vestingContract Address of the new vesting contract.\n * @param _multiFarmContract Address of the new multi-farm contract.\n * @param _token Address of the token contract.\n */\n function initialize(\n address _legacyMultiAssetStakingContract,\n address _legacyCompounderContract,\n address _legacyLiquidityLocker,\n address _powerBoostContract,\n address _multiAssetStakingContract,\n address _compounderContract,\n address _liquidityLocker,\n address _vestingContract,\n address _multiFarmContract,\n address _token\n )\n public\n initializer\n {\n __AccessControl_init();\n _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);\n _setupRole(MANAGER_ROLE, msg.sender);\n\n legacyMultiAssetStakingContract = IDCBStaking(_legacyMultiAssetStakingContract);\n powerBoostContract = IDCBPowerBoost(_powerBoostContract);\n legacyCompounderContract = IDCBVault(_legacyCompounderContract);\n legacyLiquidityLocker = IDCBLiqLocker(_legacyLiquidityLocker);\n multiAssetStakingContract = IDCBStaking(_multiAssetStakingContract);\n compounderContract = IDCBVault(_compounderContract);\n liquidityLocker = IDCBLiqLocker(_liquidityLocker);\n vestingContract = IDCBVestingV2(_vestingContract);\n multiFarmContract = IDCBMultiFarm(_multiFarmContract);\n tokenAddress = _token;\n\n reductionThreshold = type(uint256).max;\n }\n\n /**\n * @dev Get total amount of DCB staked by a user.\n * @param addr Address of the user.\n * @return effectiveAmount Total amount of DCB staked with boost.\n * @return actualAmount Total amount of DCB staked without boost.\n */\n function getTotalDeposit(address addr) public view returns (uint256 effectiveAmount, uint256 actualAmount) {\n (effectiveAmount, actualAmount) = getTotalDepositLegacy(addr);\n (uint256 tempEffective, uint256 tempActual) = getTotalDepositCurrent(addr);\n uint256 tempAmt;\n uint256 actualAmountVesting;\n uint256 effectiveAmountVesting;\n\n if (address(vestingContract) != address(0)) {\n DecubateVestingV2.WhitelistInfo memory whitelist;\n DecubateVestingV2.VestingInfo[] memory vest = vestingContract.getAllVestingPools();\n uint256 len = vest.length;\n for (uint256 i = 0; i < len; i++) {\n if (vestingContract.hasWhitelist(i, addr)) {\n whitelist = vestingContract.getWhitelist(i, addr);\n tempAmt = whitelist.dcbAmount < whitelist.distributedAmount\n ? 0\n : whitelist.dcbAmount - whitelist.distributedAmount;\n actualAmount += tempAmt;\n actualAmountVesting += tempAmt;\n if (tempAmt > 0 && boostValues[address(vestingContract)][i] > 0) {\n tempAmt += (tempAmt * boostValues[address(vestingContract)][i]) / DIVISOR;\n }\n effectiveAmount += tempAmt;\n effectiveAmountVesting += tempAmt;\n }\n }\n }\n\n effectiveAmount += tempEffective;\n actualAmount += tempActual;\n\n if (effectiveAmount >= reductionThreshold) {\n effectiveAmount -= (effectiveAmountVesting * (DIVISOR - reductionPercent)) / DIVISOR;\n actualAmount -= (actualAmountVesting * (DIVISOR - reductionPercent)) / DIVISOR;\n }\n }\n\n /**\n * @dev Get actual amount of DCB staked by a user.\n * @param addr Address of the user.\n * @return actualAmount Total amount of DCB staked without boost.\n */\n function getTotalDepositActual(address addr) public view returns (uint256 actualAmount) {\n (, actualAmount) = getTotalDeposit(addr);\n }\n\n /**\n * @dev Get total amount of DCB staked in a multi-asset staking contract by a user.\n * @param addr Address of the user.\n * @param _contract Address of the staking contract.\n * @return effectiveAmount Total amount of DCB staked with boost.\n * @return actualAmount Total amount of DCB staked without boost.\n */\n function getTotalDepositMultiAsset(\n address addr,\n address _contract\n )\n public\n view\n returns (uint256 effectiveAmount, uint256 actualAmount)\n {\n if (_contract != address(0)) {\n uint256 len;\n uint256 tempAmt;\n IDCBStaking _stakingContract = IDCBStaking(_contract);\n len = _stakingContract.poolLength();\n IDecubateStaking.PoolToken memory inputToken;\n\n for (uint256 i = 0; i < len; i++) {\n (,,,,, inputToken,,,,,) = _stakingContract.poolInfo(i);\n\n if (inputToken.addr == tokenAddress) {\n (tempAmt,,,,) = _stakingContract.users(i, addr);\n actualAmount += tempAmt;\n if (tempAmt > 0 && boostValues[address(_stakingContract)][i] > 0) {\n tempAmt += tempAmt * boostValues[address(_stakingContract)][i] / DIVISOR;\n }\n effectiveAmount += tempAmt;\n }\n }\n }\n }\n\n /**\n * @dev Get total amount of DCB staked in a multifarm contract by a user.\n * @param addr Address of the user.\n * @param _contract Address of the multifarm contract.\n * @return effectiveAmount Total amount of DCB staked with boost.\n * @return actualAmount Total amount of DCB staked without boost.\n */\n function getTotalDepositMultifarm(\n address addr,\n address _contract\n )\n public\n view\n returns (uint256 effectiveAmount, uint256 actualAmount)\n {\n if (_contract != address(0)) {\n uint256 tempAmt;\n IDCBMultiFarm multifarm = IDCBMultiFarm(_contract);\n uint256 len = multifarm.poolLength();\n for (uint256 i = 0; i < len; i++) {\n (,,,,,,,, address token,) = multifarm.poolInfo(i);\n if (token == tokenAddress) {\n (tempAmt,,,,) = multifarm.users(i, addr);\n actualAmount += tempAmt;\n if (tempAmt > 0 && boostValues[address(multifarm)][i] > 0) {\n tempAmt += (tempAmt * boostValues[address(multifarm)][i]) / DIVISOR;\n }\n effectiveAmount += tempAmt;\n }\n }\n }\n }\n\n /**\n * @dev Get total amount of DCB staked in a liquidity locker contract by a user.\n * @param addr Address of the user.\n * @param _contract Address of the liquidity locker contract.\n * @return effectiveAmount Total amount of DCB staked with boost.\n * @return actualAmount Total amount of DCB staked without boost.\n */\n function getTotalDepositLiquidityLocker(\n address addr,\n address _contract\n )\n public\n view\n returns (uint256 effectiveAmount, uint256 actualAmount)\n {\n if (_contract != address(0)) {\n uint256 len;\n uint256 tempAmt;\n IDCBLiqLocker _liquidityLocker = IDCBLiqLocker(_contract);\n len = _liquidityLocker.poolLength();\n address _pair;\n\n for (uint256 i = 0; i < len; i++) {\n (,,,,,,,, _pair,) = _liquidityLocker.pools(i);\n IUniswapV2Pair pair = IUniswapV2Pair(_pair);\n if (pair.token0() == tokenAddress || pair.token1() == tokenAddress) {\n tempAmt = _liquidityLocker.stakedTokens(i, addr);\n actualAmount += (tempAmt * 2);\n if (tempAmt > 0 && boostValues[address(_liquidityLocker)][i] > 0) {\n tempAmt += (tempAmt * boostValues[address(_liquidityLocker)][i]) / DIVISOR;\n }\n effectiveAmount += (tempAmt * 2);\n }\n }\n }\n }\n\n /**\n * @dev Get total amount of DCB staked in a vault contract by a user.\n * @param addr Address of the user.\n * @param _contract Address of the vault contract.\n * @param _isLegacy Boolean indicating whether the vault is a legacy contract.\n * @return effectiveAmount Total amount of DCB staked with boost.\n * @return actualAmount Total amount of DCB staked without boost.\n */\n function getTotalDepositVault(\n address addr,\n address _contract,\n bool _isLegacy\n )\n public\n view\n returns (uint256 effectiveAmount, uint256 actualAmount)\n {\n if (_contract != address(0)) {\n uint256 len;\n uint256 tempAmt;\n address token;\n IDCBVault _vault = IDCBVault(_contract);\n IDCBMasterChef compoundStakingContract = IDCBMasterChef(_vault.masterchef());\n len = compoundStakingContract.poolLength();\n for (uint256 i = 0; i < len; i++) {\n if (_isLegacy) {\n IDCBLegacyMasterChef legacyMasterChef = IDCBLegacyMasterChef(_vault.masterchef());\n (,,,,,,,,, token) = legacyMasterChef.poolInfo(i);\n } else {\n IDCBMasterChef masterChef = IDCBMasterChef(_vault.masterchef());\n (,,,,,, token) = masterChef.poolInfo(i);\n }\n\n if (token == tokenAddress) {\n (,, tempAmt,) = _vault.users(i, addr);\n actualAmount += tempAmt;\n if (tempAmt > 0 && boostValues[address(_vault)][i] > 0) {\n tempAmt += tempAmt * boostValues[address(_vault)][i] / DIVISOR;\n }\n effectiveAmount += tempAmt;\n }\n }\n }\n }\n\n /**\n * @dev Get total amount of DCB staked in legacy contracts by a user.\n * @param addr Address of the user.\n * @return effectiveAmount Total amount of DCB staked with boost.\n * @return actualAmount Total amount of DCB staked without boost.\n */\n function getTotalDepositLegacy(address addr) public view returns (uint256 effectiveAmount, uint256 actualAmount) {\n uint256 tempAmt;\n uint256 tempEffective;\n uint256 tempActual;\n\n if (address(powerBoostContract) != address(0)) {\n tempAmt = powerBoostContract.getDepositedAmount(addr);\n effectiveAmount += tempAmt;\n actualAmount += tempAmt;\n }\n\n (tempEffective, tempActual) = getTotalDepositVault(addr, address(legacyCompounderContract), true);\n effectiveAmount += tempEffective;\n actualAmount += tempActual;\n\n (tempEffective, tempActual) = getTotalDepositMultiAsset(addr, address(legacyMultiAssetStakingContract));\n effectiveAmount += tempEffective;\n actualAmount += tempActual;\n\n (tempEffective, tempActual) = getTotalDepositLiquidityLocker(addr, address(legacyLiquidityLocker));\n effectiveAmount += tempEffective;\n actualAmount += tempActual;\n }\n\n /**\n * @dev Get total amount of DCB staked in current contracts by a user.\n * @param addr Address of the user.\n * @return effectiveAmount Total amount of DCB staked with boost.\n * @return actualAmount Total amount of DCB staked without boost.\n */\n function getTotalDepositCurrent(address addr) public view returns (uint256 effectiveAmount, uint256 actualAmount) {\n uint256 tempEffective;\n uint256 tempActual;\n\n (tempEffective, tempActual) = getTotalDepositMultifarm(addr, address(multiFarmContract));\n effectiveAmount += tempEffective;\n actualAmount += tempActual;\n\n (tempEffective, tempActual) = getTotalDepositVault(addr, address(compounderContract), false);\n effectiveAmount += tempEffective;\n actualAmount += tempActual;\n\n (tempEffective, tempActual) = getTotalDepositMultiAsset(addr, address(multiAssetStakingContract));\n effectiveAmount += tempEffective;\n actualAmount += tempActual;\n\n (tempEffective, tempActual) = getTotalDepositLiquidityLocker(addr, address(liquidityLocker));\n effectiveAmount += tempEffective;\n actualAmount += tempActual;\n }\n}\n" }, "src/interfaces/IDCBLegacyMasterChef.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.25;\n\ninterface IDCBLegacyMasterChef {\n struct NFTMultiplier {\n bool active;\n uint16 multiplier;\n uint16 startIdx;\n uint16 endIdx;\n }\n\n /**\n *\n * @dev User reflects the info of each user\n *\n *\n * @param {totalInvested} how many tokens the user staked\n * @param {totalWithdrawn} how many tokens withdrawn so far\n * @param {lastPayout} time at which last claim was done\n * @param {depositTime} Time of last deposit\n * @param {totalClaimed} Total claimed by the user\n *\n */\n struct User {\n uint256 totalInvested;\n uint256 totalWithdrawn;\n uint256 lastPayout;\n uint256 depositTime;\n uint256 totalClaimed;\n }\n\n function poolInfo(uint256)\n external\n view\n returns (\n uint256 apy,\n NFTMultiplier memory nft,\n uint256 lockPeriodInDays,\n uint256 totalDeposit,\n uint256 startDate,\n uint256 endDate,\n uint256 minContrib,\n uint256 maxContrib,\n uint256 hardCap,\n address token\n );\n\n function users(\n uint256,\n address\n )\n external\n view\n returns (\n uint256 totalInvested,\n uint256 totalWithdrawn,\n uint256 lastPayout,\n uint256 depositTime,\n uint256 totalClaimed\n );\n\n function poolLength() external view returns (uint256);\n\n function add(\n uint256 _apy,\n uint16 _multiplier,\n uint16 startIdx,\n uint16 endIdx,\n uint256 _lockPeriodInDays,\n bool _isUsed,\n uint256 _endDate,\n uint256 _minContrib,\n uint256 _maxContrib,\n uint256 _hardCap,\n address token\n )\n external;\n\n function set(\n uint256 _pid,\n uint256 _apy,\n uint16 _multiplier,\n uint16 startIdx,\n uint16 endIdx,\n uint256 _lockPeriodInDays,\n bool _isUsed,\n uint256 _endDate,\n uint256 _minContrib,\n uint256 _maxContrib,\n uint256 _hardCap,\n address token\n )\n external;\n\n function stake(uint256 _pid, uint256 _amount) external returns (bool);\n\n function claim(uint256 _pid) external returns (bool);\n\n function reinvest(uint256 _pid) external returns (bool);\n\n function reinvestAll() external returns (bool);\n\n function claimAll() external returns (bool);\n\n function canClaim(uint256 _pid, address _addr) external view returns (bool);\n\n function calcMultiplier(uint256 _pid, address _addr) external view returns (uint16);\n\n function unStake(uint256 _pid, uint256 _amount) external returns (bool);\n\n function handleNFTMultiplier(uint256 _pid, address _user, uint256 _rewardAmount) external returns (uint256);\n\n function updateCompounder(address _compounder) external;\n\n function payout(uint256 _pid, address _addr) external view returns (uint256 value);\n}\n" }, "src/interfaces/IDCBLiqLocker.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.25;\n\ninterface IDCBLiqLocker {\n function lpValue(uint256) external view returns (uint256);\n\n function multis(uint256)\n external\n view\n returns (string memory name, address contractAdd, bool active, uint16 multi, uint128 start, uint128 end);\n\n function owner() external view returns (address);\n\n function pools(uint256)\n external\n view\n returns (\n bool isWithdrawLocked,\n uint16 lockPeriodInDays,\n uint32 totalInvestors,\n uint32 startDate,\n uint32 endDate,\n uint128 rewardRate,\n uint256 totalInvested,\n uint256 hardCap,\n address input,\n address reward\n );\n\n function router() external view returns (address);\n\n function stakedTokens(uint256, address) external view returns (uint256);\n\n function users(\n uint256,\n address\n )\n external\n view\n returns (\n uint256 totalInvested,\n uint256 totalWithdrawn,\n uint32 lastPayout,\n uint32 depositTime,\n uint256 totalClaimed\n );\n\n function transferToken(address _token) external returns (bool);\n\n function add(\n bool _isWithdrawLocked,\n uint128 _rewardRate,\n uint16 _lockPeriodInDays,\n uint32 _endDate,\n uint256,\n address _inputToken,\n address _rewardToken\n )\n external;\n\n function set(\n uint16 _pid,\n bool _isWithdrawLocked,\n uint128 _rewardRate,\n uint16 _lockPeriodInDays,\n uint32 _endDate,\n uint256,\n address,\n address\n )\n external;\n\n function setMultiplier(\n uint16 _pid,\n string memory _name,\n address _contractAdd,\n bool _isUsed,\n uint16 _multi,\n uint128 _start,\n uint128 _end\n )\n external;\n\n function transferStuckToken(address _token) external returns (bool);\n\n function transferStuckNFT(address _nft, uint256 _id) external returns (bool);\n\n function addLiquidityAndLock(uint8 _pid, uint256 _token0Amt, uint256 _token1Amt) external payable returns (bool);\n\n function unlockAndRemoveLP(uint16 _pid, uint256 _amount) external returns (bool);\n\n function claim(uint16 _pid) external returns (bool);\n\n function claimAll() external returns (bool);\n\n function poolLength() external view returns (uint256);\n\n function getPools() external view returns (IStaking.Pool[] memory);\n\n function initialize(address _router) external;\n\n function payout(uint16 _pid, address _addr) external view returns (uint256 rewardAmount);\n\n function canClaim(uint16 _pid, address _addr) external view returns (bool);\n\n function ownsCorrectMulti(uint16 _pid, address _addr) external view returns (bool);\n\n function calcMultiplier(uint16 _pid, address _addr) external view returns (uint16 multi);\n\n function isWrappedNative(address _pair) external view returns (uint8 pos);\n}\n\ninterface IStaking {\n struct Pool {\n bool isWithdrawLocked;\n uint16 lockPeriodInDays;\n uint32 totalInvestors;\n uint32 startDate;\n uint32 endDate;\n uint128 rewardRate;\n uint256 totalInvested;\n uint256 hardCap;\n address input;\n address reward;\n }\n}\n" }, "src/interfaces/IDCBMasterChef.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.25;\n\ninterface IDCBMasterChef {\n function accrueInterest(uint256 _principal, uint256 _rate, uint256 _age) external pure returns (uint256);\n\n function compounderContract() external view returns (address);\n\n function maxTransferAmount(address) external view returns (uint256);\n\n function nftInfo(uint256)\n external\n view\n returns (\n bool active,\n string memory name,\n address contractAdd,\n uint16 multiplier,\n uint16 startIdx,\n uint16 endIdx\n );\n\n function owner() external view returns (address);\n\n function poolInfo(uint256)\n external\n view\n returns (\n uint256 apy,\n uint256 lockPeriodInDays,\n uint256 totalDeposit,\n uint256 startDate,\n uint256 endDate,\n uint256 hardCap,\n address token\n );\n\n function users(\n uint256,\n address\n )\n external\n view\n returns (\n uint256 totalInvested,\n uint256 totalWithdrawn,\n uint256 lastPayout,\n uint256 depositTime,\n uint256 totalClaimed\n );\n\n function yearlyRateToRay(uint256 _rateWad) external pure returns (uint256);\n\n function initialize() external;\n\n function updateFeeValues(uint8 _feePercent, address _feeWallet) external;\n\n function updateCompounder(address _compounder) external;\n\n function transferToken(address _addr, uint256 _amount) external returns (bool);\n\n function add(\n uint256 _apy,\n uint256 _lockPeriodInDays,\n uint256 _endDate,\n uint256 _hardCap,\n address _token\n )\n external;\n\n function set(\n uint256 _pid,\n uint256 _apy,\n uint256 _lockPeriodInDays,\n uint256 _endDate,\n uint256 _hardCap,\n uint256 _maxTransfer,\n address _token\n )\n external;\n\n function setNFT(\n uint256 _pid,\n string memory _name,\n address _contractAdd,\n bool _isUsed,\n uint16 _multiplier,\n uint16 _startIdx,\n uint16 _endIdx\n )\n external;\n\n function stake(uint256 _pid, uint256 _amount) external returns (bool);\n\n function handleNFTMultiplier(uint256 _pid, address _user, uint256 _rewardAmount) external returns (uint256);\n\n function claim(uint256 _pid) external returns (bool);\n\n function reinvest(uint256 _pid) external returns (bool);\n\n function reinvestAll() external returns (bool);\n\n function claimAll() external returns (bool);\n\n function unStake(uint256 _pid, uint256 _amount) external returns (bool);\n\n function canClaim(uint256 _pid, address _addr) external view returns (bool);\n\n function calcMultiplier(uint256 _pid, address _addr) external view returns (uint16 multi);\n\n function ownsCorrectNFT(address _addr, uint256 _pid) external view returns (bool);\n\n function payout(uint256 _pid, address _addr) external view returns (uint256 value);\n\n function poolLength() external view returns (uint256);\n\n function getPools() external view returns (DecubateMasterChef.Pool[] memory);\n}\n\ninterface DecubateMasterChef {\n struct Pool {\n uint256 apy;\n uint256 lockPeriodInDays;\n uint256 totalDeposit;\n uint256 startDate;\n uint256 endDate;\n uint256 hardCap;\n address token;\n }\n}\n" }, "src/interfaces/IDCBMultiFarm.sol": { "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.25;\n\ninterface IDCBMultiFarm {\n function multipliers(uint256)\n external\n view\n returns (string memory name, address contractAdd, bool active, uint16 multi, uint128 start, uint128 end);\n\n function owner() external view returns (address);\n\n function poolInfo(uint256)\n external\n view\n returns (\n bool isWithdrawLocked,\n uint16 lockPeriodInDays,\n uint32 totalInvestors,\n uint32 startDate,\n uint32 endDate,\n uint128 rewardRate,\n uint256 totalInvested,\n uint256 hardCap,\n address input,\n address reward\n );\n\n function renounceOwnership() external;\n\n function transferOwnership(address newOwner) external;\n\n function users(\n uint256,\n address\n )\n external\n view\n returns (\n uint256 totalInvested,\n uint256 totalWithdrawn,\n uint32 lastPayout,\n uint32 depositTime,\n uint256 totalClaimed\n );\n\n function initialize() external;\n\n function add(\n bool,\n uint128 _rewardRateInSeconds,\n uint16 _lockPeriodInDays,\n uint32 _endDate,\n uint256 _hardCap,\n address _inputToken,\n address _rewardToken\n )\n external;\n\n function set(\n uint16 _pid,\n bool,\n uint128 _rewardRate,\n uint16 _lockPeriodInDays,\n uint32 _endDate,\n uint256 _hardCap,\n address,\n address\n )\n external;\n\n function setMultiplier(\n uint16 _pid,\n string memory _name,\n address _contractAdd,\n bool _isUsed,\n uint16 _multiplier,\n uint128 _start,\n uint128 _end\n )\n external;\n\n function transferStuckToken(address) external returns (bool);\n\n function transferStuckNFT(address _nft, uint256 _id) external returns (bool);\n\n function stake(uint16 _pid, uint256 _amount) external;\n\n function unStake(uint16 _pid, uint256 _amount) external;\n\n function poolLength() external view returns (uint256);\n\n function getPools() external view returns (IStaking.Pool[] memory);\n\n function claim(uint16 _pid) external returns (bool);\n\n function claimAll() external returns (bool);\n\n function payout(uint16 _pid, address _addr) external view returns (uint256 value);\n\n function ownsCorrectMulti(uint16 _pid, address _addr) external view returns (bool);\n\n function canClaim(uint16 _pid, address _addr) external view returns (bool);\n\n function calcMultiplier(uint16 _pid, address _addr) external view returns (uint16 multi);\n}\n\ninterface IStaking {\n struct Pool {\n bool isWithdrawLocked;\n uint16 lockPeriodInDays;\n uint32 totalInvestors;\n uint32 startDate;\n uint32 endDate;\n uint128 rewardRate;\n uint256 totalInvested;\n uint256 hardCap;\n address input;\n address reward;\n }\n}\n" }, "src/interfaces/IDCBPowerBoost.sol": { "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.25;\n\ninterface IDCBPowerBoost {\n function getDepositedAmount(address _address) external view returns (uint256);\n}\n" }, "src/interfaces/IDCBStaking.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.25;\n\ninterface IDCBStaking {\n function accrueInterest(uint256 _principal, uint256 _rate, uint256 _age) external pure returns (uint256);\n\n function maxTransferAmount(address) external view returns (uint256);\n\n function nftInfo(uint256)\n external\n view\n returns (\n bool active,\n string memory name,\n address contractAdd,\n uint16 multiplier,\n uint16 startIdx,\n uint16 endIdx\n );\n\n function owner() external view returns (address);\n\n function poolInfo(uint256)\n external\n view\n returns (\n uint256 apy,\n uint256 lockPeriodInDays,\n uint256 totalDeposit,\n uint256 hardCap,\n uint256 endDate,\n IDecubateStaking.PoolToken memory inputToken,\n IDecubateStaking.PoolToken memory rewardToken,\n uint256 ratio,\n address tradesAgainst,\n uint32 lastUpdatedTime,\n bool isRewardAboveInput\n );\n\n function priceBuffer(uint256, uint256) external view returns (uint256);\n\n function users(\n uint256,\n address\n )\n external\n view\n returns (\n uint256 totalInvested,\n uint256 totalWithdrawn,\n uint256 lastPayout,\n uint256 depositTime,\n uint256 totalClaimed\n );\n\n function yearlyRateToRay(uint256 _rateWad) external pure returns (uint256);\n\n function initialize() external;\n\n function add(\n uint256 _apy,\n uint256 _lockPeriodInDays,\n uint256 _endDate,\n address _tradesAgainst,\n IDecubateStaking.PoolToken memory _inputToken,\n IDecubateStaking.PoolToken memory _rewardToken,\n uint256 _hardCap\n )\n external;\n\n function set(\n uint256 _pid,\n uint256 _apy,\n uint256 _lockPeriodInDays,\n uint256 _endDate,\n address _tradesAgainst,\n uint256 _hardCap\n )\n external;\n\n function setTokens(\n uint256 _pid,\n IDecubateStaking.PoolToken memory _inputToken,\n IDecubateStaking.PoolToken memory _rewardToken,\n uint256 _maxTransferInput,\n uint256 _maxTransferReward\n )\n external;\n\n function setNFT(\n uint256 _pid,\n string memory _name,\n address _contractAdd,\n bool _isUsed,\n uint16 _multiplier,\n uint16 _startIdx,\n uint16 _endIdx\n )\n external;\n\n function transferToken(address _addr, uint256 _amount) external returns (bool);\n\n function stake(uint256 _pid, uint256 _amount) external returns (bool);\n\n function unStake(uint256 _pid, uint256 _amount) external returns (bool);\n\n function updateFeeValues(uint8 _feePercent, address _feeWallet) external;\n\n function updateTimeGap(uint32 newValue) external;\n\n function claim(uint256 _pid) external returns (bool);\n\n function claimAll() external returns (bool);\n\n function updateRatio(uint256 _pid) external returns (bool);\n\n function updateRatioAll() external returns (bool);\n\n function canUnstake(uint256 _pid, address _addr) external view returns (bool);\n\n function calcMultiplier(uint256 _pid, address _addr) external view returns (uint16 multi);\n\n function poolLength() external view returns (uint256);\n\n function getPools() external view returns (IDecubateStaking.Pool[] memory);\n\n function payout(uint256 _pid, address _addr) external view returns (uint256 value);\n\n function ownsCorrectNFT(address _addr, uint256 _pid) external view returns (bool);\n}\n\ninterface IDecubateStaking {\n struct PoolToken {\n address addr;\n address router;\n }\n\n struct Pool {\n uint256 apy;\n uint256 lockPeriodInDays;\n uint256 totalDeposit;\n uint256 hardCap;\n uint256 endDate;\n PoolToken inputToken;\n PoolToken rewardToken;\n uint256 ratio;\n address tradesAgainst;\n uint32 lastUpdatedTime;\n bool isRewardAboveInput;\n }\n}\n" }, "src/interfaces/IDCBVault.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.25;\n\ninterface IDCBVault {\n function callFee() external view returns (uint256);\n\n function masterchef() external view returns (address);\n\n function owner() external view returns (address);\n\n function paused() external view returns (bool);\n\n function pools(uint256)\n external\n view\n returns (uint256 totalShares, uint256 pendingClaim, uint256 lastHarvestedTime);\n\n function users(\n uint256,\n address\n )\n external\n view\n returns (uint256 shares, uint256 lastDepositedTime, uint256 totalInvested, uint256 totalClaimed);\n\n function initialize(address _masterchef) external;\n\n function deposit(uint256 _pid, uint256 _amount) external;\n\n function withdrawAll(uint256 _pid) external;\n\n function harvestAll() external;\n\n function setCallFee(uint256 _callFee) external;\n\n function pause() external;\n\n function unpause() external;\n\n function transferToken(address _addr, uint256 _amount) external returns (bool);\n\n function calculateTotalPendingRewards(uint256 _pid) external view returns (uint256);\n\n function calculateHarvestDcbRewards(uint256 _pid) external view returns (uint256);\n\n function getRewardOfUser(address _user, uint256 _pid) external view returns (uint256);\n\n function withdraw(uint256 _pid, uint256 _shares) external;\n\n function harvest(uint256 _pid) external;\n\n function getPricePerFullShare(uint256 _pid) external view returns (uint256);\n\n function canUnstake(address _user, uint256 _pid) external view returns (bool);\n\n function balanceOf(uint256 _pid) external view returns (uint256);\n}\n" }, "src/interfaces/IDCBVestingV2.sol": { "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.25;\n\ninterface IDCBVestingV2 {\n event AddToken(address indexed token);\n event AddWhitelist(address indexed wallet);\n event Claim(address indexed token, uint256 amount, uint256 indexed option, uint256 time);\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n event Revoked(address indexed wallet);\n event StatusChanged(address indexed wallet, bool status);\n\n function getDay(uint256 timestamp) external pure returns (uint8);\n\n function getDaysInMonth(uint8 month, uint16 year) external pure returns (uint8);\n\n function getHour(uint256 timestamp) external pure returns (uint8);\n\n function getMinute(uint256 timestamp) external pure returns (uint8);\n\n function getMonth(uint256 timestamp) external pure returns (uint8);\n\n function getSecond(uint256 timestamp) external pure returns (uint8);\n\n function getWeekday(uint256 timestamp) external pure returns (uint8);\n\n function getYear(uint256 timestamp) external pure returns (uint16);\n\n function isLeapYear(uint16 year) external pure returns (bool);\n\n function leapYearsBefore(uint256 year) external pure returns (uint256);\n\n function maxTokenTransfer() external view returns (uint256 amount, bool active);\n\n function owner() external view returns (address);\n\n function renounceOwnership() external;\n\n function toTimestamp(\n uint16 year,\n uint8 month,\n uint8 day,\n uint8 hour,\n uint8 minute\n )\n external\n pure\n returns (uint256 timestamp);\n\n function toTimestamp(uint16 year, uint8 month, uint8 day, uint8 hour) external pure returns (uint256 timestamp);\n\n function toTimestamp(uint16 year, uint8 month, uint8 day) external pure returns (uint256 timestamp);\n\n function toTimestamp(\n uint16 year,\n uint8 month,\n uint8 day,\n uint8 hour,\n uint8 minute,\n uint8 second\n )\n external\n pure\n returns (uint256 timestamp);\n\n function transferOwnership(address newOwner) external;\n\n function vestingPools(uint256)\n external\n view\n returns (\n string memory name,\n uint256 cliff,\n uint256 start,\n uint256 duration,\n uint256 initialUnlockPercent,\n bool revocable,\n uint8 vestType,\n uint256 interval,\n uint256 unlockPerInterval\n );\n\n function addVestingStrategy(\n string memory _name,\n uint256 _cliff,\n uint256 _start,\n uint256 _duration,\n uint256 _initialUnlockPercent,\n bool _revocable,\n uint256 _interval,\n uint16 _unlockPerInterval,\n uint8 _monthGap,\n uint8 _type\n )\n external\n returns (bool);\n\n function setVestingStrategy(\n uint256 _strategy,\n string memory _name,\n uint256 _cliff,\n uint256 _start,\n uint256 _duration,\n uint256 _initialUnlockPercent,\n bool _revocable,\n uint256 _interval,\n uint16 _unlockPerInterval\n )\n external\n returns (bool);\n\n function setMaxTokenTransfer(uint256 _amount, bool _active) external returns (bool);\n\n function setToken(address _addr) external returns (bool);\n\n function batchAddWhitelist(\n address[] memory wallets,\n uint256[] memory amounts,\n uint256 option\n )\n external\n returns (bool);\n\n function setWhitelist(address _wallet, uint256 _dcbAmount, uint256 _option) external returns (bool);\n\n function revoke(uint256 _option, address _wallet) external;\n\n function setVesting(uint256 _option, address _wallet, bool _status) external;\n\n function transferToken(address _addr, uint256 _amount) external returns (bool);\n\n function getWhitelist(\n uint256 _option,\n address _wallet\n )\n external\n view\n returns (DecubateVestingV2.WhitelistInfo memory);\n\n function getAllVestingPools() external view returns (DecubateVestingV2.VestingInfo[] memory);\n\n function getToken() external view returns (address);\n\n function getTotalToken(address _addr) external view returns (uint256);\n\n function hasWhitelist(uint256 _option, address _wallet) external view returns (bool);\n\n function getVestAmount(uint256 _option, address _wallet) external view returns (uint256);\n\n function getReleasableAmount(uint256 _option, address _wallet) external view returns (uint256);\n\n function getWhitelistPool(uint256 _option) external view returns (DecubateVestingV2.WhitelistInfo[] memory);\n\n function claimDistribution(uint256 _option, address _wallet) external returns (bool);\n\n function addWhitelist(address _wallet, uint256 _dcbAmount, uint256 _option) external returns (bool);\n\n function getVestingInfo(uint256 _strategy) external view returns (DecubateVestingV2.VestingInfo memory);\n}\n\ninterface DecubateVestingV2 {\n struct WhitelistInfo {\n address wallet;\n uint256 dcbAmount;\n uint256 distributedAmount;\n uint256 joinDate;\n uint256 revokeDate;\n bool revoke;\n bool disabled;\n }\n\n struct VestingInfo {\n string name;\n uint256 cliff;\n uint256 start;\n uint256 duration;\n uint256 initialUnlockPercent;\n bool revocable;\n uint8 vestType;\n uint256 interval;\n uint256 unlockPerInterval;\n uint256[] timestamps;\n }\n}\n" }, "src/interfaces/IUniswapV2Pair.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.25;\n\n/* solhint-disable */\n\ninterface IUniswapV2Pair {\n event Approval(address indexed owner, address indexed spender, uint256 value);\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n function name() external pure returns (string memory);\n function symbol() external pure returns (string memory);\n function decimals() external pure returns (uint8);\n function totalSupply() external view returns (uint256);\n function balanceOf(address owner) external view returns (uint256);\n function allowance(address owner, address spender) external view returns (uint256);\n\n function approve(address spender, uint256 value) external returns (bool);\n function transfer(address to, uint256 value) external returns (bool);\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n function PERMIT_TYPEHASH() external pure returns (bytes32);\n function nonces(address owner) external view returns (uint256);\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 )\n external;\n\n event Mint(address indexed sender, uint256 amount0, uint256 amount1);\n event Burn(address indexed sender, uint256 amount0, uint256 amount1, address indexed to);\n event Swap(\n address indexed sender,\n uint256 amount0In,\n uint256 amount1In,\n uint256 amount0Out,\n uint256 amount1Out,\n address indexed to\n );\n event Sync(uint112 reserve0, uint112 reserve1);\n\n function MINIMUM_LIQUIDITY() external pure returns (uint256);\n function factory() external view returns (address);\n function token0() external view returns (address);\n function token1() external view returns (address);\n function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);\n function price0CumulativeLast() external view returns (uint256);\n function price1CumulativeLast() external view returns (uint256);\n function kLast() external view returns (uint256);\n\n function mint(address to) external returns (uint256 liquidity);\n function burn(address to) external returns (uint256 amount0, uint256 amount1);\n function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data) external;\n function skim(address to) external;\n function sync() external;\n\n function initialize(address, address) external;\n}\n" } }, "settings": { "metadata": { "bytecodeHash": "none" }, "optimizer": { "enabled": true, "runs": 10000 }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} } }}
1
20,290,598
a1af22a182f42f663a587f2ff3ad77a9ab4617fe0f0d5ac7780eeb68d7af9454
f9eddea6b031ceffc8a7a7d7c282c635142a731a3d8bed6fdb62d1ef425111f0
b7af86d7b49ca0c618288723ea95c932e4fb4451
b7af86d7b49ca0c618288723ea95c932e4fb4451
b0475fc955ed6b4f59010f94e8377a1828fdfe6d
608060405234801561001057600080fd5b5060405161043838038061043883398101604081905261002f91610165565b806001600160a01b03811661005f57604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b61006881610079565b50610072826100c9565b5050610198565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b806001600160a01b03163b6000036100ff5760405163211eb15960e21b81526001600160a01b0382166004820152602401610056565b600180546001600160a01b0319166001600160a01b0383169081179091556040517fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b80516001600160a01b038116811461016057600080fd5b919050565b6000806040838503121561017857600080fd5b61018183610149565b915061018f60208401610149565b90509250929050565b610291806101a76000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80633659cfe61461005c5780635c60da1b14610071578063715018a61461009a5780638da5cb5b146100a2578063f2fde38b146100b3575b600080fd5b61006f61006a36600461022b565b6100c6565b005b6001546001600160a01b03165b6040516001600160a01b03909116815260200160405180910390f35b61006f6100da565b6000546001600160a01b031661007e565b61006f6100c136600461022b565b6100ee565b6100ce61012e565b6100d78161015b565b50565b6100e261012e565b6100ec60006101db565b565b6100f661012e565b6001600160a01b03811661012557604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b6100d7816101db565b6000546001600160a01b031633146100ec5760405163118cdaa760e01b815233600482015260240161011c565b806001600160a01b03163b6000036101915760405163211eb15960e21b81526001600160a01b038216600482015260240161011c565b600180546001600160a01b0319166001600160a01b0383169081179091556040517fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020828403121561023d57600080fd5b81356001600160a01b038116811461025457600080fd5b939250505056fea26469706673582212209bd2bbba6f4186c5eae1a792ac249ef610047efefe523ec98882d4161ec8722a64736f6c63430008140033000000000000000000000000c5e5018f5a7f7f064744db50da721983f8607d5e000000000000000000000000b7af86d7b49ca0c618288723ea95c932e4fb4451
608060405234801561001057600080fd5b50600436106100575760003560e01c80633659cfe61461005c5780635c60da1b14610071578063715018a61461009a5780638da5cb5b146100a2578063f2fde38b146100b3575b600080fd5b61006f61006a36600461022b565b6100c6565b005b6001546001600160a01b03165b6040516001600160a01b03909116815260200160405180910390f35b61006f6100da565b6000546001600160a01b031661007e565b61006f6100c136600461022b565b6100ee565b6100ce61012e565b6100d78161015b565b50565b6100e261012e565b6100ec60006101db565b565b6100f661012e565b6001600160a01b03811661012557604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b6100d7816101db565b6000546001600160a01b031633146100ec5760405163118cdaa760e01b815233600482015260240161011c565b806001600160a01b03163b6000036101915760405163211eb15960e21b81526001600160a01b038216600482015260240161011c565b600180546001600160a01b0319166001600160a01b0383169081179091556040517fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020828403121561023d57600080fd5b81356001600160a01b038116811461025457600080fd5b939250505056fea26469706673582212209bd2bbba6f4186c5eae1a792ac249ef610047efefe523ec98882d4161ec8722a64736f6c63430008140033
{{ "language": "Solidity", "sources": { "@openzeppelin/contracts/access/Ownable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)\n\npragma solidity ^0.8.20;\n\nimport {Context} from \"../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 * The initial owner is set to the address provided by the deployer. This can\n * 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 /**\n * @dev The caller account is not authorized to perform an operation.\n */\n error OwnableUnauthorizedAccount(address account);\n\n /**\n * @dev The owner is not a valid owner account. (eg. `address(0)`)\n */\n error OwnableInvalidOwner(address owner);\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the address provided by the deployer as the initial owner.\n */\n constructor(address initialOwner) {\n if (initialOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n _transferOwnership(initialOwner);\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 if (owner() != _msgSender()) {\n revert OwnableUnauthorizedAccount(_msgSender());\n }\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling 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 if (newOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\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/IERC1967.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC1967.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.\n */\ninterface IERC1967 {\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Emitted when the beacon is changed.\n */\n event BeaconUpgraded(address indexed beacon);\n}\n" }, "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/BeaconProxy.sol)\n\npragma solidity ^0.8.20;\n\nimport {IBeacon} from \"./IBeacon.sol\";\nimport {Proxy} from \"../Proxy.sol\";\nimport {ERC1967Utils} from \"../ERC1967/ERC1967Utils.sol\";\n\n/**\n * @dev This contract implements a proxy that gets the implementation address for each call from an {UpgradeableBeacon}.\n *\n * The beacon address can only be set once during construction, and cannot be changed afterwards. It is stored in an\n * immutable variable to avoid unnecessary storage reads, and also in the beacon storage slot specified by\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] so that it can be accessed externally.\n *\n * CAUTION: Since the beacon address can never be changed, you must ensure that you either control the beacon, or trust\n * the beacon to not upgrade the implementation maliciously.\n *\n * IMPORTANT: Do not use the implementation logic to modify the beacon storage slot. Doing so would leave the proxy in\n * an inconsistent state where the beacon storage slot does not match the beacon address.\n */\ncontract BeaconProxy is Proxy {\n // An immutable address for the beacon to avoid unnecessary SLOADs before each delegate call.\n address private immutable _beacon;\n\n /**\n * @dev Initializes the proxy with `beacon`.\n *\n * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. This\n * will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity\n * constructor.\n *\n * Requirements:\n *\n * - `beacon` must be a contract with the interface {IBeacon}.\n * - If `data` is empty, `msg.value` must be zero.\n */\n constructor(address beacon, bytes memory data) payable {\n ERC1967Utils.upgradeBeaconToAndCall(beacon, data);\n _beacon = beacon;\n }\n\n /**\n * @dev Returns the current implementation address of the associated beacon.\n */\n function _implementation() internal view virtual override returns (address) {\n return IBeacon(_getBeacon()).implementation();\n }\n\n /**\n * @dev Returns the beacon.\n */\n function _getBeacon() internal view virtual returns (address) {\n return _beacon;\n }\n}\n" }, "@openzeppelin/contracts/proxy/beacon/IBeacon.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.20;\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 * {UpgradeableBeacon} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" }, "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/UpgradeableBeacon.sol)\n\npragma solidity ^0.8.20;\n\nimport {IBeacon} from \"./IBeacon.sol\";\nimport {Ownable} from \"../../access/Ownable.sol\";\n\n/**\n * @dev This contract is used in conjunction with one or more instances of {BeaconProxy} to determine their\n * implementation contract, which is where they will delegate all function calls.\n *\n * An owner is able to change the implementation the beacon points to, thus upgrading the proxies that use this beacon.\n */\ncontract UpgradeableBeacon is IBeacon, Ownable {\n address private _implementation;\n\n /**\n * @dev The `implementation` of the beacon is invalid.\n */\n error BeaconInvalidImplementation(address implementation);\n\n /**\n * @dev Emitted when the implementation returned by the beacon is changed.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Sets the address of the initial implementation, and the initial owner who can upgrade the beacon.\n */\n constructor(address implementation_, address initialOwner) Ownable(initialOwner) {\n _setImplementation(implementation_);\n }\n\n /**\n * @dev Returns the current implementation address.\n */\n function implementation() public view virtual returns (address) {\n return _implementation;\n }\n\n /**\n * @dev Upgrades the beacon to a new implementation.\n *\n * Emits an {Upgraded} event.\n *\n * Requirements:\n *\n * - msg.sender must be the owner of the contract.\n * - `newImplementation` must be a contract.\n */\n function upgradeTo(address newImplementation) public virtual onlyOwner {\n _setImplementation(newImplementation);\n }\n\n /**\n * @dev Sets the implementation contract address for this beacon\n *\n * Requirements:\n *\n * - `newImplementation` must be a contract.\n */\n function _setImplementation(address newImplementation) private {\n if (newImplementation.code.length == 0) {\n revert BeaconInvalidImplementation(newImplementation);\n }\n _implementation = newImplementation;\n emit Upgraded(newImplementation);\n }\n}\n" }, "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/ERC1967/ERC1967Proxy.sol)\n\npragma solidity ^0.8.20;\n\nimport {Proxy} from \"../Proxy.sol\";\nimport {ERC1967Utils} from \"./ERC1967Utils.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 {\n /**\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `implementation`.\n *\n * If `_data` is nonempty, it's used as data in a delegate call to `implementation`. This will typically be an\n * encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.\n *\n * Requirements:\n *\n * - If `data` is empty, `msg.value` must be zero.\n */\n constructor(address implementation, bytes memory _data) payable {\n ERC1967Utils.upgradeToAndCall(implementation, _data);\n }\n\n /**\n * @dev Returns the current implementation address.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using\n * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\n */\n function _implementation() internal view virtual override returns (address) {\n return ERC1967Utils.getImplementation();\n }\n}\n" }, "@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/ERC1967/ERC1967Utils.sol)\n\npragma solidity ^0.8.20;\n\nimport {IBeacon} from \"../beacon/IBeacon.sol\";\nimport {Address} from \"../../utils/Address.sol\";\nimport {StorageSlot} from \"../../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 */\nlibrary ERC1967Utils {\n // We re-declare ERC-1967 events here because they can't be used directly from IERC1967.\n // This will be fixed in Solidity 0.8.21. At that point we should remove these events.\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Emitted when the beacon is changed.\n */\n event BeaconUpgraded(address indexed beacon);\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.\n */\n // solhint-disable-next-line private-vars-leading-underscore\n bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev The `implementation` of the proxy is invalid.\n */\n error ERC1967InvalidImplementation(address implementation);\n\n /**\n * @dev The `admin` of the proxy is invalid.\n */\n error ERC1967InvalidAdmin(address admin);\n\n /**\n * @dev The `beacon` of the proxy is invalid.\n */\n error ERC1967InvalidBeacon(address beacon);\n\n /**\n * @dev An upgrade function sees `msg.value > 0` that may be lost.\n */\n error ERC1967NonPayable();\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 if (newImplementation.code.length == 0) {\n revert ERC1967InvalidImplementation(newImplementation);\n }\n StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Performs implementation upgrade with additional setup call if data is nonempty.\n * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected\n * to avoid stuck value in the contract.\n *\n * Emits an {IERC1967-Upgraded} event.\n */\n function upgradeToAndCall(address newImplementation, bytes memory data) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n\n if (data.length > 0) {\n Address.functionDelegateCall(newImplementation, data);\n } else {\n _checkNonPayable();\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.\n */\n // solhint-disable-next-line private-vars-leading-underscore\n bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Returns the current admin.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using\n * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\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 if (newAdmin == address(0)) {\n revert ERC1967InvalidAdmin(address(0));\n }\n StorageSlot.getAddressSlot(ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {IERC1967-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 the keccak-256 hash of \"eip1967.proxy.beacon\" subtracted by 1.\n */\n // solhint-disable-next-line private-vars-leading-underscore\n bytes32 internal constant BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\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 if (newBeacon.code.length == 0) {\n revert ERC1967InvalidBeacon(newBeacon);\n }\n\n StorageSlot.getAddressSlot(BEACON_SLOT).value = newBeacon;\n\n address beaconImplementation = IBeacon(newBeacon).implementation();\n if (beaconImplementation.code.length == 0) {\n revert ERC1967InvalidImplementation(beaconImplementation);\n }\n }\n\n /**\n * @dev Change the beacon and trigger a setup call if data is nonempty.\n * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected\n * to avoid stuck value in the contract.\n *\n * Emits an {IERC1967-BeaconUpgraded} event.\n *\n * CAUTION: Invoking this function has no effect on an instance of {BeaconProxy} since v5, since\n * it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for\n * efficiency.\n */\n function upgradeBeaconToAndCall(address newBeacon, bytes memory data) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n\n if (data.length > 0) {\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\n } else {\n _checkNonPayable();\n }\n }\n\n /**\n * @dev Reverts if `msg.value` is not zero. It can be used to avoid `msg.value` stuck in the contract\n * if an upgrade doesn't perform an initialization call.\n */\n function _checkNonPayable() private {\n if (msg.value > 0) {\n revert ERC1967NonPayable();\n }\n }\n}\n" }, "@openzeppelin/contracts/proxy/Proxy.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.20;\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\n * function 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 _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" }, "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/transparent/ProxyAdmin.sol)\n\npragma solidity ^0.8.20;\n\nimport {ITransparentUpgradeableProxy} from \"./TransparentUpgradeableProxy.sol\";\nimport {Ownable} from \"../../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 */\ncontract ProxyAdmin is Ownable {\n /**\n * @dev The version of the upgrade interface of the contract. If this getter is missing, both `upgrade(address)`\n * and `upgradeAndCall(address,bytes)` are present, and `upgradeTo` must be used if no function should be called,\n * while `upgradeAndCall` will invoke the `receive` function if the second argument is the empty byte string.\n * If the getter returns `\"5.0.0\"`, only `upgradeAndCall(address,bytes)` is present, and the second argument must\n * be the empty byte string if no function should be called, making it impossible to invoke the `receive` function\n * during an upgrade.\n */\n string public constant UPGRADE_INTERFACE_VERSION = \"5.0.0\";\n\n /**\n * @dev Sets the initial owner who can perform upgrades.\n */\n constructor(address initialOwner) Ownable(initialOwner) {}\n\n /**\n * @dev Upgrades `proxy` to `implementation` and calls a function on the new implementation.\n * See {TransparentUpgradeableProxy-_dispatchUpgradeToAndCall}.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n * - If `data` is empty, `msg.value` must be zero.\n */\n function upgradeAndCall(\n ITransparentUpgradeableProxy proxy,\n address implementation,\n bytes memory data\n ) public payable virtual onlyOwner {\n proxy.upgradeToAndCall{value: msg.value}(implementation, data);\n }\n}\n" }, "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/transparent/TransparentUpgradeableProxy.sol)\n\npragma solidity ^0.8.20;\n\nimport {ERC1967Utils} from \"../ERC1967/ERC1967Utils.sol\";\nimport {ERC1967Proxy} from \"../ERC1967/ERC1967Proxy.sol\";\nimport {IERC1967} from \"../../interfaces/IERC1967.sol\";\nimport {ProxyAdmin} from \"./ProxyAdmin.sol\";\n\n/**\n * @dev Interface for {TransparentUpgradeableProxy}. In order to implement transparency, {TransparentUpgradeableProxy}\n * does not implement this interface directly, and its upgradeability mechanism is implemented by an internal dispatch\n * mechanism. The compiler is unaware that these functions are implemented by {TransparentUpgradeableProxy} and will not\n * include them in the ABI so this interface must be used to interact with it.\n */\ninterface ITransparentUpgradeableProxy is IERC1967 {\n function upgradeToAndCall(address, bytes calldata) external payable;\n}\n\n/**\n * @dev This contract implements a proxy that is upgradeable through an associated {ProxyAdmin} instance.\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 the {ITransparentUpgradeableProxy-upgradeToAndCall} function exposed by the proxy itself.\n * 2. If the admin calls the proxy, it can call the `upgradeToAndCall` function but any other call won't be forwarded to\n * the implementation. If the admin tries to call a function on the implementation it will fail with an error indicating\n * the proxy admin cannot fallback to the target implementation.\n *\n * These properties mean that the admin account can only be used for upgrading the proxy, so it's best if it's a\n * dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to\n * call a function from the proxy implementation. For this reason, the proxy deploys an instance of {ProxyAdmin} and\n * allows upgrades only if they come through it. You should think of the `ProxyAdmin` instance as the administrative\n * interface of the proxy, including the ability to change who can trigger upgrades by transferring ownership.\n *\n * NOTE: The real interface of this proxy is that defined in `ITransparentUpgradeableProxy`. This contract does not\n * inherit from that interface, and instead `upgradeToAndCall` is implicitly implemented using a custom dispatch\n * mechanism in `_fallback`. Consequently, the compiler will not produce an ABI for this contract. This is necessary to\n * fully implement transparency without decoding reverts caused by selector clashes between the proxy and the\n * implementation.\n *\n * NOTE: This proxy does not inherit from {Context} deliberately. The {ProxyAdmin} of this contract won't send a\n * meta-transaction in any way, and any other meta-transaction setup should be made in the implementation contract.\n *\n * IMPORTANT: This contract avoids unnecessary storage reads by setting the admin only during construction as an\n * immutable variable, preventing any changes thereafter. However, the admin slot defined in ERC-1967 can still be\n * overwritten by the implementation logic pointed to by this proxy. In such cases, the contract may end up in an\n * undesirable state where the admin slot is different from the actual admin.\n *\n * WARNING: It is not recommended to extend this contract to add additional external functions. If you do so, the\n * compiler will not check that there are no selector conflicts, due to the note above. A selector clash between any new\n * function and the functions declared in {ITransparentUpgradeableProxy} will be resolved in favor of the new one. This\n * could render the `upgradeToAndCall` function inaccessible, preventing upgradeability and compromising transparency.\n */\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\n // An immutable address for the admin to avoid unnecessary SLOADs before each call\n // at the expense of removing the ability to change the admin once it's set.\n // This is acceptable if the admin is always a ProxyAdmin instance or similar contract\n // with its own ability to transfer the permissions to another account.\n address private immutable _admin;\n\n /**\n * @dev The proxy caller is the current admin, and can't fallback to the proxy target.\n */\n error ProxyDeniedAdminAccess();\n\n /**\n * @dev Initializes an upgradeable proxy managed by an instance of a {ProxyAdmin} with an `initialOwner`,\n * backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in\n * {ERC1967Proxy-constructor}.\n */\n constructor(address _logic, address initialOwner, bytes memory _data) payable ERC1967Proxy(_logic, _data) {\n _admin = address(new ProxyAdmin(initialOwner));\n // Set the storage value and emit an event for ERC-1967 compatibility\n ERC1967Utils.changeAdmin(_proxyAdmin());\n }\n\n /**\n * @dev Returns the admin of this proxy.\n */\n function _proxyAdmin() internal virtual returns (address) {\n return _admin;\n }\n\n /**\n * @dev If caller is the admin process the call internally, otherwise transparently fallback to the proxy behavior.\n */\n function _fallback() internal virtual override {\n if (msg.sender == _proxyAdmin()) {\n if (msg.sig != ITransparentUpgradeableProxy.upgradeToAndCall.selector) {\n revert ProxyDeniedAdminAccess();\n } else {\n _dispatchUpgradeToAndCall();\n }\n } else {\n super._fallback();\n }\n }\n\n /**\n * @dev Upgrade the implementation of the proxy. See {ERC1967Utils-upgradeToAndCall}.\n *\n * Requirements:\n *\n * - If `data` is empty, `msg.value` must be zero.\n */\n function _dispatchUpgradeToAndCall() private {\n (address newImplementation, bytes memory data) = abi.decode(msg.data[4:], (address, bytes));\n ERC1967Utils.upgradeToAndCall(newImplementation, data);\n }\n}\n" }, "@openzeppelin/contracts/utils/Address.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\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://consensys.net/diligence/blog/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.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance < amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\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 or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\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 function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\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 function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance < value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 && target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) 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 FailedInnerCall();\n }\n }\n}\n" }, "@openzeppelin/contracts/utils/Context.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\npragma solidity ^0.8.20;\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 function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n" }, "@openzeppelin/contracts/utils/StorageSlot.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\n\npragma solidity ^0.8.20;\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 * ```solidity\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(newImplementation.code.length > 0);\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\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 struct StringSlot {\n string value;\n }\n\n struct BytesSlot {\n bytes 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 /**\n * @dev Returns an `StringSlot` with member `value` located at `slot`.\n */\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\n */\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` with member `value` located at `slot`.\n */\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\n */\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n}\n" } }, "settings": { "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris" } }}
1
20,290,599
42b3cdb951f70ba387a90ce6fd95c5cca1e1cdd0b314f6b56c84368d157ae3dc
1e6b1399bcf4e3eb1f7804586bcec50ae319866792d0911ed5a8205cbf6cc913
b7af86d7b49ca0c618288723ea95c932e4fb4451
b7af86d7b49ca0c618288723ea95c932e4fb4451
24d1c13ccdb6ffc69dbbb63ef55638ad902b4ab5
6080604052348015600f57600080fd5b506016601a565b60d8565b600054610100900460ff161560855760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff908116101560d6576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b61403e806100e76000396000f3fe608060405234801561001057600080fd5b50600436106101cf5760003560e01c806391c4e6b511610104578063c9431f92116100a2578063eda5d30f11610071578063eda5d30f146104ac578063edd58f2f146104d7578063f087c8eb146104fb578063ffc7b0951461050e57600080fd5b8063c9431f9214610401578063d547741f14610414578063e753e60014610427578063eb9e70d11461049957600080fd5b8063bc063e1a116100de578063bc063e1a1461039d578063be0c439c146103bb578063c4d66de8146103ce578063c52c5c88146103e157600080fd5b806391c4e6b51461033157806391d148541461035c578063a217fddf1461039557600080fd5b80633c06462611610171578063544a65051161014b578063544a6505146102e557806362015bdc146102f857806373d5692f1461030b5780637aed2b001461031e57600080fd5b80633c0646261461029f5780634db80fb7146102bf5780635406a113146102d257600080fd5b8063248a9ca3116101ad578063248a9ca3146102245780632f2ff15d146102555780633194bfe11461026857806336568abe1461028c57600080fd5b806301ffc9a7146101d45780630bb85cb8146101fc57806320cc7b4e14610211575b600080fd5b6101e76101e2366004612f1c565b610530565b60405190151581526020015b60405180910390f35b61020f61020a366004613083565b6105c9565b005b61020f61021f366004613147565b6108c3565b610247610232366004613180565b60009081526065602052604090206001015490565b6040519081526020016101f3565b61020f610263366004613199565b610b4c565b61027b6102763660046131be565b610b76565b6040516101f3959493929190613295565b61020f61029a366004613199565b610c53565b6102476102ad3660046131be565b60976020526000908152604090205481565b6101e76102cd3660046132e0565b610cfe565b61020f6102e0366004613380565b610f0a565b61020f6102f3366004613417565b611045565b6101e76103063660046131be565b6114b2565b61020f6103193660046132e0565b6115e8565b61020f61032c36600461348d565b61173d565b61024761033f366004613147565b609860209081526000928352604080842090915290825290205481565b6101e761036a366004613199565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b610247600081565b6103a661138881565b60405163ffffffff90911681526020016101f3565b61020f6103c93660046134bb565b6117ef565b61020f6103dc3660046131be565b611995565b6103f46103ef3660046131be565b611bcf565b6040516101f3919061351e565b61020f61040f36600461356b565b611d09565b61020f610422366004613199565b611de4565b609c54609d546104629163ffffffff808216926401000000008304909116916001600160a01b03680100000000000000009091048116911684565b6040805163ffffffff95861681529490931660208501526001600160a01b03918216928401929092521660608201526080016101f3565b61020f6104a73660046135af565b611e09565b609a546104bf906001600160a01b031681565b6040516001600160a01b0390911681526020016101f3565b6104ea6104e5366004613147565b61249c565b6040516101f3959493929190613618565b6104bf610509366004613180565b6126b2565b61052161051c366004613147565b6126dc565b6040516101f393929190613717565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b0000000000000000000000000000000000000000000000000000000014806105c357507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b3360009081527fcee91eb23e767f0f440dd9fce5554f355614443931e9ac5ce78c67b9e06e6f70602052604090205460ff16610631576040517fc0b2335a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60408101516001600160a01b03161580610656575060608101516001600160a01b0316155b8061066c575060808101516001600160a01b0316155b156106a3576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03808316600090815260996020908152604080832060030154815160a081018352848152928301849052908201839052606082018390526080820192909252849291909116906106f8612eb3565b6040808601516001600160a01b0390811684526080808801805183166020808801919091526060808b01805186168988015260c0808d018051848c0152848e015163ffffffff908116888d0152905160a0808c01919091528e0151918a01919091528c511688528051861691880191909152825185169387019390935260e0808b01519087015291518a841660009081526099909352918490206001810180549385167fffffffffffffffffffffffff00000000000000000000000000000000000000009485161790559051600290910180549184169190921617905590517ffe94fb550000000000000000000000000000000000000000000000000000000081529085169063fe94fb55906108129084906004016137d3565b600060405180830381600087803b15801561082c57600080fd5b505af1158015610840573d6000803e3d6000fd5b50506040517fab29b2f90000000000000000000000000000000000000000000000000000000081526001600160a01b038616925063ab29b2f9915061088990859060040161384e565b600060405180830381600087803b1580156108a357600080fd5b505af11580156108b7573d6000803e3d6000fd5b50505050505050505050565b3360009081527fcee91eb23e767f0f440dd9fce5554f355614443931e9ac5ce78c67b9e06e6f70602052604090205460ff1661092b576040517fc0b2335a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038281166000908152609960205260409020600301541661097f576040517f80cb55e200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0381166109bf576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0382811660009081526099602052604081206002810180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169385169390931790925560039091015474010000000000000000000000000000000000000000900460ff166001811115610a3c57610a3c61322b565b03610aba576040517f144fa6d70000000000000000000000000000000000000000000000000000000081526001600160a01b03828116600483015283919082169063144fa6d790602401600060405180830381600087803b158015610aa057600080fd5b505af1158015610ab4573d6000803e3d6000fd5b50505050505b6001600160a01b03828116600090815260996020526040908190206003015490517f144fa6d70000000000000000000000000000000000000000000000000000000081528383166004820152911690819063144fa6d7906024015b600060405180830381600087803b158015610b2f57600080fd5b505af1158015610b43573d6000803e3d6000fd5b50505050505050565b600082815260656020526040902060010154610b6781612903565b610b718383612910565b505050565b609960205260009081526040902080548190610b9190613896565b80601f0160208091040260200160405190810160405280929190818152602001828054610bbd90613896565b8015610c0a5780601f10610bdf57610100808354040283529160200191610c0a565b820191906000526020600020905b815481529060010190602001808311610bed57829003601f168201915b505050506001830154600284015460039094015492936001600160a01b039182169390821692509081169074010000000000000000000000000000000000000000900460ff1685565b6001600160a01b0381163314610cf0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b610cfa82826129d0565b5050565b6001600160a01b03828116600090815260996020526040812060030154909116610d54576040517f80cb55e200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336001600160a01b03841614610d96576040517fea8e4eb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0380841660009081526098602090815260408083209388168352929052908120549003610dee576001600160a01b0384166000908152609760205260408120805491610de883613912565b91905055505b81158015610e1357506001600160a01b03841660009081526097602052604090205415155b8015610e67575060016001600160a01b03841660009081526099602052604090206003015474010000000000000000000000000000000000000000900460ff166001811115610e6457610e6461322b565b14155b15610e96576001600160a01b0384166000908152609760205260408120805491610e908361394a565b91905055505b6001600160a01b03838116600081815260986020908152604080832094891680845294825291829020869055815193845283019190915281018390527f88b0ff6070d5534a52a2c337fae5e16039fdf801b632d9150c3c7c09b24d2d589060600160405180910390a15060015b9392505050565b3360009081527fcee91eb23e767f0f440dd9fce5554f355614443931e9ac5ce78c67b9e06e6f70602052604090205460ff16610f72576040517fc0b2335a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60208101516001600160a01b0316610fb6576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6020818101516001600160a01b038481166000818152609990945260409384902060020180547fffffffffffffffffffffffff000000000000000000000000000000000000000016929093169190911790915590517f9f03a510000000000000000000000000000000000000000000000000000000008152839190639f03a51090610b1590859060040161397f565b3360009081527fcee91eb23e767f0f440dd9fce5554f355614443931e9ac5ce78c67b9e06e6f70602052604090205460ff166110ad576040517fc0b2335a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60208201516001600160a01b03166110f1576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b815163ffffffff1681351015611133576040517fb290253c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006111b4609a60009054906101000a90046001600160a01b03166001600160a01b0316639f8fbf076040518163ffffffff1660e01b8152600401602060405180830381865afa15801561118b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111af91906139c3565b612a71565b9050600061120e609a60009054906101000a90046001600160a01b03166001600160a01b03166387df55746040518163ffffffff1660e01b8152600401602060405180830381865afa15801561118b573d6000803e3d6000fd5b6001600160a01b0380821660408088019190915290841660009081526099602052209091508290829080611243898b83613a30565b506003810180547fffffffffffffffffffffff000000000000000000000000000000000000000000166001600160a01b0386811691909117740100000000000000000000000000000000000000001790915560208801516002830180547fffffffffffffffffffffffff0000000000000000000000000000000000000000908116928416929092179055609b80546001810182556000919091527fbba9db4cdbea0a37c207bbb83e20f828cd4441c49891101dc94fd20dc8efc3490180549091168783161790556040517f5040ed0700000000000000000000000000000000000000000000000000000000815290841690635040ed0790611348908a9060040161397f565b600060405180830381600087803b15801561136257600080fd5b505af1158015611376573d6000803e3d6000fd5b50505060208801516040517faee6023a0000000000000000000000000000000000000000000000000000000081526001600160a01b038516925063aee6023a916113c4918a90600401613b2d565b600060405180830381600087803b1580156113de57600080fd5b505af11580156113f2573d6000803e3d6000fd5b50506040517ff2fde38b0000000000000000000000000000000000000000000000000000000081526001600160a01b0388811660048301528516925063f2fde38b9150602401600060405180830381600087803b15801561145257600080fd5b505af1158015611466573d6000803e3d6000fd5b505050507fb20920cbc00d91a5286a1f82c7ae4e8b283ef71f5f7a7429b7d95c442c9e430a8989898960405161149f9493929190613b96565b60405180910390a1505050505050505050565b6001600160a01b03818116600090815260996020526040812060030154909116611508576040517f80cb55e200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038281166000818152609960209081526040918290206003015482513381529182019390935291909216917fa7da82a0253d08a8beb54da7b1b6a79346b048788d9e6ba26cc5b57fd9da15ef910160405180910390a16040517f62015bdc0000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b038216906362015bdc906024016020604051808303816000875af11580156115c4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f039190613c21565b3360009081527fcee91eb23e767f0f440dd9fce5554f355614443931e9ac5ce78c67b9e06e6f70602052604090205460ff16611650576040517fc0b2335a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03838116600090815260996020526040902060030154166116a4576040517f80cb55e200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03838116600090815260996020526040908190206003015490517f573761980000000000000000000000000000000000000000000000000000000081528483166004820152602481018490529116908190635737619890604401600060405180830381600087803b15801561171f57600080fd5b505af1158015611733573d6000803e3d6000fd5b5050505050505050565b600061174881612903565b811561177d576117787f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0884610b4c565b6117a7565b6117a77f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0884611de4565b604080516001600160a01b038516815283151560208201527f4e0821e9e83e6ed2861d90c07a96114379e9c5b5e6ea2afec5ac6e49d745314c910160405180910390a1505050565b3360009081527fcee91eb23e767f0f440dd9fce5554f355614443931e9ac5ce78c67b9e06e6f70602052604090205460ff16611857576040517fc0b2335a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6118646002611388613c3e565b63ffffffff16816000015163ffffffff16118061189c57506118896002611388613c3e565b63ffffffff16816020015163ffffffff16115b156118d3576040517f58d620b300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8051609c80546020840151604085015163ffffffff9485167fffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000909316929092176401000000009490911693909302929092177fffffffff0000000000000000000000000000000000000000ffffffffffffffff16680100000000000000006001600160a01b0393841602179055606090910151609d80547fffffffffffffffffffffffff00000000000000000000000000000000000000001691909216179055565b600054610100900460ff16158080156119b55750600054600160ff909116105b806119cf5750303b1580156119cf575060005460ff166001145b611a5b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610ce7565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558015611ab957600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b6001600160a01b038216611af9576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611b01612b2c565b611b0c600033612bc5565b611b367f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0833612bc5565b609a80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0384161790558015610cfa57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b6001600160a01b0381166000908152609760205260408120546060919067ffffffffffffffff811115611c0457611c04612f7e565b604051908082528060200260200182016040528015611c2d578160200160208202803683370190505b5090506000805b609b54811015611d005760986000609b8381548110611c5557611c55613c88565b60009182526020808320909101546001600160a01b039081168452838201949094526040928301822093891682529290925290205415611cf857609b8181548110611ca257611ca2613c88565b9060005260206000200160009054906101000a90046001600160a01b0316838381518110611cd257611cd2613c88565b6001600160a01b039092166020928302919091019091015281611cf481613912565b9250505b600101611c34565b50909392505050565b3360009081527fcee91eb23e767f0f440dd9fce5554f355614443931e9ac5ce78c67b9e06e6f70602052604090205460ff16611d71576040517fc0b2335a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03858116600090815260996020526040908190206003015490517f8dfd6a89000000000000000000000000000000000000000000000000000000008152600481018790526024810186905260448101859052606481018490529116908190638dfd6a8990608401610889565b600082815260656020526040902060010154611dff81612903565b610b7183836129d0565b3360009081527fcee91eb23e767f0f440dd9fce5554f355614443931e9ac5ce78c67b9e06e6f70602052604090205460ff16611e71576040517fc0b2335a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000611e8360608401604085016131be565b6001600160a01b03161480611eb057506000611ea560808401606085016131be565b6001600160a01b0316145b80611ed357506000611ec860a08401608085016131be565b6001600160a01b0316145b15611f0a576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000611f1e61014084016101208501613cb7565b611f3061012085016101008601613cb7565b611f41610100860160e08701613cb7565b611f4b9190613cd2565b611f559190613cd2565b63ffffffff16905080611f6b6020850185613cb7565b63ffffffff16611f7b9190613cef565b82351015611fb5576040517fb290253c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061200d609a60009054906101000a90046001600160a01b03166001600160a01b0316634f47c9426040518163ffffffff1660e01b8152600401602060405180830381865afa15801561118b573d6000803e3d6000fd5b90506000612067609a60009054906101000a90046001600160a01b03166001600160a01b03166387df55746040518163ffffffff1660e01b8152600401602060405180830381865afa15801561118b573d6000803e3d6000fd5b6040805160a081018252600080825260208201819052918101829052606081018290526080810191909152909150829082906120a1612eb3565b6120b160608a0160408b016131be565b6001600160a01b031682526120cc60a08a0160808b016131be565b6001600160a01b031660208301526120ea60808a0160608b016131be565b6001600160a01b031660408084019190915260c08a01356060840152612115908a0160208b01613cb7565b63ffffffff166080830152306020808301919091526001600160a01b038616604083015260c0808b013560a0808501919091528b01359083015261215b908a018a613cb7565b63ffffffff16815261217360808a0160608b016131be565b6001600160a01b0316606082015261219160a08a0160808b016131be565b6001600160a01b031660808201526040805160608181019092529060e08b01906003908390839080828437600092018290525060e085019390935250506001600160a01b0387168152609960205260409020806121ef8c8e83613a30565b506003810180547fffffffffffffffffffffff000000000000000000000000000000000000000000166001600160a01b03881617905561223560a08b0160808c016131be565b6002820180547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b039290921691909117905561227f60808b0160608c016131be565b600182810180547fffffffffffffffffffffffff00000000000000000000000000000000000000009081166001600160a01b0394851617909155609b805492830181556000527fbba9db4cdbea0a37c207bbb83e20f828cd4441c49891101dc94fd20dc8efc34990910180549091168983161790556040517fdb2a4c290000000000000000000000000000000000000000000000000000000081529086169063db2a4c29906123329085906004016137d3565b600060405180830381600087803b15801561234c57600080fd5b505af1158015612360573d6000803e3d6000fd5b50506040517fed6dc4060000000000000000000000000000000000000000000000000000000081526001600160a01b038716925063ed6dc40691506123ab9086908d90600401613d02565b600060405180830381600087803b1580156123c557600080fd5b505af11580156123d9573d6000803e3d6000fd5b50506040517ff2fde38b0000000000000000000000000000000000000000000000000000000081526001600160a01b038a811660048301528716925063f2fde38b9150602401600060405180830381600087803b15801561243957600080fd5b505af115801561244d573d6000803e3d6000fd5b505050507f993202c1097d48ff4047ade98c46c82c5bd4f808be20c79669fff0b7b6c7d2a28c8c8c8c6040516124869493929190613da7565b60405180910390a1505050505050505050505050565b6124cb6040805160a0810182526060808252600060208301819052928201839052810182905290608082015290565b60006124f86040518060800160405280600081526020016000815260200160008152602001600081525090565b6125436040518060e0016040528060001515815260200160006001600160a01b0316815260200160008152602001600081526020016000815260200160008152602001600081525090565b600061254f87876126dc565b6001600160a01b03808a16600090815260996020908152604080832060988352818420948f168452939091529081902054815160a08101909252825495985093965091945092869186918691908690829082906125ab90613896565b80601f01602080910402602001604051908101604052809291908181526020018280546125d790613896565b80156126245780601f106125f957610100808354040283529160200191612624565b820191906000526020600020905b81548152906001019060200180831161260757829003601f168201915b50505091835250506001828101546001600160a01b0390811660208401526002840154811660408401526003840154908116606084015260809092019174010000000000000000000000000000000000000000900460ff169081111561268c5761268c61322b565b600181111561269d5761269d61322b565b9052509c939b50919950975095509350505050565b609b81815481106126c257600080fd5b6000918252602090912001546001600160a01b0316905081565b6127076040518060800160405280600081526020016000815260200160008152602001600081525090565b6127526040518060e0016040528060001515815260200160006001600160a01b0316815260200160008152602001600081526020016000815260200160008152602001600081525090565b6001600160a01b038084166000908152609960205260408082206003015481517fdc25a300000000000000000000000000000000000000000000000000000000008152915192931691829163dc25a3009160048083019260809291908290030181865afa1580156127c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127eb9190613e91565b6040517f30edc0f50000000000000000000000000000000000000000000000000000000081526001600160a01b038881166004830152919550908216906330edc0f59060240160e060405180830381865afa15801561284e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128729190613ed7565b6040517f2afd1a7d0000000000000000000000000000000000000000000000000000000081526001600160a01b03888116600483015291945090821690632afd1a7d90602401602060405180830381865afa1580156128d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128f99190613f6d565b9150509250925092565b61290d8133612bcf565b50565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff16610cfa5760008281526065602090815260408083206001600160a01b0385168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905561298c3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff1615610cfa5760008281526065602090815260408083206001600160a01b038516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000763d602d80600a3d3981f3363d3d373d3d3d363d730000008260601b60e81c176000526e5af43d82803e903d91602b57fd5bf38260781b17602052603760096000f090506001600160a01b038116612b27576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f455243313136373a20637265617465206661696c6564000000000000000000006044820152606401610ce7565b919050565b600054610100900460ff16612bc3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610ce7565b565b610cfa8282612910565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff16610cfa57612c0281612c5e565b612c0d836020612c70565b604051602001612c1e929190613f86565b60408051601f19818403018152908290527f08c379a0000000000000000000000000000000000000000000000000000000008252610ce791600401614007565b60606105c36001600160a01b03831660145b60606000612c7f83600261401a565b612c8a906002613cef565b67ffffffffffffffff811115612ca257612ca2612f7e565b6040519080825280601f01601f191660200182016040528015612ccc576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110612d0357612d03613c88565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110612d6657612d66613c88565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000612da284600261401a565b612dad906001613cef565b90505b6001811115612e4a577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110612dee57612dee613c88565b1a60f81b828281518110612e0457612e04613c88565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93612e438161394a565b9050612db0565b508315610f03576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610ce7565b6040805161010081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c081019190915260e08101612ef9612efe565b905290565b60405180606001604052806003906020820280368337509192915050565b600060208284031215612f2e57600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610f0357600080fd5b6001600160a01b038116811461290d57600080fd5b8035612b2781612f5e565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051610100810167ffffffffffffffff81118282101715612fd157612fd1612f7e565b60405290565b6040516080810167ffffffffffffffff81118282101715612fd157612fd1612f7e565b803563ffffffff81168114612b2757600080fd5b600082601f83011261301f57600080fd5b6040516060810181811067ffffffffffffffff8211171561304257613042612f7e565b60405280606084018581111561305757600080fd5b845b818110156130785761306a81612ffa565b835260209283019201613059565b509195945050505050565b60008082840361016081121561309857600080fd5b83356130a381612f5e565b9250610140601f19820112156130b857600080fd5b506130c1612fad565b6130cd60208501612ffa565b81526130db60408501612ffa565b602082015260608401356130ee81612f5e565b60408201526130ff60808501612f73565b606082015261311060a08501612f73565b608082015260c084013560a082015260e084013560c082015261313785610100860161300e565b60e0820152809150509250929050565b6000806040838503121561315a57600080fd5b823561316581612f5e565b9150602083013561317581612f5e565b809150509250929050565b60006020828403121561319257600080fd5b5035919050565b600080604083850312156131ac57600080fd5b82359150602083013561317581612f5e565b6000602082840312156131d057600080fd5b8135610f0381612f5e565b60005b838110156131f65781810151838201526020016131de565b50506000910152565b600081518084526132178160208601602086016131db565b601f01601f19169290920160200192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60028110613291577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b9052565b60a0815260006132a860a08301886131ff565b6001600160a01b03878116602085015286811660408501528516606084015290506132d6608083018461325a565b9695505050505050565b6000806000606084860312156132f557600080fd5b833561330081612f5e565b9250602084013561331081612f5e565b929592945050506040919091013590565b60006080828403121561333357600080fd5b61333b612fd7565b905061334682612ffa565b8152602082013561335681612f5e565b6020820152604082013561336981612f5e565b806040830152506060820135606082015292915050565b60008060a0838503121561339357600080fd5b823561339e81612f5e565b91506133ad8460208501613321565b90509250929050565b60008083601f8401126133c857600080fd5b50813567ffffffffffffffff8111156133e057600080fd5b6020830191508360208285010111156133f857600080fd5b9250929050565b60006080828403121561341157600080fd5b50919050565b600080600080610120858703121561342e57600080fd5b843567ffffffffffffffff81111561344557600080fd5b613451878288016133b6565b909550935061346590508660208701613321565b91506134748660a087016133ff565b905092959194509250565b801515811461290d57600080fd5b600080604083850312156134a057600080fd5b82356134ab81612f5e565b915060208301356131758161347f565b6000608082840312156134cd57600080fd5b6134d5612fd7565b6134de83612ffa565b81526134ec60208401612ffa565b602082015260408301356134ff81612f5e565b6040820152606083013561351281612f5e565b60608201529392505050565b6020808252825182820181905260009190848201906040850190845b8181101561355f5783516001600160a01b03168352928401929184019160010161353a565b50909695505050505050565b600080600080600060a0868803121561358357600080fd5b853561358e81612f5e565b97602087013597506040870135966060810135965060800135945092505050565b6000806000808486036101e08112156135c757600080fd5b853567ffffffffffffffff8111156135de57600080fd5b6135ea888289016133b6565b909650945050610140601f198201121561360357600080fd5b506020850191506134748661016087016133ff565b60006101c0808352875160a0828501526136366102608501826131ff565b60208a01516001600160a01b039081166101e087015260408b0151811661020087015260608b01511661022086015260808a0151909250905061367d61024085018261325a565b506020830187905290506136b56040830186805182526020810151602083015260408101516040830152606081015160608301525050565b8351151560c08381019190915260208501516001600160a01b031660e084015260408501516101008401526060850151610120840152608085015161014084015260a0850151610160840152909301516101808201526101a001529392505050565b83518152602080850151908201526040808501519082015260608085015190820152610180810161379560808301858051151582526001600160a01b03602082015116602083015260408101516040830152606081015160608301526080810151608083015260a081015160a083015260c081015160c08301525050565b82610160830152949350505050565b8060005b60038110156137cd57815163ffffffff168452602093840193909101906001016137a8565b50505050565b60006101408201905063ffffffff835116825260208301516001600160a01b038082166020850152806040860151166040850152806060860151166060850152806080860151166080850152505060a083015160a083015260c083015160c083015260e083015161384760e08401826137a4565b5092915050565b60a081016105c382846001600160a01b038082511683528060208301511660208401528060408301511660408401525060608101516060830152608081015160808301525050565b600181811c908216806138aa57607f821691505b602082108103613411577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203613943576139436138e3565b5060010190565b600081613959576139596138e3565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b608081016105c3828463ffffffff815116825260208101516001600160a01b0380821660208501528060408401511660408501525050606081015160608301525050565b6000602082840312156139d557600080fd5b8151610f0381612f5e565b601f821115610b71576000816000526020600020601f850160051c81016020861015613a095750805b601f850160051c820191505b81811015613a2857828155600101613a15565b505050505050565b67ffffffffffffffff831115613a4857613a48612f7e565b613a5c83613a568354613896565b836139e0565b6000601f841160018114613aae5760008515613a785750838201355b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600387901b1c1916600186901b178355613b26565b600083815260209020601f19861690835b82811015613adf5786850135825560209485019460019092019101613abf565b5086821015613b1a577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b6001600160a01b038316815260a08101610f036020830184803582526020810135602083015260408101356040830152606081013560608301525050565b818352818160208501375060006020828401015260006020601f19601f840116840101905092915050565b6000610120808352613bab8184018789613b6b565b915050613bf1602083018563ffffffff815116825260208101516001600160a01b0380821660208501528060408401511660408501525050606081015160608301525050565b823560a0830152602083013560c0830152604083013560e083015260608301356101008301525b95945050505050565b600060208284031215613c3357600080fd5b8151610f038161347f565b600063ffffffff80841680613c7c577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b92169190910492915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215613cc957600080fd5b610f0382612ffa565b63ffffffff818116838216019080821115613847576138476138e3565b808201808211156105c3576105c36138e3565b6101208101613d4b82856001600160a01b038082511683528060208301511660208401528060408301511660408401525060608101516060830152608081015160808301525050565b823560a0830152602083013560c0830152604083013560e08301526060830135610100830152610f03565b8060005b60038110156137cd5763ffffffff613d9183612ffa565b1684526020938401939190910190600101613d7a565b60006101e0808352613dbc8184018789613b6b565b91505063ffffffff80613dce86612ffa565b16602084015280613de160208701612ffa565b166040840152506040840135613df681612f5e565b6001600160a01b038116606084015250613e1260608501612f73565b6001600160a01b038116608084015250613e2e60808501612f73565b6001600160a01b03811660a08401525060a084013560c083015260c084013560e0830152613e63610100830160e08601613d76565b8235610160830152602083013561018083015260408301356101a083015260608301356101c0830152613c18565b600060808284031215613ea357600080fd5b613eab612fd7565b825181526020830151602082015260408301516040820152606083015160608201528091505092915050565b600060e08284031215613ee957600080fd5b60405160e0810181811067ffffffffffffffff82111715613f0c57613f0c612f7e565b6040528251613f1a8161347f565b81526020830151613f2a81612f5e565b8060208301525060408301516040820152606083015160608201526080830151608082015260a083015160a082015260c083015160c08201528091505092915050565b600060208284031215613f7f57600080fd5b5051919050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351613fbe8160178501602088016131db565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351613ffb8160288401602088016131db565b01602801949350505050565b602081526000610f0360208301846131ff565b80820281158282048414176105c3576105c36138e356fea164736f6c6343000819000a
608060405234801561001057600080fd5b50600436106101cf5760003560e01c806391c4e6b511610104578063c9431f92116100a2578063eda5d30f11610071578063eda5d30f146104ac578063edd58f2f146104d7578063f087c8eb146104fb578063ffc7b0951461050e57600080fd5b8063c9431f9214610401578063d547741f14610414578063e753e60014610427578063eb9e70d11461049957600080fd5b8063bc063e1a116100de578063bc063e1a1461039d578063be0c439c146103bb578063c4d66de8146103ce578063c52c5c88146103e157600080fd5b806391c4e6b51461033157806391d148541461035c578063a217fddf1461039557600080fd5b80633c06462611610171578063544a65051161014b578063544a6505146102e557806362015bdc146102f857806373d5692f1461030b5780637aed2b001461031e57600080fd5b80633c0646261461029f5780634db80fb7146102bf5780635406a113146102d257600080fd5b8063248a9ca3116101ad578063248a9ca3146102245780632f2ff15d146102555780633194bfe11461026857806336568abe1461028c57600080fd5b806301ffc9a7146101d45780630bb85cb8146101fc57806320cc7b4e14610211575b600080fd5b6101e76101e2366004612f1c565b610530565b60405190151581526020015b60405180910390f35b61020f61020a366004613083565b6105c9565b005b61020f61021f366004613147565b6108c3565b610247610232366004613180565b60009081526065602052604090206001015490565b6040519081526020016101f3565b61020f610263366004613199565b610b4c565b61027b6102763660046131be565b610b76565b6040516101f3959493929190613295565b61020f61029a366004613199565b610c53565b6102476102ad3660046131be565b60976020526000908152604090205481565b6101e76102cd3660046132e0565b610cfe565b61020f6102e0366004613380565b610f0a565b61020f6102f3366004613417565b611045565b6101e76103063660046131be565b6114b2565b61020f6103193660046132e0565b6115e8565b61020f61032c36600461348d565b61173d565b61024761033f366004613147565b609860209081526000928352604080842090915290825290205481565b6101e761036a366004613199565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b610247600081565b6103a661138881565b60405163ffffffff90911681526020016101f3565b61020f6103c93660046134bb565b6117ef565b61020f6103dc3660046131be565b611995565b6103f46103ef3660046131be565b611bcf565b6040516101f3919061351e565b61020f61040f36600461356b565b611d09565b61020f610422366004613199565b611de4565b609c54609d546104629163ffffffff808216926401000000008304909116916001600160a01b03680100000000000000009091048116911684565b6040805163ffffffff95861681529490931660208501526001600160a01b03918216928401929092521660608201526080016101f3565b61020f6104a73660046135af565b611e09565b609a546104bf906001600160a01b031681565b6040516001600160a01b0390911681526020016101f3565b6104ea6104e5366004613147565b61249c565b6040516101f3959493929190613618565b6104bf610509366004613180565b6126b2565b61052161051c366004613147565b6126dc565b6040516101f393929190613717565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b0000000000000000000000000000000000000000000000000000000014806105c357507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b3360009081527fcee91eb23e767f0f440dd9fce5554f355614443931e9ac5ce78c67b9e06e6f70602052604090205460ff16610631576040517fc0b2335a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60408101516001600160a01b03161580610656575060608101516001600160a01b0316155b8061066c575060808101516001600160a01b0316155b156106a3576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03808316600090815260996020908152604080832060030154815160a081018352848152928301849052908201839052606082018390526080820192909252849291909116906106f8612eb3565b6040808601516001600160a01b0390811684526080808801805183166020808801919091526060808b01805186168988015260c0808d018051848c0152848e015163ffffffff908116888d0152905160a0808c01919091528e0151918a01919091528c511688528051861691880191909152825185169387019390935260e0808b01519087015291518a841660009081526099909352918490206001810180549385167fffffffffffffffffffffffff00000000000000000000000000000000000000009485161790559051600290910180549184169190921617905590517ffe94fb550000000000000000000000000000000000000000000000000000000081529085169063fe94fb55906108129084906004016137d3565b600060405180830381600087803b15801561082c57600080fd5b505af1158015610840573d6000803e3d6000fd5b50506040517fab29b2f90000000000000000000000000000000000000000000000000000000081526001600160a01b038616925063ab29b2f9915061088990859060040161384e565b600060405180830381600087803b1580156108a357600080fd5b505af11580156108b7573d6000803e3d6000fd5b50505050505050505050565b3360009081527fcee91eb23e767f0f440dd9fce5554f355614443931e9ac5ce78c67b9e06e6f70602052604090205460ff1661092b576040517fc0b2335a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038281166000908152609960205260409020600301541661097f576040517f80cb55e200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0381166109bf576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0382811660009081526099602052604081206002810180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169385169390931790925560039091015474010000000000000000000000000000000000000000900460ff166001811115610a3c57610a3c61322b565b03610aba576040517f144fa6d70000000000000000000000000000000000000000000000000000000081526001600160a01b03828116600483015283919082169063144fa6d790602401600060405180830381600087803b158015610aa057600080fd5b505af1158015610ab4573d6000803e3d6000fd5b50505050505b6001600160a01b03828116600090815260996020526040908190206003015490517f144fa6d70000000000000000000000000000000000000000000000000000000081528383166004820152911690819063144fa6d7906024015b600060405180830381600087803b158015610b2f57600080fd5b505af1158015610b43573d6000803e3d6000fd5b50505050505050565b600082815260656020526040902060010154610b6781612903565b610b718383612910565b505050565b609960205260009081526040902080548190610b9190613896565b80601f0160208091040260200160405190810160405280929190818152602001828054610bbd90613896565b8015610c0a5780601f10610bdf57610100808354040283529160200191610c0a565b820191906000526020600020905b815481529060010190602001808311610bed57829003601f168201915b505050506001830154600284015460039094015492936001600160a01b039182169390821692509081169074010000000000000000000000000000000000000000900460ff1685565b6001600160a01b0381163314610cf0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b610cfa82826129d0565b5050565b6001600160a01b03828116600090815260996020526040812060030154909116610d54576040517f80cb55e200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336001600160a01b03841614610d96576040517fea8e4eb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0380841660009081526098602090815260408083209388168352929052908120549003610dee576001600160a01b0384166000908152609760205260408120805491610de883613912565b91905055505b81158015610e1357506001600160a01b03841660009081526097602052604090205415155b8015610e67575060016001600160a01b03841660009081526099602052604090206003015474010000000000000000000000000000000000000000900460ff166001811115610e6457610e6461322b565b14155b15610e96576001600160a01b0384166000908152609760205260408120805491610e908361394a565b91905055505b6001600160a01b03838116600081815260986020908152604080832094891680845294825291829020869055815193845283019190915281018390527f88b0ff6070d5534a52a2c337fae5e16039fdf801b632d9150c3c7c09b24d2d589060600160405180910390a15060015b9392505050565b3360009081527fcee91eb23e767f0f440dd9fce5554f355614443931e9ac5ce78c67b9e06e6f70602052604090205460ff16610f72576040517fc0b2335a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60208101516001600160a01b0316610fb6576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6020818101516001600160a01b038481166000818152609990945260409384902060020180547fffffffffffffffffffffffff000000000000000000000000000000000000000016929093169190911790915590517f9f03a510000000000000000000000000000000000000000000000000000000008152839190639f03a51090610b1590859060040161397f565b3360009081527fcee91eb23e767f0f440dd9fce5554f355614443931e9ac5ce78c67b9e06e6f70602052604090205460ff166110ad576040517fc0b2335a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60208201516001600160a01b03166110f1576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b815163ffffffff1681351015611133576040517fb290253c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006111b4609a60009054906101000a90046001600160a01b03166001600160a01b0316639f8fbf076040518163ffffffff1660e01b8152600401602060405180830381865afa15801561118b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111af91906139c3565b612a71565b9050600061120e609a60009054906101000a90046001600160a01b03166001600160a01b03166387df55746040518163ffffffff1660e01b8152600401602060405180830381865afa15801561118b573d6000803e3d6000fd5b6001600160a01b0380821660408088019190915290841660009081526099602052209091508290829080611243898b83613a30565b506003810180547fffffffffffffffffffffff000000000000000000000000000000000000000000166001600160a01b0386811691909117740100000000000000000000000000000000000000001790915560208801516002830180547fffffffffffffffffffffffff0000000000000000000000000000000000000000908116928416929092179055609b80546001810182556000919091527fbba9db4cdbea0a37c207bbb83e20f828cd4441c49891101dc94fd20dc8efc3490180549091168783161790556040517f5040ed0700000000000000000000000000000000000000000000000000000000815290841690635040ed0790611348908a9060040161397f565b600060405180830381600087803b15801561136257600080fd5b505af1158015611376573d6000803e3d6000fd5b50505060208801516040517faee6023a0000000000000000000000000000000000000000000000000000000081526001600160a01b038516925063aee6023a916113c4918a90600401613b2d565b600060405180830381600087803b1580156113de57600080fd5b505af11580156113f2573d6000803e3d6000fd5b50506040517ff2fde38b0000000000000000000000000000000000000000000000000000000081526001600160a01b0388811660048301528516925063f2fde38b9150602401600060405180830381600087803b15801561145257600080fd5b505af1158015611466573d6000803e3d6000fd5b505050507fb20920cbc00d91a5286a1f82c7ae4e8b283ef71f5f7a7429b7d95c442c9e430a8989898960405161149f9493929190613b96565b60405180910390a1505050505050505050565b6001600160a01b03818116600090815260996020526040812060030154909116611508576040517f80cb55e200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038281166000818152609960209081526040918290206003015482513381529182019390935291909216917fa7da82a0253d08a8beb54da7b1b6a79346b048788d9e6ba26cc5b57fd9da15ef910160405180910390a16040517f62015bdc0000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b038216906362015bdc906024016020604051808303816000875af11580156115c4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f039190613c21565b3360009081527fcee91eb23e767f0f440dd9fce5554f355614443931e9ac5ce78c67b9e06e6f70602052604090205460ff16611650576040517fc0b2335a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03838116600090815260996020526040902060030154166116a4576040517f80cb55e200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03838116600090815260996020526040908190206003015490517f573761980000000000000000000000000000000000000000000000000000000081528483166004820152602481018490529116908190635737619890604401600060405180830381600087803b15801561171f57600080fd5b505af1158015611733573d6000803e3d6000fd5b5050505050505050565b600061174881612903565b811561177d576117787f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0884610b4c565b6117a7565b6117a77f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0884611de4565b604080516001600160a01b038516815283151560208201527f4e0821e9e83e6ed2861d90c07a96114379e9c5b5e6ea2afec5ac6e49d745314c910160405180910390a1505050565b3360009081527fcee91eb23e767f0f440dd9fce5554f355614443931e9ac5ce78c67b9e06e6f70602052604090205460ff16611857576040517fc0b2335a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6118646002611388613c3e565b63ffffffff16816000015163ffffffff16118061189c57506118896002611388613c3e565b63ffffffff16816020015163ffffffff16115b156118d3576040517f58d620b300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8051609c80546020840151604085015163ffffffff9485167fffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000909316929092176401000000009490911693909302929092177fffffffff0000000000000000000000000000000000000000ffffffffffffffff16680100000000000000006001600160a01b0393841602179055606090910151609d80547fffffffffffffffffffffffff00000000000000000000000000000000000000001691909216179055565b600054610100900460ff16158080156119b55750600054600160ff909116105b806119cf5750303b1580156119cf575060005460ff166001145b611a5b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610ce7565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558015611ab957600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b6001600160a01b038216611af9576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611b01612b2c565b611b0c600033612bc5565b611b367f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0833612bc5565b609a80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0384161790558015610cfa57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b6001600160a01b0381166000908152609760205260408120546060919067ffffffffffffffff811115611c0457611c04612f7e565b604051908082528060200260200182016040528015611c2d578160200160208202803683370190505b5090506000805b609b54811015611d005760986000609b8381548110611c5557611c55613c88565b60009182526020808320909101546001600160a01b039081168452838201949094526040928301822093891682529290925290205415611cf857609b8181548110611ca257611ca2613c88565b9060005260206000200160009054906101000a90046001600160a01b0316838381518110611cd257611cd2613c88565b6001600160a01b039092166020928302919091019091015281611cf481613912565b9250505b600101611c34565b50909392505050565b3360009081527fcee91eb23e767f0f440dd9fce5554f355614443931e9ac5ce78c67b9e06e6f70602052604090205460ff16611d71576040517fc0b2335a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03858116600090815260996020526040908190206003015490517f8dfd6a89000000000000000000000000000000000000000000000000000000008152600481018790526024810186905260448101859052606481018490529116908190638dfd6a8990608401610889565b600082815260656020526040902060010154611dff81612903565b610b7183836129d0565b3360009081527fcee91eb23e767f0f440dd9fce5554f355614443931e9ac5ce78c67b9e06e6f70602052604090205460ff16611e71576040517fc0b2335a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000611e8360608401604085016131be565b6001600160a01b03161480611eb057506000611ea560808401606085016131be565b6001600160a01b0316145b80611ed357506000611ec860a08401608085016131be565b6001600160a01b0316145b15611f0a576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000611f1e61014084016101208501613cb7565b611f3061012085016101008601613cb7565b611f41610100860160e08701613cb7565b611f4b9190613cd2565b611f559190613cd2565b63ffffffff16905080611f6b6020850185613cb7565b63ffffffff16611f7b9190613cef565b82351015611fb5576040517fb290253c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061200d609a60009054906101000a90046001600160a01b03166001600160a01b0316634f47c9426040518163ffffffff1660e01b8152600401602060405180830381865afa15801561118b573d6000803e3d6000fd5b90506000612067609a60009054906101000a90046001600160a01b03166001600160a01b03166387df55746040518163ffffffff1660e01b8152600401602060405180830381865afa15801561118b573d6000803e3d6000fd5b6040805160a081018252600080825260208201819052918101829052606081018290526080810191909152909150829082906120a1612eb3565b6120b160608a0160408b016131be565b6001600160a01b031682526120cc60a08a0160808b016131be565b6001600160a01b031660208301526120ea60808a0160608b016131be565b6001600160a01b031660408084019190915260c08a01356060840152612115908a0160208b01613cb7565b63ffffffff166080830152306020808301919091526001600160a01b038616604083015260c0808b013560a0808501919091528b01359083015261215b908a018a613cb7565b63ffffffff16815261217360808a0160608b016131be565b6001600160a01b0316606082015261219160a08a0160808b016131be565b6001600160a01b031660808201526040805160608181019092529060e08b01906003908390839080828437600092018290525060e085019390935250506001600160a01b0387168152609960205260409020806121ef8c8e83613a30565b506003810180547fffffffffffffffffffffff000000000000000000000000000000000000000000166001600160a01b03881617905561223560a08b0160808c016131be565b6002820180547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b039290921691909117905561227f60808b0160608c016131be565b600182810180547fffffffffffffffffffffffff00000000000000000000000000000000000000009081166001600160a01b0394851617909155609b805492830181556000527fbba9db4cdbea0a37c207bbb83e20f828cd4441c49891101dc94fd20dc8efc34990910180549091168983161790556040517fdb2a4c290000000000000000000000000000000000000000000000000000000081529086169063db2a4c29906123329085906004016137d3565b600060405180830381600087803b15801561234c57600080fd5b505af1158015612360573d6000803e3d6000fd5b50506040517fed6dc4060000000000000000000000000000000000000000000000000000000081526001600160a01b038716925063ed6dc40691506123ab9086908d90600401613d02565b600060405180830381600087803b1580156123c557600080fd5b505af11580156123d9573d6000803e3d6000fd5b50506040517ff2fde38b0000000000000000000000000000000000000000000000000000000081526001600160a01b038a811660048301528716925063f2fde38b9150602401600060405180830381600087803b15801561243957600080fd5b505af115801561244d573d6000803e3d6000fd5b505050507f993202c1097d48ff4047ade98c46c82c5bd4f808be20c79669fff0b7b6c7d2a28c8c8c8c6040516124869493929190613da7565b60405180910390a1505050505050505050505050565b6124cb6040805160a0810182526060808252600060208301819052928201839052810182905290608082015290565b60006124f86040518060800160405280600081526020016000815260200160008152602001600081525090565b6125436040518060e0016040528060001515815260200160006001600160a01b0316815260200160008152602001600081526020016000815260200160008152602001600081525090565b600061254f87876126dc565b6001600160a01b03808a16600090815260996020908152604080832060988352818420948f168452939091529081902054815160a08101909252825495985093965091945092869186918691908690829082906125ab90613896565b80601f01602080910402602001604051908101604052809291908181526020018280546125d790613896565b80156126245780601f106125f957610100808354040283529160200191612624565b820191906000526020600020905b81548152906001019060200180831161260757829003601f168201915b50505091835250506001828101546001600160a01b0390811660208401526002840154811660408401526003840154908116606084015260809092019174010000000000000000000000000000000000000000900460ff169081111561268c5761268c61322b565b600181111561269d5761269d61322b565b9052509c939b50919950975095509350505050565b609b81815481106126c257600080fd5b6000918252602090912001546001600160a01b0316905081565b6127076040518060800160405280600081526020016000815260200160008152602001600081525090565b6127526040518060e0016040528060001515815260200160006001600160a01b0316815260200160008152602001600081526020016000815260200160008152602001600081525090565b6001600160a01b038084166000908152609960205260408082206003015481517fdc25a300000000000000000000000000000000000000000000000000000000008152915192931691829163dc25a3009160048083019260809291908290030181865afa1580156127c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127eb9190613e91565b6040517f30edc0f50000000000000000000000000000000000000000000000000000000081526001600160a01b038881166004830152919550908216906330edc0f59060240160e060405180830381865afa15801561284e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128729190613ed7565b6040517f2afd1a7d0000000000000000000000000000000000000000000000000000000081526001600160a01b03888116600483015291945090821690632afd1a7d90602401602060405180830381865afa1580156128d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128f99190613f6d565b9150509250925092565b61290d8133612bcf565b50565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff16610cfa5760008281526065602090815260408083206001600160a01b0385168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905561298c3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff1615610cfa5760008281526065602090815260408083206001600160a01b038516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000763d602d80600a3d3981f3363d3d373d3d3d363d730000008260601b60e81c176000526e5af43d82803e903d91602b57fd5bf38260781b17602052603760096000f090506001600160a01b038116612b27576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f455243313136373a20637265617465206661696c6564000000000000000000006044820152606401610ce7565b919050565b600054610100900460ff16612bc3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610ce7565b565b610cfa8282612910565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff16610cfa57612c0281612c5e565b612c0d836020612c70565b604051602001612c1e929190613f86565b60408051601f19818403018152908290527f08c379a0000000000000000000000000000000000000000000000000000000008252610ce791600401614007565b60606105c36001600160a01b03831660145b60606000612c7f83600261401a565b612c8a906002613cef565b67ffffffffffffffff811115612ca257612ca2612f7e565b6040519080825280601f01601f191660200182016040528015612ccc576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110612d0357612d03613c88565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110612d6657612d66613c88565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000612da284600261401a565b612dad906001613cef565b90505b6001811115612e4a577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110612dee57612dee613c88565b1a60f81b828281518110612e0457612e04613c88565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93612e438161394a565b9050612db0565b508315610f03576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610ce7565b6040805161010081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c081019190915260e08101612ef9612efe565b905290565b60405180606001604052806003906020820280368337509192915050565b600060208284031215612f2e57600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610f0357600080fd5b6001600160a01b038116811461290d57600080fd5b8035612b2781612f5e565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051610100810167ffffffffffffffff81118282101715612fd157612fd1612f7e565b60405290565b6040516080810167ffffffffffffffff81118282101715612fd157612fd1612f7e565b803563ffffffff81168114612b2757600080fd5b600082601f83011261301f57600080fd5b6040516060810181811067ffffffffffffffff8211171561304257613042612f7e565b60405280606084018581111561305757600080fd5b845b818110156130785761306a81612ffa565b835260209283019201613059565b509195945050505050565b60008082840361016081121561309857600080fd5b83356130a381612f5e565b9250610140601f19820112156130b857600080fd5b506130c1612fad565b6130cd60208501612ffa565b81526130db60408501612ffa565b602082015260608401356130ee81612f5e565b60408201526130ff60808501612f73565b606082015261311060a08501612f73565b608082015260c084013560a082015260e084013560c082015261313785610100860161300e565b60e0820152809150509250929050565b6000806040838503121561315a57600080fd5b823561316581612f5e565b9150602083013561317581612f5e565b809150509250929050565b60006020828403121561319257600080fd5b5035919050565b600080604083850312156131ac57600080fd5b82359150602083013561317581612f5e565b6000602082840312156131d057600080fd5b8135610f0381612f5e565b60005b838110156131f65781810151838201526020016131de565b50506000910152565b600081518084526132178160208601602086016131db565b601f01601f19169290920160200192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60028110613291577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b9052565b60a0815260006132a860a08301886131ff565b6001600160a01b03878116602085015286811660408501528516606084015290506132d6608083018461325a565b9695505050505050565b6000806000606084860312156132f557600080fd5b833561330081612f5e565b9250602084013561331081612f5e565b929592945050506040919091013590565b60006080828403121561333357600080fd5b61333b612fd7565b905061334682612ffa565b8152602082013561335681612f5e565b6020820152604082013561336981612f5e565b806040830152506060820135606082015292915050565b60008060a0838503121561339357600080fd5b823561339e81612f5e565b91506133ad8460208501613321565b90509250929050565b60008083601f8401126133c857600080fd5b50813567ffffffffffffffff8111156133e057600080fd5b6020830191508360208285010111156133f857600080fd5b9250929050565b60006080828403121561341157600080fd5b50919050565b600080600080610120858703121561342e57600080fd5b843567ffffffffffffffff81111561344557600080fd5b613451878288016133b6565b909550935061346590508660208701613321565b91506134748660a087016133ff565b905092959194509250565b801515811461290d57600080fd5b600080604083850312156134a057600080fd5b82356134ab81612f5e565b915060208301356131758161347f565b6000608082840312156134cd57600080fd5b6134d5612fd7565b6134de83612ffa565b81526134ec60208401612ffa565b602082015260408301356134ff81612f5e565b6040820152606083013561351281612f5e565b60608201529392505050565b6020808252825182820181905260009190848201906040850190845b8181101561355f5783516001600160a01b03168352928401929184019160010161353a565b50909695505050505050565b600080600080600060a0868803121561358357600080fd5b853561358e81612f5e565b97602087013597506040870135966060810135965060800135945092505050565b6000806000808486036101e08112156135c757600080fd5b853567ffffffffffffffff8111156135de57600080fd5b6135ea888289016133b6565b909650945050610140601f198201121561360357600080fd5b506020850191506134748661016087016133ff565b60006101c0808352875160a0828501526136366102608501826131ff565b60208a01516001600160a01b039081166101e087015260408b0151811661020087015260608b01511661022086015260808a0151909250905061367d61024085018261325a565b506020830187905290506136b56040830186805182526020810151602083015260408101516040830152606081015160608301525050565b8351151560c08381019190915260208501516001600160a01b031660e084015260408501516101008401526060850151610120840152608085015161014084015260a0850151610160840152909301516101808201526101a001529392505050565b83518152602080850151908201526040808501519082015260608085015190820152610180810161379560808301858051151582526001600160a01b03602082015116602083015260408101516040830152606081015160608301526080810151608083015260a081015160a083015260c081015160c08301525050565b82610160830152949350505050565b8060005b60038110156137cd57815163ffffffff168452602093840193909101906001016137a8565b50505050565b60006101408201905063ffffffff835116825260208301516001600160a01b038082166020850152806040860151166040850152806060860151166060850152806080860151166080850152505060a083015160a083015260c083015160c083015260e083015161384760e08401826137a4565b5092915050565b60a081016105c382846001600160a01b038082511683528060208301511660208401528060408301511660408401525060608101516060830152608081015160808301525050565b600181811c908216806138aa57607f821691505b602082108103613411577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203613943576139436138e3565b5060010190565b600081613959576139596138e3565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b608081016105c3828463ffffffff815116825260208101516001600160a01b0380821660208501528060408401511660408501525050606081015160608301525050565b6000602082840312156139d557600080fd5b8151610f0381612f5e565b601f821115610b71576000816000526020600020601f850160051c81016020861015613a095750805b601f850160051c820191505b81811015613a2857828155600101613a15565b505050505050565b67ffffffffffffffff831115613a4857613a48612f7e565b613a5c83613a568354613896565b836139e0565b6000601f841160018114613aae5760008515613a785750838201355b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600387901b1c1916600186901b178355613b26565b600083815260209020601f19861690835b82811015613adf5786850135825560209485019460019092019101613abf565b5086821015613b1a577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b6001600160a01b038316815260a08101610f036020830184803582526020810135602083015260408101356040830152606081013560608301525050565b818352818160208501375060006020828401015260006020601f19601f840116840101905092915050565b6000610120808352613bab8184018789613b6b565b915050613bf1602083018563ffffffff815116825260208101516001600160a01b0380821660208501528060408401511660408501525050606081015160608301525050565b823560a0830152602083013560c0830152604083013560e083015260608301356101008301525b95945050505050565b600060208284031215613c3357600080fd5b8151610f038161347f565b600063ffffffff80841680613c7c577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b92169190910492915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215613cc957600080fd5b610f0382612ffa565b63ffffffff818116838216019080821115613847576138476138e3565b808201808211156105c3576105c36138e3565b6101208101613d4b82856001600160a01b038082511683528060208301511660208401528060408301511660408401525060608101516060830152608081015160808301525050565b823560a0830152602083013560c0830152604083013560e08301526060830135610100830152610f03565b8060005b60038110156137cd5763ffffffff613d9183612ffa565b1684526020938401939190910190600101613d7a565b60006101e0808352613dbc8184018789613b6b565b91505063ffffffff80613dce86612ffa565b16602084015280613de160208701612ffa565b166040840152506040840135613df681612f5e565b6001600160a01b038116606084015250613e1260608501612f73565b6001600160a01b038116608084015250613e2e60808501612f73565b6001600160a01b03811660a08401525060a084013560c083015260c084013560e0830152613e63610100830160e08601613d76565b8235610160830152602083013561018083015260408301356101a083015260608301356101c0830152613c18565b600060808284031215613ea357600080fd5b613eab612fd7565b825181526020830151602082015260408301516040820152606083015160608201528091505092915050565b600060e08284031215613ee957600080fd5b60405160e0810181811067ffffffffffffffff82111715613f0c57613f0c612f7e565b6040528251613f1a8161347f565b81526020830151613f2a81612f5e565b8060208301525060408301516040820152606083015160608201526080830151608082015260a083015160a082015260c083015160c08201528091505092915050565b600060208284031215613f7f57600080fd5b5051919050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351613fbe8160178501602088016131db565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351613ffb8160288401602088016131db565b01602801949350505050565b602081526000610f0360208301846131ff565b80820281158282048414176105c3576105c36138e356fea164736f6c6343000819000a
{{ "language": "Solidity", "sources": { "openzeppelin-contracts-upgradeable/contracts/access/AccessControlUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControlUpgradeable.sol\";\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../utils/StringsUpgradeable.sol\";\nimport \"../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev 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 */\nabstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {\n function __AccessControl_init() internal onlyInitializing {\n }\n\n function __AccessControl_init_unchained() internal onlyInitializing {\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 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]{40}) is missing role (0x[0-9a-f]{64})$/\n *\n * _Available since v4.1._\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\n return _roles[role].members[account];\n }\n\n /**\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\n * Overriding this function changes the behavior of the {onlyRole} modifier.\n *\n * Format of the revert message is described in {_checkRole}.\n *\n * _Available since v4.6._\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\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]{40}) is missing role (0x[0-9a-f]{64})$/\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert(\n string(\n abi.encodePacked(\n \"AccessControl: account \",\n StringsUpgradeable.toHexString(account),\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 virtual override 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 * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual override 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 * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual override 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 revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address account) public virtual override {\n require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\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 * May emit a {RoleGranted} event.\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 * NOTE: This function is deprecated in favor of {_grantRole}.\n */\n function _setupRole(bytes32 role, address account) internal virtual {\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 virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n emit RoleGranted(role, account, _msgSender());\n }\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n }\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/contracts/access/IAccessControlUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControlUpgradeable {\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 {AccessControl-_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 Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) external view returns (bool);\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 {AccessControl-_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\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;\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;\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}\n" }, "openzeppelin-contracts-upgradeable/contracts/proxy/ClonesUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (proxy/Clones.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for\n * deploying minimal proxy contracts, also known as \"clones\".\n *\n * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies\n * > a minimal bytecode implementation that delegates all calls to a known, fixed address.\n *\n * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`\n * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the\n * deterministic method.\n *\n * _Available since v3.4._\n */\nlibrary ClonesUpgradeable {\n /**\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\n *\n * This function uses the create opcode, which should never revert.\n */\n function clone(address implementation) internal returns (address instance) {\n /// @solidity memory-safe-assembly\n assembly {\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\n // of the `implementation` address with the bytecode before the address.\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\n instance := create(0, 0x09, 0x37)\n }\n require(instance != address(0), \"ERC1167: create failed\");\n }\n\n /**\n * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\n *\n * This function uses the create2 opcode and a `salt` to deterministically deploy\n * the clone. Using the same `implementation` and `salt` multiple time will revert, since\n * the clones cannot be deployed twice at the same address.\n */\n function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {\n /// @solidity memory-safe-assembly\n assembly {\n // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\n // of the `implementation` address with the bytecode before the address.\n mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\n // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\n mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\n instance := create2(0, 0x09, 0x37, salt)\n }\n require(instance != address(0), \"ERC1167: create2 failed\");\n }\n\n /**\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\n */\n function predictDeterministicAddress(\n address implementation,\n bytes32 salt,\n address deployer\n ) internal pure returns (address predicted) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40)\n mstore(add(ptr, 0x38), deployer)\n mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff)\n mstore(add(ptr, 0x14), implementation)\n mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73)\n mstore(add(ptr, 0x58), salt)\n mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37))\n predicted := keccak256(add(ptr, 0x43), 0x55)\n }\n }\n\n /**\n * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\n */\n function predictDeterministicAddress(address implementation, bytes32 salt)\n internal\n view\n returns (address predicted)\n {\n return predictDeterministicAddress(implementation, salt, address(this));\n }\n}\n" }, "openzeppelin-contracts-upgradeable/contracts/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/contracts/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/contracts/utils/ContextUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\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/contracts/utils/introspection/ERC165Upgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\n function __ERC165_init() internal onlyInitializing {\n }\n\n function __ERC165_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165Upgradeable).interfaceId;\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/contracts/utils/introspection/IERC165Upgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165Upgradeable {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" }, "openzeppelin-contracts-upgradeable/contracts/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/contracts/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/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(address from, address to, uint256 amount) external returns (bool);\n}\n" }, "src/DCBFactory.sol": { "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.25;\n\nimport { AccessControlUpgradeable } from\n \"openzeppelin-contracts-upgradeable/contracts/access/AccessControlUpgradeable.sol\";\nimport { ClonesUpgradeable } from \"openzeppelin-contracts-upgradeable/contracts/proxy/ClonesUpgradeable.sol\";\n\nimport { IDCBVesting } from \"./interfaces/IDCBVesting.sol\";\nimport { IDCBIDO } from \"./interfaces/IDCBIDO.sol\";\nimport { IDCBL2E } from \"./interfaces/IDCBL2E.sol\";\nimport { IDCBReference } from \"./interfaces/IDCBReference.sol\";\n\n/**\n * @title DCBFactory\n * @dev Factory contract for deploying IDO and L2E events with vesting.\n */\ncontract DCBFactory is AccessControlUpgradeable {\n /**\n * @dev Types of events that can be deployed.\n */\n enum Type {\n IDO,\n L2E\n }\n\n /**\n * @dev Struct representing an event.\n * @param name Name of the event.\n * @param paymentToken Address of the payment token.\n * @param tokenAddress Address of the event token.\n * @param vestingAddress Address of the vesting contract.\n * @param eventType Type of the event (IDO or L2E).\n */\n struct Event {\n string name;\n address paymentToken;\n address tokenAddress;\n address vestingAddress;\n Type eventType;\n }\n\n /**\n * @dev Parameters required for deploying an IDO event.\n *\n * @param startDate Start date of the IDO.\n * @param gracePeriod Grace period for refund\n * @param innovator Address of the innovator.\n * @param paymentToken Address of the payment token.\n * @param saleTokenAddr Address of the token being sold.\n * @param hardcap Hardcap for the IDO.\n * @param totalTokenOnSale Total tokens on sale.\n * @param durations Array of durations for the IDO (GA,FCFS1, FCFS2)\n *\n */\n struct IDOParams {\n uint32 startDate;\n uint32 gracePeriod;\n address innovator;\n address paymentToken;\n address saleTokenAddr;\n uint256 hardcap;\n uint256 totalTokenOnSale;\n uint32[3] durations;\n }\n\n /**\n * @dev Struct representing fee data.\n * @param platformFee Platform fee percentage.\n * @param decubateFee Decubate fee percentage.\n * @param platformFeeReceiver Address of the platform fee receiver.\n * @param decubateFeeReceiver Address of the decubate fee receiver.\n */\n struct Fee {\n uint32 platformFee;\n uint32 decubateFee;\n address platformFeeReceiver;\n address decubateFeeReceiver;\n }\n\n // Maps user address to the number of investments made by the user\n mapping(address => uint256) public numUserInvestments;\n // Maps user address to the amount invested in a specific event\n mapping(address => mapping(address => uint256)) public userAmount;\n // Maps event contract address to its details\n mapping(address => Event) public events;\n\n // Implementation contract addresses\n IDCBReference public referenceContract;\n\n // List of deployed event contract addresses\n address[] public eventsList;\n // Fee data struct\n Fee public feeData;\n // Role identifier for the manager role\n bytes32 internal constant MANAGER_ROLE = keccak256(\"MANAGER_ROLE\");\n // Max fee value\n uint32 public constant MAX_FEE = 5000;\n\n // Error messages\n error ZeroAddress();\n error OnlyManager();\n error InvalidStartTime();\n error NotActive();\n error NotAuthorized();\n error InvalidFee();\n\n // Events\n event IDODeployed(string _name, IDOParams _c, IDCBVesting.VestingSetup _v);\n event L2EDeployed(string _name, IDCBL2E.Params _t, IDCBVesting.VestingSetup _v);\n event DistributionClaimed(address _user, address _event);\n event ImplementationsChanged(address _newVesting, address _newL2E, address _newIDO);\n event ManagerRoleSet(address _user, bool _status);\n event UserInvestmentSet(address _address, address _event, uint256 _amount);\n\n // Modifier to allow only the manager to execute a function\n modifier onlyManager() {\n if (!hasRole(MANAGER_ROLE, msg.sender)) revert OnlyManager();\n _;\n }\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() {\n _disableInitializers();\n }\n\n /**\n * @dev Initializes the contract, setting the deployer as the default admin and manager.\n */\n function initialize(address _referenceContract) external initializer {\n if (_referenceContract == address(0)) revert ZeroAddress();\n __AccessControl_init();\n _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);\n _setupRole(MANAGER_ROLE, msg.sender);\n\n referenceContract = IDCBReference(_referenceContract);\n }\n\n /**\n * @dev Deploys a new IDO event.\n * @param _name Name of the IDO event.\n * @param _c Parameters for the IDO event.\n * @param _v Vesting setup for the IDO event.\n */\n function deployIDO(\n string calldata _name,\n IDOParams calldata _c,\n IDCBVesting.VestingSetup calldata _v\n )\n external\n onlyManager\n {\n // Input validation\n if (_c.innovator == address(0) || _c.paymentToken == address(0) || _c.saleTokenAddr == address(0)) {\n revert ZeroAddress();\n }\n uint256 totalDuration = _c.durations[0] + _c.durations[1] + _c.durations[2];\n if (_v._startTime < _c.startDate + totalDuration) revert InvalidStartTime();\n\n // Deploy new IDO and vesting contracts\n address newIDO = ClonesUpgradeable.clone(referenceContract.getIdoImpl());\n address newVesting = ClonesUpgradeable.clone(referenceContract.getVestingImpl());\n\n IDCBIDO c = IDCBIDO(newIDO);\n IDCBVesting v = IDCBVesting(newVesting);\n\n IDCBVesting.ContractSetup memory _s;\n IDCBIDO.Params memory _p;\n\n // Set up parameters for the contracts\n _s._innovator = _c.innovator;\n _s._vestedToken = _c.saleTokenAddr;\n _s._paymentToken = _c.paymentToken;\n _s._totalTokenOnSale = _c.totalTokenOnSale;\n _s._gracePeriod = _c.gracePeriod;\n\n _p.factoryAddr = address(this);\n _p.vestingAddr = newVesting;\n _p.totalTokenOnSale = _c.totalTokenOnSale;\n _p.hardcap = _c.hardcap;\n _p.startDate = _c.startDate;\n _p.paymentToken = _c.paymentToken;\n _p.saleTokenAddr = _c.saleTokenAddr;\n _p.durations = _c.durations;\n\n // Set event details\n Event storage e = events[newIDO];\n e.name = _name;\n e.eventType = Type.IDO;\n e.vestingAddress = newVesting;\n e.tokenAddress = _c.saleTokenAddr;\n e.paymentToken = _c.paymentToken;\n\n // Add new IDO contract address to the list\n eventsList.push(newIDO);\n\n // Initialize contracts\n c.initialize(_p);\n v.initializeIDO(_s, _v);\n v.transferOwnership(newIDO);\n\n // Emit event\n emit IDODeployed(_name, _c, _v);\n }\n\n /**\n * @dev Deploys a new L2E event.\n * @param _name Name of the L2E event.\n * @param _t Parameters for the L2E event.\n * @param _v Vesting setup for the L2E event.\n */\n function deployL2E(\n string calldata _name,\n IDCBL2E.Params memory _t,\n IDCBVesting.VestingSetup calldata _v\n )\n external\n onlyManager\n {\n // Input validation\n if (_t.rewardTokenAddr == address(0)) revert ZeroAddress();\n if (_v._startTime < _t.endDate) revert InvalidStartTime();\n\n // Deploy new L2E and vesting contracts\n address newL2E = ClonesUpgradeable.clone(referenceContract.getL2eImpl());\n address newVesting = ClonesUpgradeable.clone(referenceContract.getVestingImpl());\n\n IDCBL2E c = IDCBL2E(newL2E);\n IDCBVesting v = IDCBVesting(newVesting);\n\n _t.vestingAddr = newVesting;\n\n // Set event details\n Event storage e = events[newL2E];\n e.name = _name;\n e.eventType = Type.L2E;\n e.vestingAddress = newVesting;\n e.tokenAddress = _t.rewardTokenAddr;\n\n // Add new L2E contract address to the list\n eventsList.push(newL2E);\n\n // Initialize contracts\n c.initialize(_t);\n v.initializeL2E(_t.rewardTokenAddr, _v);\n v.transferOwnership(newL2E);\n\n // Emit event\n emit L2EDeployed(_name, _t, _v);\n }\n\n /**\n * @dev Sets the investment amount for a user in a specific event.\n * @param _address Address of the user.\n * @param _event Address of the event.\n * @param _amount Investment amount.\n * @return bool Indicates if the operation was successful.\n */\n function setUserInvestment(address _address, address _event, uint256 _amount) external returns (bool) {\n // Check if the event is active\n if (events[_event].vestingAddress == address(0)) revert NotActive();\n // Check if the caller is authorized to update the investment amount\n if (msg.sender != _event) revert NotAuthorized();\n\n // Update user investment details\n if (userAmount[_event][_address] == 0) {\n numUserInvestments[_address]++;\n }\n\n if (_amount == 0 && numUserInvestments[_address] > 0 && events[_event].eventType != Type.L2E) {\n numUserInvestments[_address]--;\n }\n\n userAmount[_event][_address] = _amount;\n\n // Emit event\n emit UserInvestmentSet(_address, _event, _amount);\n\n return true;\n }\n\n /**\n * @dev Sets the manager role for a user.\n * @param _user Address of the user.\n * @param _status Status of the manager role (true to grant, false to revoke).\n */\n function setManagerRole(address _user, bool _status) external onlyRole(DEFAULT_ADMIN_ROLE) {\n // Grant or revoke manager role\n if (_status) {\n grantRole(MANAGER_ROLE, _user);\n } else {\n revokeRole(MANAGER_ROLE, _user);\n }\n\n // Emit event\n emit ManagerRoleSet(_user, _status);\n }\n\n /**\n * @dev Sets the fee values.\n * @param _feeData Fee data.\n */\n function setFeeValues(Fee memory _feeData) external onlyManager {\n if (_feeData.platformFee > MAX_FEE / 2 || _feeData.decubateFee > MAX_FEE / 2) revert InvalidFee();\n // Set fee data\n feeData = _feeData;\n }\n\n /**\n * @dev Changes vesting parameters for a specific event.\n * @param _event Address of the event.\n * @param _cliff Vesting cliff duration.\n * @param _start Vesting start time.\n * @param _duration Vesting duration.\n * @param _initialUnlockPercent Initial unlock percentage.\n */\n function changeVestingParams(\n address _event,\n uint256 _cliff,\n uint256 _start,\n uint256 _duration,\n uint256 _initialUnlockPercent\n )\n external\n onlyManager\n {\n // Access vesting contract and update parameters\n IDCBVesting vesting = IDCBVesting(events[_event].vestingAddress);\n vesting.setVestingParams(_cliff, _start, _duration, _initialUnlockPercent);\n }\n\n /**\n * @dev Changes IDO parameters for a specific event.\n * @param _event Address of the event.\n * @param _c New IDO parameters.\n */\n function changeIDOParams(address _event, IDOParams memory _c) external onlyManager {\n // Input validation\n if (_c.innovator == address(0) || _c.paymentToken == address(0) || _c.saleTokenAddr == address(0)) {\n revert ZeroAddress();\n }\n // Access IDO and vesting contracts and update parameters\n IDCBIDO ido = IDCBIDO(_event);\n IDCBVesting vesting = IDCBVesting(events[_event].vestingAddress);\n\n IDCBVesting.ContractSetup memory _s;\n IDCBIDO.Params memory _p;\n\n _s._innovator = _c.innovator;\n _s._vestedToken = _c.saleTokenAddr;\n _s._paymentToken = _c.paymentToken;\n _s._totalTokenOnSale = _c.totalTokenOnSale;\n _s._gracePeriod = _c.gracePeriod;\n\n _p.totalTokenOnSale = _c.totalTokenOnSale;\n _p.hardcap = _c.hardcap;\n _p.startDate = _c.startDate;\n _p.paymentToken = _c.paymentToken;\n _p.saleTokenAddr = _c.saleTokenAddr;\n _p.durations = _c.durations;\n\n // Update event details\n events[_event].paymentToken = _c.paymentToken;\n events[_event].tokenAddress = _c.saleTokenAddr;\n\n // Update IDO contract with new parameters\n ido.setParams(_p);\n vesting.setIDOParams(_s);\n }\n\n /**\n * @dev Changes L2E parameters for a specific event.\n * @param _event Address of the event.\n * @param _t New L2E parameters.\n */\n function changeL2EParams(address _event, IDCBL2E.Params memory _t) external onlyManager {\n // Input validation\n if (_t.rewardTokenAddr == address(0)) revert ZeroAddress();\n // Access L2E contract and update parameters\n IDCBL2E l2e = IDCBL2E(_event);\n // Update event token address\n events[_event].tokenAddress = _t.rewardTokenAddr;\n // Set new L2E parameters\n l2e.setParams(_t);\n }\n\n /**\n * @dev Changes the token address for a specific event.\n * @param _event Address of the event.\n * @param _newToken New token address.\n */\n function changeToken(address _event, address _newToken) external onlyManager {\n // Check if the event is active\n if (events[_event].vestingAddress == address(0)) revert NotActive();\n // Input validation\n if (_newToken == address(0)) revert ZeroAddress();\n // Update event token address\n events[_event].tokenAddress = _newToken;\n\n // Update token address in IDO contract if event type is IDO\n if (events[_event].eventType == Type.IDO) {\n IDCBIDO ido = IDCBIDO(_event);\n ido.setToken(_newToken);\n }\n\n // Update token address in vesting contract\n IDCBVesting vesting = IDCBVesting(events[_event].vestingAddress);\n vesting.setToken(_newToken);\n }\n\n /**\n * @dev Rescues tokens from a specific event's vesting contract.\n * @param _event Address of the event.\n * @param _receiver Address to receive the rescued tokens.\n * @param _amount Amount of tokens to rescue.\n */\n function rescueTokensFromContract(address _event, address _receiver, uint256 _amount) external onlyManager {\n // Check if the event is active\n if (events[_event].vestingAddress == address(0)) revert NotActive();\n // Access vesting contract and rescue tokens\n IDCBVesting vesting = IDCBVesting(events[_event].vestingAddress);\n vesting.rescueTokens(_receiver, _amount);\n }\n\n /**\n * @dev Claims distribution for the caller from a specific event.\n * @param _event Address of the event.\n * @return bool Indicates if the operation was successful.\n */\n function claimDistribution(address _event) external returns (bool) {\n // Check if the event is active\n if (events[_event].vestingAddress == address(0)) revert NotActive();\n // Access vesting contract and claim distribution\n IDCBVesting vesting = IDCBVesting(events[_event].vestingAddress);\n // Emit event\n emit DistributionClaimed(msg.sender, _event);\n // Execute claim distribution function\n return vesting.claimDistribution(msg.sender);\n }\n\n /**\n * @dev Gets investment information for a user in a specific event.\n * @param _account Address of the user.\n * @param _event Address of the event.\n * @return Event event struct.\n * @return amount Investment amount.\n * @return v Vesting information.\n * @return w Whitelist information.\n * @return claimable Amount claimable by the user.\n */\n function getInvestmentInfo(\n address _account,\n address _event\n )\n external\n view\n returns (\n Event memory,\n uint256 amount,\n IDCBVesting.VestingInfo memory v,\n IDCBVesting.WhitelistInfo memory w,\n uint256 claimable\n )\n {\n // Get vesting information for the user\n (v, w, claimable) = getVestingInfo(_account, _event);\n // Return investment information\n return (events[_event], userAmount[_event][_account], v, w, claimable);\n }\n\n /**\n * @dev Gets vesting information for a user in a specific event.\n * @param _account Address of the user.\n * @param _event Address of the event.\n * @return info Vesting information.\n * @return whitelist Whitelist information.\n * @return claimable Amount claimable by the user.\n */\n function getVestingInfo(\n address _account,\n address _event\n )\n public\n view\n returns (IDCBVesting.VestingInfo memory info, IDCBVesting.WhitelistInfo memory whitelist, uint256 claimable)\n {\n // Access vesting contract and retrieve vesting information\n IDCBVesting vesting = IDCBVesting(events[_event].vestingAddress);\n info = vesting.getVestingInfo();\n whitelist = vesting.getWhitelist(_account);\n // Get claimable amount for the user\n claimable = vesting.getReleasableAmount(_account);\n }\n\n /**\n * @dev Gets the list of user investments.\n * @param _address Address of the user.\n * @return address[] List of event addresses the user invested in.\n */\n function getUserInvestments(address _address) external view returns (address[] memory) {\n // Initialize array to store user investments\n address[] memory addresses = new address[](numUserInvestments[_address]);\n uint256 idx = 0;\n\n // Loop through events and populate user investments array\n for (uint256 i = 0; i < eventsList.length; i++) {\n if (userAmount[eventsList[i]][_address] != 0) {\n addresses[idx] = eventsList[i];\n idx++;\n }\n }\n\n return addresses;\n }\n\n uint256[49] private __gap;\n}\n" }, "src/interfaces/IDCBIDO.sol": { "content": "// SPDX-License-Identifier: MIT\n\n//** DCB IDO Interface */\n//** Author: Aceson & Aaron 2023.3 */\n\nimport { IERC20 } from \"openzeppelin-contracts/contracts/token/ERC20/IERC20.sol\";\n\npragma solidity 0.8.25;\n\ninterface IDCBIDO {\n struct Params {\n uint32 startDate;\n address factoryAddr;\n address vestingAddr;\n address paymentToken;\n address saleTokenAddr;\n uint256 totalTokenOnSale;\n uint256 hardcap;\n uint32[3] durations;\n }\n\n struct AgreementInfo {\n IERC20 token;\n uint32 startDate;\n uint32 endDate;\n uint256 totalTokenOnSale;\n uint256 hardcap;\n uint256 totalInvestFund;\n }\n\n event CreateAgreement(Params);\n event EditAgreement(Params p);\n event NewInvestment(address wallet, uint256 amount);\n\n error NotManager();\n error InvalidInput();\n error InvalidDuration();\n error InvalidProof();\n error IDONotOpen();\n error TokenNotRecived();\n error HardcapAchieved();\n error AmountExceedsAllocation();\n error InvalidTokensReceived();\n error MerkleRootAlreadySet();\n error MerkleRootNotSet();\n\n function initialize(Params memory p) external;\n function setParams(Params calldata p) external;\n function setToken(address _token) external;\n function fundAgreement(\n uint256 _investFund,\n uint256 allocation,\n uint256 refundFee,\n bytes32[] calldata merkleProof\n )\n external\n returns (bool);\n function getInfo()\n external\n view\n returns (\n uint256 hardcap,\n uint256 startDate,\n uint256 endDate,\n uint256 totalInvestFund,\n uint256 totalParticipants\n );\n function getParticipants() external view returns (address[] memory);\n}\n" }, "src/interfaces/IDCBL2E.sol": { "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.25;\n\n/* solhint-disable */\n\ninterface IDCBL2E {\n struct Params {\n uint32 endDate;\n address rewardTokenAddr;\n address vestingAddr;\n uint256 distAmount;\n }\n\n struct ClaimInfo {\n uint32 createDate; //Created date\n uint32 endDate; //Event end date\n uint256 distAmount; //Total distributed amount\n }\n\n error OnlyManager();\n error InvalidParams();\n error OnlyFactory();\n error AlreadyClaimed();\n error NotEnded();\n error InvalidMerkleProof();\n error MerkleRootAlreadySet();\n error MerkleRootNotSet();\n\n event CreateL2E(Params p);\n event UserRegistered(address user);\n event UserNotRegistered(address user);\n event UserClaimed(address user, uint256 amount);\n\n function claimInfo() external view returns (uint32 createDate, uint32 endDate, uint256 distAmount);\n\n function claimTokens(uint256 amount, bytes32[] calldata merkleProof) external returns (bool);\n\n function getParticipants() external view returns (address[] memory);\n\n function initialize(Params memory p) external;\n\n function setParams(Params calldata p) external;\n}\n" }, "src/interfaces/IDCBReference.sol": { "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.25;\n\ninterface IDCBReference {\n function getIdoImpl() external view returns (address);\n\n function getL2eImpl() external view returns (address);\n\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n function getVestingImpl() external view returns (address);\n\n function setContract(address _idoImpl, address _l2eImpl, address _vestingImpl) external;\n}\n" }, "src/interfaces/IDCBVesting.sol": { "content": "// SPDX-License-Identifier: MIT\n\n//** DCB Vesting Interface */\n\npragma solidity 0.8.25;\n\ninterface IDCBVesting {\n struct VestingInfo {\n uint256 cliff;\n uint256 start;\n uint256 duration;\n uint256 initialUnlockPercent;\n }\n\n struct VestingPool {\n uint256 cliff;\n uint256 start;\n uint256 duration;\n uint256 initialUnlockPercent;\n WhitelistInfo[] whitelistPool;\n mapping(address => HasWhitelist) hasWhitelist;\n }\n\n /**\n *\n * @dev WhiteInfo is the struct type which store whitelist information\n *\n */\n struct WhitelistInfo {\n bool refunded;\n address wallet;\n uint256 amount;\n uint256 distributedAmount;\n uint256 value; // price * amount in decimals of payment token\n uint256 refundFee;\n uint256 refundDate;\n }\n\n struct HasWhitelist {\n uint256 arrIdx;\n bool active;\n }\n\n struct ContractSetup {\n address _innovator;\n address _vestedToken;\n address _paymentToken;\n uint256 _totalTokenOnSale;\n uint256 _gracePeriod;\n }\n\n struct VestingSetup {\n uint256 _startTime;\n uint256 _cliff;\n uint256 _duration;\n uint256 _initialUnlockPercent;\n }\n\n error OnlyInnovator();\n error OnlyFactory();\n error UserNotInWhitelist();\n error InvalidParams();\n error VestingAlreadyStarted();\n error AlreadyVested();\n error AlreadyRefunded();\n error AlreadyClaimed();\n error NotInGracePeriod();\n error IDOStillInProgress();\n error GracePeriodInProgress();\n error ZeroAmount();\n error AlreadyRegistered();\n error FundsNotClaimed();\n\n event IDOInitialized(ContractSetup c, VestingSetup p);\n event IDOSet(ContractSetup c);\n event L2EInitialized(address _token, VestingSetup p);\n event RaisedFundsClaimed(uint256 payment, uint256 remaining);\n event BuybackAndBurn(uint256 amount);\n event SetVestingParams(uint256 _cliff, uint256 _start, uint256 _duration, uint256 _initialUnlockPercent);\n event Claim(address indexed token, uint256 amount, uint256 time);\n event SetWhitelist(address indexed wallet, uint256 amount, uint256 value);\n event Refund(address indexed wallet, uint256 amount);\n\n function initializeIDO(ContractSetup memory c, VestingSetup memory p) external;\n\n function initializeL2E(address _token, VestingSetup memory p) external;\n\n function setIDOWhitelist(address _wallet, uint256 _amount, uint256 _value, uint256 _refundFee) external;\n\n function setL2EWhitelist(address _wallet, uint256 _amount) external;\n\n function claimDistribution(address _wallet) external returns (bool);\n\n function getWhitelist(address _wallet) external view returns (WhitelistInfo memory);\n\n function getWhitelistPool() external view returns (WhitelistInfo[] memory);\n\n function transferOwnership(address _newOwner) external;\n\n function setVestingParams(\n uint256 _cliff,\n uint256 _start,\n uint256 _duration,\n uint256 _initialUnlockPercent\n )\n external;\n\n function setIDOParams(ContractSetup calldata c) external;\n\n function setToken(address _newToken) external;\n\n function rescueTokens(address _receiver, uint256 _amount) external;\n\n /**\n *\n * inherit functions will be used in contract\n *\n */\n function getVestAmount(address _wallet) external view returns (uint256);\n\n function getReleasableAmount(address _wallet) external view returns (uint256);\n\n function getVestingInfo() external view returns (VestingInfo memory);\n}\n" } }, "settings": { "metadata": { "bytecodeHash": "none" }, "optimizer": { "enabled": true, "runs": 10000 }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} } }}
1
20,290,600
573c2a524177e628b38d60323dd2ce65b947f83664a6ab1f7b7d862d5153904c
f52998f467aaacb2205938f2bad6d793560ead878703fe753c534afb15f0f32d
b7af86d7b49ca0c618288723ea95c932e4fb4451
b7af86d7b49ca0c618288723ea95c932e4fb4451
8fe02416b79489443a34b200a29938297730d80f
608060405234801561001057600080fd5b5060405161043838038061043883398101604081905261002f91610165565b806001600160a01b03811661005f57604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b61006881610079565b50610072826100c9565b5050610198565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b806001600160a01b03163b6000036100ff5760405163211eb15960e21b81526001600160a01b0382166004820152602401610056565b600180546001600160a01b0319166001600160a01b0383169081179091556040517fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b80516001600160a01b038116811461016057600080fd5b919050565b6000806040838503121561017857600080fd5b61018183610149565b915061018f60208401610149565b90509250929050565b610291806101a76000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80633659cfe61461005c5780635c60da1b14610071578063715018a61461009a5780638da5cb5b146100a2578063f2fde38b146100b3575b600080fd5b61006f61006a36600461022b565b6100c6565b005b6001546001600160a01b03165b6040516001600160a01b03909116815260200160405180910390f35b61006f6100da565b6000546001600160a01b031661007e565b61006f6100c136600461022b565b6100ee565b6100ce61012e565b6100d78161015b565b50565b6100e261012e565b6100ec60006101db565b565b6100f661012e565b6001600160a01b03811661012557604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b6100d7816101db565b6000546001600160a01b031633146100ec5760405163118cdaa760e01b815233600482015260240161011c565b806001600160a01b03163b6000036101915760405163211eb15960e21b81526001600160a01b038216600482015260240161011c565b600180546001600160a01b0319166001600160a01b0383169081179091556040517fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020828403121561023d57600080fd5b81356001600160a01b038116811461025457600080fd5b939250505056fea26469706673582212209bd2bbba6f4186c5eae1a792ac249ef610047efefe523ec98882d4161ec8722a64736f6c6343000814003300000000000000000000000024d1c13ccdb6ffc69dbbb63ef55638ad902b4ab5000000000000000000000000b7af86d7b49ca0c618288723ea95c932e4fb4451
608060405234801561001057600080fd5b50600436106100575760003560e01c80633659cfe61461005c5780635c60da1b14610071578063715018a61461009a5780638da5cb5b146100a2578063f2fde38b146100b3575b600080fd5b61006f61006a36600461022b565b6100c6565b005b6001546001600160a01b03165b6040516001600160a01b03909116815260200160405180910390f35b61006f6100da565b6000546001600160a01b031661007e565b61006f6100c136600461022b565b6100ee565b6100ce61012e565b6100d78161015b565b50565b6100e261012e565b6100ec60006101db565b565b6100f661012e565b6001600160a01b03811661012557604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b6100d7816101db565b6000546001600160a01b031633146100ec5760405163118cdaa760e01b815233600482015260240161011c565b806001600160a01b03163b6000036101915760405163211eb15960e21b81526001600160a01b038216600482015260240161011c565b600180546001600160a01b0319166001600160a01b0383169081179091556040517fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020828403121561023d57600080fd5b81356001600160a01b038116811461025457600080fd5b939250505056fea26469706673582212209bd2bbba6f4186c5eae1a792ac249ef610047efefe523ec98882d4161ec8722a64736f6c63430008140033
{{ "language": "Solidity", "sources": { "@openzeppelin/contracts/access/Ownable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)\n\npragma solidity ^0.8.20;\n\nimport {Context} from \"../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 * The initial owner is set to the address provided by the deployer. This can\n * 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 /**\n * @dev The caller account is not authorized to perform an operation.\n */\n error OwnableUnauthorizedAccount(address account);\n\n /**\n * @dev The owner is not a valid owner account. (eg. `address(0)`)\n */\n error OwnableInvalidOwner(address owner);\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the address provided by the deployer as the initial owner.\n */\n constructor(address initialOwner) {\n if (initialOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n _transferOwnership(initialOwner);\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 if (owner() != _msgSender()) {\n revert OwnableUnauthorizedAccount(_msgSender());\n }\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling 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 if (newOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\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/IERC1967.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC1967.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.\n */\ninterface IERC1967 {\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Emitted when the beacon is changed.\n */\n event BeaconUpgraded(address indexed beacon);\n}\n" }, "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/BeaconProxy.sol)\n\npragma solidity ^0.8.20;\n\nimport {IBeacon} from \"./IBeacon.sol\";\nimport {Proxy} from \"../Proxy.sol\";\nimport {ERC1967Utils} from \"../ERC1967/ERC1967Utils.sol\";\n\n/**\n * @dev This contract implements a proxy that gets the implementation address for each call from an {UpgradeableBeacon}.\n *\n * The beacon address can only be set once during construction, and cannot be changed afterwards. It is stored in an\n * immutable variable to avoid unnecessary storage reads, and also in the beacon storage slot specified by\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] so that it can be accessed externally.\n *\n * CAUTION: Since the beacon address can never be changed, you must ensure that you either control the beacon, or trust\n * the beacon to not upgrade the implementation maliciously.\n *\n * IMPORTANT: Do not use the implementation logic to modify the beacon storage slot. Doing so would leave the proxy in\n * an inconsistent state where the beacon storage slot does not match the beacon address.\n */\ncontract BeaconProxy is Proxy {\n // An immutable address for the beacon to avoid unnecessary SLOADs before each delegate call.\n address private immutable _beacon;\n\n /**\n * @dev Initializes the proxy with `beacon`.\n *\n * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. This\n * will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity\n * constructor.\n *\n * Requirements:\n *\n * - `beacon` must be a contract with the interface {IBeacon}.\n * - If `data` is empty, `msg.value` must be zero.\n */\n constructor(address beacon, bytes memory data) payable {\n ERC1967Utils.upgradeBeaconToAndCall(beacon, data);\n _beacon = beacon;\n }\n\n /**\n * @dev Returns the current implementation address of the associated beacon.\n */\n function _implementation() internal view virtual override returns (address) {\n return IBeacon(_getBeacon()).implementation();\n }\n\n /**\n * @dev Returns the beacon.\n */\n function _getBeacon() internal view virtual returns (address) {\n return _beacon;\n }\n}\n" }, "@openzeppelin/contracts/proxy/beacon/IBeacon.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.20;\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 * {UpgradeableBeacon} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" }, "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/UpgradeableBeacon.sol)\n\npragma solidity ^0.8.20;\n\nimport {IBeacon} from \"./IBeacon.sol\";\nimport {Ownable} from \"../../access/Ownable.sol\";\n\n/**\n * @dev This contract is used in conjunction with one or more instances of {BeaconProxy} to determine their\n * implementation contract, which is where they will delegate all function calls.\n *\n * An owner is able to change the implementation the beacon points to, thus upgrading the proxies that use this beacon.\n */\ncontract UpgradeableBeacon is IBeacon, Ownable {\n address private _implementation;\n\n /**\n * @dev The `implementation` of the beacon is invalid.\n */\n error BeaconInvalidImplementation(address implementation);\n\n /**\n * @dev Emitted when the implementation returned by the beacon is changed.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Sets the address of the initial implementation, and the initial owner who can upgrade the beacon.\n */\n constructor(address implementation_, address initialOwner) Ownable(initialOwner) {\n _setImplementation(implementation_);\n }\n\n /**\n * @dev Returns the current implementation address.\n */\n function implementation() public view virtual returns (address) {\n return _implementation;\n }\n\n /**\n * @dev Upgrades the beacon to a new implementation.\n *\n * Emits an {Upgraded} event.\n *\n * Requirements:\n *\n * - msg.sender must be the owner of the contract.\n * - `newImplementation` must be a contract.\n */\n function upgradeTo(address newImplementation) public virtual onlyOwner {\n _setImplementation(newImplementation);\n }\n\n /**\n * @dev Sets the implementation contract address for this beacon\n *\n * Requirements:\n *\n * - `newImplementation` must be a contract.\n */\n function _setImplementation(address newImplementation) private {\n if (newImplementation.code.length == 0) {\n revert BeaconInvalidImplementation(newImplementation);\n }\n _implementation = newImplementation;\n emit Upgraded(newImplementation);\n }\n}\n" }, "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/ERC1967/ERC1967Proxy.sol)\n\npragma solidity ^0.8.20;\n\nimport {Proxy} from \"../Proxy.sol\";\nimport {ERC1967Utils} from \"./ERC1967Utils.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 {\n /**\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `implementation`.\n *\n * If `_data` is nonempty, it's used as data in a delegate call to `implementation`. This will typically be an\n * encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.\n *\n * Requirements:\n *\n * - If `data` is empty, `msg.value` must be zero.\n */\n constructor(address implementation, bytes memory _data) payable {\n ERC1967Utils.upgradeToAndCall(implementation, _data);\n }\n\n /**\n * @dev Returns the current implementation address.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using\n * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\n */\n function _implementation() internal view virtual override returns (address) {\n return ERC1967Utils.getImplementation();\n }\n}\n" }, "@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/ERC1967/ERC1967Utils.sol)\n\npragma solidity ^0.8.20;\n\nimport {IBeacon} from \"../beacon/IBeacon.sol\";\nimport {Address} from \"../../utils/Address.sol\";\nimport {StorageSlot} from \"../../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 */\nlibrary ERC1967Utils {\n // We re-declare ERC-1967 events here because they can't be used directly from IERC1967.\n // This will be fixed in Solidity 0.8.21. At that point we should remove these events.\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Emitted when the beacon is changed.\n */\n event BeaconUpgraded(address indexed beacon);\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.\n */\n // solhint-disable-next-line private-vars-leading-underscore\n bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev The `implementation` of the proxy is invalid.\n */\n error ERC1967InvalidImplementation(address implementation);\n\n /**\n * @dev The `admin` of the proxy is invalid.\n */\n error ERC1967InvalidAdmin(address admin);\n\n /**\n * @dev The `beacon` of the proxy is invalid.\n */\n error ERC1967InvalidBeacon(address beacon);\n\n /**\n * @dev An upgrade function sees `msg.value > 0` that may be lost.\n */\n error ERC1967NonPayable();\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 if (newImplementation.code.length == 0) {\n revert ERC1967InvalidImplementation(newImplementation);\n }\n StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Performs implementation upgrade with additional setup call if data is nonempty.\n * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected\n * to avoid stuck value in the contract.\n *\n * Emits an {IERC1967-Upgraded} event.\n */\n function upgradeToAndCall(address newImplementation, bytes memory data) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n\n if (data.length > 0) {\n Address.functionDelegateCall(newImplementation, data);\n } else {\n _checkNonPayable();\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.\n */\n // solhint-disable-next-line private-vars-leading-underscore\n bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Returns the current admin.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using\n * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\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 if (newAdmin == address(0)) {\n revert ERC1967InvalidAdmin(address(0));\n }\n StorageSlot.getAddressSlot(ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {IERC1967-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 the keccak-256 hash of \"eip1967.proxy.beacon\" subtracted by 1.\n */\n // solhint-disable-next-line private-vars-leading-underscore\n bytes32 internal constant BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\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 if (newBeacon.code.length == 0) {\n revert ERC1967InvalidBeacon(newBeacon);\n }\n\n StorageSlot.getAddressSlot(BEACON_SLOT).value = newBeacon;\n\n address beaconImplementation = IBeacon(newBeacon).implementation();\n if (beaconImplementation.code.length == 0) {\n revert ERC1967InvalidImplementation(beaconImplementation);\n }\n }\n\n /**\n * @dev Change the beacon and trigger a setup call if data is nonempty.\n * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected\n * to avoid stuck value in the contract.\n *\n * Emits an {IERC1967-BeaconUpgraded} event.\n *\n * CAUTION: Invoking this function has no effect on an instance of {BeaconProxy} since v5, since\n * it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for\n * efficiency.\n */\n function upgradeBeaconToAndCall(address newBeacon, bytes memory data) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n\n if (data.length > 0) {\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\n } else {\n _checkNonPayable();\n }\n }\n\n /**\n * @dev Reverts if `msg.value` is not zero. It can be used to avoid `msg.value` stuck in the contract\n * if an upgrade doesn't perform an initialization call.\n */\n function _checkNonPayable() private {\n if (msg.value > 0) {\n revert ERC1967NonPayable();\n }\n }\n}\n" }, "@openzeppelin/contracts/proxy/Proxy.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.20;\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\n * function 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 _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" }, "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/transparent/ProxyAdmin.sol)\n\npragma solidity ^0.8.20;\n\nimport {ITransparentUpgradeableProxy} from \"./TransparentUpgradeableProxy.sol\";\nimport {Ownable} from \"../../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 */\ncontract ProxyAdmin is Ownable {\n /**\n * @dev The version of the upgrade interface of the contract. If this getter is missing, both `upgrade(address)`\n * and `upgradeAndCall(address,bytes)` are present, and `upgradeTo` must be used if no function should be called,\n * while `upgradeAndCall` will invoke the `receive` function if the second argument is the empty byte string.\n * If the getter returns `\"5.0.0\"`, only `upgradeAndCall(address,bytes)` is present, and the second argument must\n * be the empty byte string if no function should be called, making it impossible to invoke the `receive` function\n * during an upgrade.\n */\n string public constant UPGRADE_INTERFACE_VERSION = \"5.0.0\";\n\n /**\n * @dev Sets the initial owner who can perform upgrades.\n */\n constructor(address initialOwner) Ownable(initialOwner) {}\n\n /**\n * @dev Upgrades `proxy` to `implementation` and calls a function on the new implementation.\n * See {TransparentUpgradeableProxy-_dispatchUpgradeToAndCall}.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n * - If `data` is empty, `msg.value` must be zero.\n */\n function upgradeAndCall(\n ITransparentUpgradeableProxy proxy,\n address implementation,\n bytes memory data\n ) public payable virtual onlyOwner {\n proxy.upgradeToAndCall{value: msg.value}(implementation, data);\n }\n}\n" }, "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/transparent/TransparentUpgradeableProxy.sol)\n\npragma solidity ^0.8.20;\n\nimport {ERC1967Utils} from \"../ERC1967/ERC1967Utils.sol\";\nimport {ERC1967Proxy} from \"../ERC1967/ERC1967Proxy.sol\";\nimport {IERC1967} from \"../../interfaces/IERC1967.sol\";\nimport {ProxyAdmin} from \"./ProxyAdmin.sol\";\n\n/**\n * @dev Interface for {TransparentUpgradeableProxy}. In order to implement transparency, {TransparentUpgradeableProxy}\n * does not implement this interface directly, and its upgradeability mechanism is implemented by an internal dispatch\n * mechanism. The compiler is unaware that these functions are implemented by {TransparentUpgradeableProxy} and will not\n * include them in the ABI so this interface must be used to interact with it.\n */\ninterface ITransparentUpgradeableProxy is IERC1967 {\n function upgradeToAndCall(address, bytes calldata) external payable;\n}\n\n/**\n * @dev This contract implements a proxy that is upgradeable through an associated {ProxyAdmin} instance.\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 the {ITransparentUpgradeableProxy-upgradeToAndCall} function exposed by the proxy itself.\n * 2. If the admin calls the proxy, it can call the `upgradeToAndCall` function but any other call won't be forwarded to\n * the implementation. If the admin tries to call a function on the implementation it will fail with an error indicating\n * the proxy admin cannot fallback to the target implementation.\n *\n * These properties mean that the admin account can only be used for upgrading the proxy, so it's best if it's a\n * dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to\n * call a function from the proxy implementation. For this reason, the proxy deploys an instance of {ProxyAdmin} and\n * allows upgrades only if they come through it. You should think of the `ProxyAdmin` instance as the administrative\n * interface of the proxy, including the ability to change who can trigger upgrades by transferring ownership.\n *\n * NOTE: The real interface of this proxy is that defined in `ITransparentUpgradeableProxy`. This contract does not\n * inherit from that interface, and instead `upgradeToAndCall` is implicitly implemented using a custom dispatch\n * mechanism in `_fallback`. Consequently, the compiler will not produce an ABI for this contract. This is necessary to\n * fully implement transparency without decoding reverts caused by selector clashes between the proxy and the\n * implementation.\n *\n * NOTE: This proxy does not inherit from {Context} deliberately. The {ProxyAdmin} of this contract won't send a\n * meta-transaction in any way, and any other meta-transaction setup should be made in the implementation contract.\n *\n * IMPORTANT: This contract avoids unnecessary storage reads by setting the admin only during construction as an\n * immutable variable, preventing any changes thereafter. However, the admin slot defined in ERC-1967 can still be\n * overwritten by the implementation logic pointed to by this proxy. In such cases, the contract may end up in an\n * undesirable state where the admin slot is different from the actual admin.\n *\n * WARNING: It is not recommended to extend this contract to add additional external functions. If you do so, the\n * compiler will not check that there are no selector conflicts, due to the note above. A selector clash between any new\n * function and the functions declared in {ITransparentUpgradeableProxy} will be resolved in favor of the new one. This\n * could render the `upgradeToAndCall` function inaccessible, preventing upgradeability and compromising transparency.\n */\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\n // An immutable address for the admin to avoid unnecessary SLOADs before each call\n // at the expense of removing the ability to change the admin once it's set.\n // This is acceptable if the admin is always a ProxyAdmin instance or similar contract\n // with its own ability to transfer the permissions to another account.\n address private immutable _admin;\n\n /**\n * @dev The proxy caller is the current admin, and can't fallback to the proxy target.\n */\n error ProxyDeniedAdminAccess();\n\n /**\n * @dev Initializes an upgradeable proxy managed by an instance of a {ProxyAdmin} with an `initialOwner`,\n * backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in\n * {ERC1967Proxy-constructor}.\n */\n constructor(address _logic, address initialOwner, bytes memory _data) payable ERC1967Proxy(_logic, _data) {\n _admin = address(new ProxyAdmin(initialOwner));\n // Set the storage value and emit an event for ERC-1967 compatibility\n ERC1967Utils.changeAdmin(_proxyAdmin());\n }\n\n /**\n * @dev Returns the admin of this proxy.\n */\n function _proxyAdmin() internal virtual returns (address) {\n return _admin;\n }\n\n /**\n * @dev If caller is the admin process the call internally, otherwise transparently fallback to the proxy behavior.\n */\n function _fallback() internal virtual override {\n if (msg.sender == _proxyAdmin()) {\n if (msg.sig != ITransparentUpgradeableProxy.upgradeToAndCall.selector) {\n revert ProxyDeniedAdminAccess();\n } else {\n _dispatchUpgradeToAndCall();\n }\n } else {\n super._fallback();\n }\n }\n\n /**\n * @dev Upgrade the implementation of the proxy. See {ERC1967Utils-upgradeToAndCall}.\n *\n * Requirements:\n *\n * - If `data` is empty, `msg.value` must be zero.\n */\n function _dispatchUpgradeToAndCall() private {\n (address newImplementation, bytes memory data) = abi.decode(msg.data[4:], (address, bytes));\n ERC1967Utils.upgradeToAndCall(newImplementation, data);\n }\n}\n" }, "@openzeppelin/contracts/utils/Address.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\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://consensys.net/diligence/blog/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.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance < amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\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 or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\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 function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\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 function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance < value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 && target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) 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 FailedInnerCall();\n }\n }\n}\n" }, "@openzeppelin/contracts/utils/Context.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\npragma solidity ^0.8.20;\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 function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n" }, "@openzeppelin/contracts/utils/StorageSlot.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\n\npragma solidity ^0.8.20;\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 * ```solidity\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(newImplementation.code.length > 0);\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\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 struct StringSlot {\n string value;\n }\n\n struct BytesSlot {\n bytes 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 /**\n * @dev Returns an `StringSlot` with member `value` located at `slot`.\n */\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\n */\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` with member `value` located at `slot`.\n */\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\n */\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n}\n" } }, "settings": { "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris" } }}
1
20,290,601
2673dcc4a6678d8461eb529c4eb19b9634c8917b77ac98cf05fbf30675fa8565
085656ef1c92d59b3932043cd8bb70bf27cfb2a759540e91a45b57809b8923f7
b7af86d7b49ca0c618288723ea95c932e4fb4451
b7af86d7b49ca0c618288723ea95c932e4fb4451
761487963e73e37f46c78ee4a8e59276ee73d493
6080604052348015600f57600080fd5b506016601a565b60d8565b600054610100900460ff161560855760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff908116101560d6576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b611b6e806100e76000396000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c80638da5cb5b116100d8578063ccca123b1161008c578063f301af4211610066578063f301af421461037b578063f6a413cc1461039c578063fc0c546a146103a457600080fd5b8063ccca123b1461034c578063da35a26f14610355578063f2fde38b1461036857600080fd5b8063b4258b0d116100bd578063b4258b0d1461031e578063b88a802f14610331578063b9209e331461033957600080fd5b80638da5cb5b1461027f578063a87430ba1461029d57600080fd5b806341a0894d1161012f5780634a95d9d5116101145780634a95d9d51461021d5780635a2e2f4714610262578063715018a61461027557600080fd5b806341a0894d146101ea578063421b2d8b1461020a57600080fd5b80632c4a6923116101605780632c4a6923146101bb57806339fffeb0146101ce578063405bf048146101d757600080fd5b806302c2e0b41461017c5780631072cbea14610198575b600080fd5b610185606d5481565b6040519081526020015b60405180910390f35b6101ab6101a63660046117bb565b6103c4565b604051901515815260200161018f565b6101ab6101c93660046117e5565b61041b565b610185606c5481565b6101ab6101e536600461185a565b61046f565b6101fd6101f836600461188d565b6106c7565b60405161018f91906118a8565b6101ab61021836600461188d565b61075a565b60695461023d9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161018f565b6101ab61027036600461188d565b6107cc565b61027d610820565b005b60335473ffffffffffffffffffffffffffffffffffffffff1661023d565b6102e96102ab36600461188d565b606a602052600090815260409020805460028201546003830154600490930154919273ffffffffffffffffffffffffffffffffffffffff9091169184565b6040805194855273ffffffffffffffffffffffffffffffffffffffff909316602085015291830152606082015260800161018f565b6101ab61032c366004611902565b610834565b61027d610ac6565b6101ab61034736600461188d565b610bad565b61018560655481565b61027d61036336600461193e565b610bba565b61027d61037636600461188d565b610d98565b61038e610389366004611961565b610e4c565b60405161018f9291906119e8565b6101fd610f08565b60685461023d9073ffffffffffffffffffffffffffffffffffffffff1681565b60006103ce610f19565b8261040f6103f160335473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff83169085610f9a565b60019150505b92915050565b6000610425610f19565b8160005b818110156104645761045b85858381811061044657610446611a0a565b9050602002016020810190610218919061188d565b50600101610429565b506001949350505050565b60655473ffffffffffffffffffffffffffffffffffffffff83166000908152606a6020526040812054909184916104a69190611a68565b4210156104df576040517f24d4f6fb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff85161480159061051d575060335473ffffffffffffffffffffffffffffffffffffffff163314155b15610554576040517f9d7b369d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61055f606684611027565b15610596576040517fc344397e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6105a1606685611059565b506105ad60668461107b565b5073ffffffffffffffffffffffffffffffffffffffff8085166000908152606a60205260408082209286168252902081548155600180830180546105f49284019190611718565b5060028281015490820180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9283161790556003808401549083015560049283015492909101919091558381166000908152606a60205260408082204290559186168152908120818155906106836001830182611768565b506002810180547fffffffffffffffffffffffff00000000000000000000000000000000000000001690556000600382018190556004909101555060019392505050565b73ffffffffffffffffffffffffffffffffffffffff81166000908152606a602090815260409182902060010180548351818402810184019094528084526060939283018282801561074e57602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610723575b50505050509050919050565b6000610764610f19565b600061077160668461107b565b73ffffffffffffffffffffffffffffffffffffffff84166000818152606a60205260408082204290555192935090917f19ef9a4877199f89440a26acb26895ec02ed86f2df1aeaa90dc18041b892f71f9190a290505b919050565b60006107d6610f19565b506068805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff00000000000000000000000000000000000000009091161790556001919050565b610828610f19565b610832600061109d565b565b600061083e610f19565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152606a602052604090206002015416156108a0576040517f7aabdfe300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603610905576040517f17904cbb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610910606685611027565b15806109245750610922606684611027565b155b1561095b576040517fa95362b500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8085166000818152606a60209081526040808320600180820180549182018155855292842090920180549589167fffffffffffffffffffffffff000000000000000000000000000000000000000096871681179091558352822060020180549094168317909355908152600490910180548492906109ef908490611a68565b909155505073ffffffffffffffffffffffffffffffffffffffff83166000908152606a602052604081206003018054849290610a2c908490611a68565b9091555050606854610a559073ffffffffffffffffffffffffffffffffffffffff168484610f9a565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f90eab5d1df713df401d810f26aa9718d2b9e6894af1eb4890a332d3b185dc0e584604051610ab491815260200190565b60405180910390a35060019392505050565b610ad1606633611027565b610b07576040517fa95362b500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336000908152606a60205260408120600401549003610b52576040517f969bf72800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336000908152606a60205260408120600481018054908390556003909101805491928392610b81908490611a68565b9091555050606854610baa9073ffffffffffffffffffffffffffffffffffffffff163383610f9a565b50565b6000610415606683611027565b600054610100900460ff1615808015610bda5750600054600160ff909116105b80610bf45750303b158015610bf4575060005460ff166001145b610c85576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558015610ce357600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b610ceb611114565b6065839055606880547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161790558015610d9357600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b610da0610f19565b73ffffffffffffffffffffffffffffffffffffffff8116610e43576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610c7c565b610baa8161109d565b606b8181548110610e5c57600080fd5b9060005260206000209060020201600091509050806000018054610e7f90611a7b565b80601f0160208091040260200160405190810160405280929190818152602001828054610eab90611a7b565b8015610ef85780601f10610ecd57610100808354040283529160200191610ef8565b820191906000526020600020905b815481529060010190602001808311610edb57829003601f168201915b5050505050908060010154905082565b6060610f1460666111b3565b905090565b60335473ffffffffffffffffffffffffffffffffffffffff163314610832576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610c7c565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610d939084906111c0565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260018301602052604081205415155b9392505050565b60006110528373ffffffffffffffffffffffffffffffffffffffff84166112cc565b60006110528373ffffffffffffffffffffffffffffffffffffffff84166113bf565b6033805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166111ab576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610c7c565b61083261140e565b60606000611052836114ae565b6000611222826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166115099092919063ffffffff16565b805190915015610d9357808060200190518101906112409190611ace565b610d93576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610c7c565b600081815260018301602052604081205480156113b55760006112f0600183611af0565b855490915060009061130490600190611af0565b905081811461136957600086600001828154811061132457611324611a0a565b906000526020600020015490508087600001848154811061134757611347611a0a565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061137a5761137a611b03565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610415565b6000915050610415565b600081815260018301602052604081205461140657508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610415565b506000610415565b600054610100900460ff166114a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610c7c565b6108323361109d565b60608160000180548060200260200160405190810160405280929190818152602001828054801561074e57602002820191906000526020600020905b8154815260200190600101908083116114ea5750505050509050919050565b60606115188484600085611520565b949350505050565b6060824710156115b2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610c7c565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516115db9190611b32565b60006040518083038185875af1925050503d8060008114611618576040519150601f19603f3d011682016040523d82523d6000602084013e61161d565b606091505b509150915061162e87838387611639565b979650505050505050565b606083156116cf5782516000036116c85773ffffffffffffffffffffffffffffffffffffffff85163b6116c8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610c7c565b5081611518565b61151883838151156116e45781518083602001fd5b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c7c9190611b4e565b8280548282559060005260206000209081019282156117585760005260206000209182015b8281111561175857825482559160010191906001019061173d565b50611764929150611782565b5090565b5080546000825590600052602060002090810190610baa91905b5b808211156117645760008155600101611783565b803573ffffffffffffffffffffffffffffffffffffffff811681146107c757600080fd5b600080604083850312156117ce57600080fd5b6117d783611797565b946020939093013593505050565b600080602083850312156117f857600080fd5b823567ffffffffffffffff8082111561181057600080fd5b818501915085601f83011261182457600080fd5b81358181111561183357600080fd5b8660208260051b850101111561184857600080fd5b60209290920196919550909350505050565b6000806040838503121561186d57600080fd5b61187683611797565b915061188460208401611797565b90509250929050565b60006020828403121561189f57600080fd5b61105282611797565b6020808252825182820181905260009190848201906040850190845b818110156118f657835173ffffffffffffffffffffffffffffffffffffffff16835292840192918401916001016118c4565b50909695505050505050565b60008060006060848603121561191757600080fd5b61192084611797565b925061192e60208501611797565b9150604084013590509250925092565b6000806040838503121561195157600080fd5b8235915061188460208401611797565b60006020828403121561197357600080fd5b5035919050565b60005b8381101561199557818101518382015260200161197d565b50506000910152565b600081518084526119b681602086016020860161197a565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6040815260006119fb604083018561199e565b90508260208301529392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111561041557610415611a39565b600181811c90821680611a8f57607f821691505b602082108103611ac8577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b600060208284031215611ae057600080fd5b8151801515811461105257600080fd5b8181038181111561041557610415611a39565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60008251611b4481846020870161197a565b9190910192915050565b602081526000611052602083018461199e56fea164736f6c6343000819000a
608060405234801561001057600080fd5b50600436106101775760003560e01c80638da5cb5b116100d8578063ccca123b1161008c578063f301af4211610066578063f301af421461037b578063f6a413cc1461039c578063fc0c546a146103a457600080fd5b8063ccca123b1461034c578063da35a26f14610355578063f2fde38b1461036857600080fd5b8063b4258b0d116100bd578063b4258b0d1461031e578063b88a802f14610331578063b9209e331461033957600080fd5b80638da5cb5b1461027f578063a87430ba1461029d57600080fd5b806341a0894d1161012f5780634a95d9d5116101145780634a95d9d51461021d5780635a2e2f4714610262578063715018a61461027557600080fd5b806341a0894d146101ea578063421b2d8b1461020a57600080fd5b80632c4a6923116101605780632c4a6923146101bb57806339fffeb0146101ce578063405bf048146101d757600080fd5b806302c2e0b41461017c5780631072cbea14610198575b600080fd5b610185606d5481565b6040519081526020015b60405180910390f35b6101ab6101a63660046117bb565b6103c4565b604051901515815260200161018f565b6101ab6101c93660046117e5565b61041b565b610185606c5481565b6101ab6101e536600461185a565b61046f565b6101fd6101f836600461188d565b6106c7565b60405161018f91906118a8565b6101ab61021836600461188d565b61075a565b60695461023d9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161018f565b6101ab61027036600461188d565b6107cc565b61027d610820565b005b60335473ffffffffffffffffffffffffffffffffffffffff1661023d565b6102e96102ab36600461188d565b606a602052600090815260409020805460028201546003830154600490930154919273ffffffffffffffffffffffffffffffffffffffff9091169184565b6040805194855273ffffffffffffffffffffffffffffffffffffffff909316602085015291830152606082015260800161018f565b6101ab61032c366004611902565b610834565b61027d610ac6565b6101ab61034736600461188d565b610bad565b61018560655481565b61027d61036336600461193e565b610bba565b61027d61037636600461188d565b610d98565b61038e610389366004611961565b610e4c565b60405161018f9291906119e8565b6101fd610f08565b60685461023d9073ffffffffffffffffffffffffffffffffffffffff1681565b60006103ce610f19565b8261040f6103f160335473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff83169085610f9a565b60019150505b92915050565b6000610425610f19565b8160005b818110156104645761045b85858381811061044657610446611a0a565b9050602002016020810190610218919061188d565b50600101610429565b506001949350505050565b60655473ffffffffffffffffffffffffffffffffffffffff83166000908152606a6020526040812054909184916104a69190611a68565b4210156104df576040517f24d4f6fb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff85161480159061051d575060335473ffffffffffffffffffffffffffffffffffffffff163314155b15610554576040517f9d7b369d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61055f606684611027565b15610596576040517fc344397e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6105a1606685611059565b506105ad60668461107b565b5073ffffffffffffffffffffffffffffffffffffffff8085166000908152606a60205260408082209286168252902081548155600180830180546105f49284019190611718565b5060028281015490820180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9283161790556003808401549083015560049283015492909101919091558381166000908152606a60205260408082204290559186168152908120818155906106836001830182611768565b506002810180547fffffffffffffffffffffffff00000000000000000000000000000000000000001690556000600382018190556004909101555060019392505050565b73ffffffffffffffffffffffffffffffffffffffff81166000908152606a602090815260409182902060010180548351818402810184019094528084526060939283018282801561074e57602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610723575b50505050509050919050565b6000610764610f19565b600061077160668461107b565b73ffffffffffffffffffffffffffffffffffffffff84166000818152606a60205260408082204290555192935090917f19ef9a4877199f89440a26acb26895ec02ed86f2df1aeaa90dc18041b892f71f9190a290505b919050565b60006107d6610f19565b506068805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff00000000000000000000000000000000000000009091161790556001919050565b610828610f19565b610832600061109d565b565b600061083e610f19565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152606a602052604090206002015416156108a0576040517f7aabdfe300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603610905576040517f17904cbb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610910606685611027565b15806109245750610922606684611027565b155b1561095b576040517fa95362b500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8085166000818152606a60209081526040808320600180820180549182018155855292842090920180549589167fffffffffffffffffffffffff000000000000000000000000000000000000000096871681179091558352822060020180549094168317909355908152600490910180548492906109ef908490611a68565b909155505073ffffffffffffffffffffffffffffffffffffffff83166000908152606a602052604081206003018054849290610a2c908490611a68565b9091555050606854610a559073ffffffffffffffffffffffffffffffffffffffff168484610f9a565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f90eab5d1df713df401d810f26aa9718d2b9e6894af1eb4890a332d3b185dc0e584604051610ab491815260200190565b60405180910390a35060019392505050565b610ad1606633611027565b610b07576040517fa95362b500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336000908152606a60205260408120600401549003610b52576040517f969bf72800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336000908152606a60205260408120600481018054908390556003909101805491928392610b81908490611a68565b9091555050606854610baa9073ffffffffffffffffffffffffffffffffffffffff163383610f9a565b50565b6000610415606683611027565b600054610100900460ff1615808015610bda5750600054600160ff909116105b80610bf45750303b158015610bf4575060005460ff166001145b610c85576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558015610ce357600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b610ceb611114565b6065839055606880547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161790558015610d9357600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b610da0610f19565b73ffffffffffffffffffffffffffffffffffffffff8116610e43576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610c7c565b610baa8161109d565b606b8181548110610e5c57600080fd5b9060005260206000209060020201600091509050806000018054610e7f90611a7b565b80601f0160208091040260200160405190810160405280929190818152602001828054610eab90611a7b565b8015610ef85780601f10610ecd57610100808354040283529160200191610ef8565b820191906000526020600020905b815481529060010190602001808311610edb57829003601f168201915b5050505050908060010154905082565b6060610f1460666111b3565b905090565b60335473ffffffffffffffffffffffffffffffffffffffff163314610832576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610c7c565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610d939084906111c0565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260018301602052604081205415155b9392505050565b60006110528373ffffffffffffffffffffffffffffffffffffffff84166112cc565b60006110528373ffffffffffffffffffffffffffffffffffffffff84166113bf565b6033805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166111ab576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610c7c565b61083261140e565b60606000611052836114ae565b6000611222826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166115099092919063ffffffff16565b805190915015610d9357808060200190518101906112409190611ace565b610d93576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610c7c565b600081815260018301602052604081205480156113b55760006112f0600183611af0565b855490915060009061130490600190611af0565b905081811461136957600086600001828154811061132457611324611a0a565b906000526020600020015490508087600001848154811061134757611347611a0a565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061137a5761137a611b03565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610415565b6000915050610415565b600081815260018301602052604081205461140657508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610415565b506000610415565b600054610100900460ff166114a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610c7c565b6108323361109d565b60608160000180548060200260200160405190810160405280929190818152602001828054801561074e57602002820191906000526020600020905b8154815260200190600101908083116114ea5750505050509050919050565b60606115188484600085611520565b949350505050565b6060824710156115b2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610c7c565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516115db9190611b32565b60006040518083038185875af1925050503d8060008114611618576040519150601f19603f3d011682016040523d82523d6000602084013e61161d565b606091505b509150915061162e87838387611639565b979650505050505050565b606083156116cf5782516000036116c85773ffffffffffffffffffffffffffffffffffffffff85163b6116c8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610c7c565b5081611518565b61151883838151156116e45781518083602001fd5b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c7c9190611b4e565b8280548282559060005260206000209081019282156117585760005260206000209182015b8281111561175857825482559160010191906001019061173d565b50611764929150611782565b5090565b5080546000825590600052602060002090810190610baa91905b5b808211156117645760008155600101611783565b803573ffffffffffffffffffffffffffffffffffffffff811681146107c757600080fd5b600080604083850312156117ce57600080fd5b6117d783611797565b946020939093013593505050565b600080602083850312156117f857600080fd5b823567ffffffffffffffff8082111561181057600080fd5b818501915085601f83011261182457600080fd5b81358181111561183357600080fd5b8660208260051b850101111561184857600080fd5b60209290920196919550909350505050565b6000806040838503121561186d57600080fd5b61187683611797565b915061188460208401611797565b90509250929050565b60006020828403121561189f57600080fd5b61105282611797565b6020808252825182820181905260009190848201906040850190845b818110156118f657835173ffffffffffffffffffffffffffffffffffffffff16835292840192918401916001016118c4565b50909695505050505050565b60008060006060848603121561191757600080fd5b61192084611797565b925061192e60208501611797565b9150604084013590509250925092565b6000806040838503121561195157600080fd5b8235915061188460208401611797565b60006020828403121561197357600080fd5b5035919050565b60005b8381101561199557818101518382015260200161197d565b50506000910152565b600081518084526119b681602086016020860161197a565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6040815260006119fb604083018561199e565b90508260208301529392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111561041557610415611a39565b600181811c90821680611a8f57607f821691505b602082108103611ac8577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b600060208284031215611ae057600080fd5b8151801515811461105257600080fd5b8181038181111561041557610415611a39565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60008251611b4481846020870161197a565b9190910192915050565b602081526000611052602083018461199e56fea164736f6c6343000819000a
{{ "language": "Solidity", "sources": { "openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.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/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.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 OwnableUpgradeable is Initializable, ContextUpgradeable {\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 function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\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 /**\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/contracts/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/contracts/token/ERC20/extensions/draft-IERC20PermitUpgradeable.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 IERC20PermitUpgradeable {\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-upgradeable/contracts/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/contracts/token/ERC20/utils/SafeERC20Upgradeable.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 \"../IERC20Upgradeable.sol\";\nimport \"../extensions/draft-IERC20PermitUpgradeable.sol\";\nimport \"../../../utils/AddressUpgradeable.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 SafeERC20Upgradeable {\n using AddressUpgradeable for address;\n\n function safeTransfer(\n IERC20Upgradeable 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 IERC20Upgradeable 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 IERC20Upgradeable 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 IERC20Upgradeable 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 IERC20Upgradeable 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 IERC20PermitUpgradeable 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(IERC20Upgradeable 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-upgradeable/contracts/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/contracts/utils/ContextUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\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/contracts/utils/structs/EnumerableSetUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSetUpgradeable {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastValue;\n // Update the index for the moved value\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n bytes32[] memory store = _values(set._inner);\n bytes32[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n" }, "src/DCBWalletStore.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.25;\n\nimport {\n OwnableUpgradeable,\n Initializable\n} from \"openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol\";\nimport { EnumerableSetUpgradeable } from\n \"openzeppelin-contracts-upgradeable/contracts/utils/structs/EnumerableSetUpgradeable.sol\";\nimport { IDCBTiers } from \"src/interfaces/IDCBTiers.sol\";\nimport {\n IERC20Upgradeable,\n SafeERC20Upgradeable\n} from \"openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol\";\n\n/**\n * @title DCBWalletStore\n * @dev A contract to manage user referrals and rewards in a decentralized manner.\n */\ncontract DCBWalletStore is Initializable, OwnableUpgradeable {\n // IMPORTANT!!!\n // Most of the state variables are not used anymore after the update,\n // but kept there to maintain upgradeability of the contract\n // and to avoid any potential issues with the proxy contract.\n using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet;\n using SafeERC20Upgradeable for IERC20Upgradeable;\n\n // Struct to represent a reward\n struct Reward {\n string name; // Name of the reward\n uint256 amount; // Amount of the reward\n }\n\n // Struct to represent a user\n struct User {\n uint256 lastAccessTime; // Last access time of the user\n address[] referrals; // List of referrals made by the user\n address referrer; // Referrer of the user\n uint256 totalClaimed; // Total claimed rewards by the user\n uint256 totalClaimable; // Total claimable rewards by the user\n }\n\n // Public variables\n uint256 public waitTime; // Wait time required before making changes to a user's wallet\n EnumerableSetUpgradeable.AddressSet private verifiedUsers; // Set of verified users\n IERC20Upgradeable public token; // ERC20 token contract\n IDCBTiers public tiers; // Contract defining user tiers\n mapping(address => User) public users; // Mapping of users\n\n // Array of rewards\n Reward[] public rewards;\n\n // Minimum tier requirements for referrer and referee\n uint256 public minTierForReferrer;\n uint256 public minTierForReferree;\n\n // Events\n event ReferralRegistered(address indexed referrer, address indexed referree, uint256 reward);\n event UserAdded(address indexed user);\n event UserReplaced(address indexed oldAddress, address indexed newAddress);\n\n // Modifiers\n\n /**\n * @dev Modifier to check if enough time has passed since the last wallet change.\n * @param _address Address of the user.\n */\n modifier hasWaited(address _address) {\n // Revert if not enough time has passed\n if (block.timestamp < users[_address].lastAccessTime + waitTime) revert WalletChangedRecently();\n _;\n }\n\n // Errors\n error WalletChangedRecently();\n error NoPermission();\n error UserAlreadyExists();\n error AlreadyReferred();\n error SelfRefer();\n error NotVerified();\n error NothingToClaim();\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() {\n _disableInitializers();\n }\n\n // External Functions\n\n /**\n * @dev Batch add multiple users.\n * @param _users Array of addresses of users to be added.\n * @return Boolean indicating success.\n */\n function batchAddUser(address[] calldata _users) external onlyOwner returns (bool) {\n uint256 len = _users.length;\n for (uint256 i = 0; i < len; i++) {\n addUser(_users[i]); // Add each user\n }\n return true;\n }\n\n /**\n * @dev Replace an existing user with a new address.\n * @param oldAddress Address of the user to be replaced.\n * @param newAddress Address of the new user.\n * @return Boolean indicating success.\n */\n function replaceUser(address oldAddress, address newAddress) external hasWaited(oldAddress) returns (bool) {\n if (msg.sender != oldAddress && msg.sender != owner()) revert NoPermission(); // Revert if not authorized\n if (verifiedUsers.contains(newAddress)) revert UserAlreadyExists(); // Revert if new address already exists\n\n // Replace user\n verifiedUsers.remove(oldAddress);\n verifiedUsers.add(newAddress);\n\n users[newAddress] = users[oldAddress];\n users[newAddress].lastAccessTime = block.timestamp;\n delete users[oldAddress];\n\n return true;\n }\n\n /**\n * @dev Refer a new user and reward the referrer.\n * @param _referrer Address of the referrer.\n * @param _referree Address of the referree.\n * @param _reward Amount of tokens to be rewarded.\n * @return Boolean indicating success.\n */\n function refer(address _referrer, address _referree, uint256 _reward) external onlyOwner returns (bool) {\n if (users[_referree].referrer != address(0)) revert AlreadyReferred(); // Revert if referree already has a\n // referrer\n if (_referrer == _referree) revert SelfRefer(); // Revert if referrer and referree are the same\n if (!verifiedUsers.contains(_referrer) || !verifiedUsers.contains(_referree)) revert NotVerified(); // Revert if\n // referrer or referree is not verified\n\n // Update user data\n users[_referrer].referrals.push(_referree);\n users[_referree].referrer = _referrer;\n users[_referrer].totalClaimable += _reward;\n users[_referree].totalClaimed += _reward;\n token.safeTransfer(_referree, _reward); // Transfer reward tokens\n\n emit ReferralRegistered(_referrer, _referree, _reward); // Emit event\n return true;\n }\n\n /**\n * @dev Claim rewards for the caller.\n */\n function claimReward() external {\n if (!verifiedUsers.contains(msg.sender)) revert NotVerified(); // Revert if caller is not verified\n if (users[msg.sender].totalClaimable == 0) revert NothingToClaim(); // Revert if there are no rewards to claim\n\n // Claim rewards\n uint256 reward = users[msg.sender].totalClaimable;\n users[msg.sender].totalClaimable = 0;\n users[msg.sender].totalClaimed += reward;\n\n token.safeTransfer(msg.sender, reward); // Transfer rewards to caller\n }\n\n /**\n * @dev Set the ERC20 token contract address.\n * @param _newToken Address of the new ERC20 token contract.\n * @return Boolean indicating success.\n */\n function setContracts(address _newToken) external onlyOwner returns (bool) {\n token = IERC20Upgradeable(_newToken); // Set new token contract address\n return true;\n }\n\n /**\n * @dev Transfer tokens from a contract.\n * @param _addr Address of the token contract.\n * @param _amount Amount of tokens to transfer.\n * @return Boolean indicating success.\n */\n function transferToken(address _addr, uint256 _amount) external onlyOwner returns (bool) {\n IERC20Upgradeable _token = IERC20Upgradeable(_addr); // Get token contract\n _token.safeTransfer(address(owner()), _amount); // Transfer tokens to owner\n return true; // Return transfer status\n }\n\n // View Functions\n\n /**\n * @dev Get list of verified users.\n * @return Array of verified user addresses.\n */\n function getVerifiedUsers() external view returns (address[] memory) {\n return verifiedUsers.values(); // Return list of verified users\n }\n\n /**\n * @dev Get list of referrals for a user.\n * @param _user Address of the user.\n * @return Array of referral addresses.\n */\n function getReferrals(address _user) external view returns (address[] memory) {\n return (users[_user].referrals); // Return list of referrals for a user\n }\n\n /**\n * @dev Check if a user is verified.\n * @param _user Address of the user.\n * @return Boolean indicating whether the user is verified.\n */\n function isVerified(address _user) external view returns (bool) {\n return verifiedUsers.contains(_user); // Return verification status of the user\n }\n\n // Initializer Function\n\n /**\n * @dev Initialize the contract with required parameters.\n * @param _waitTime Time required to wait before making changes to a user's wallet.\n * @param _token Address of the ERC20 token contract.\n */\n function initialize(uint256 _waitTime, address _token) public initializer {\n __Ownable_init(); // Initialize Ownable contract\n\n waitTime = _waitTime; // Set wait time\n token = IERC20Upgradeable(_token); // Set token contract address\n }\n\n // Public Functions\n\n /**\n * @dev Add a new user.\n * @param _address Address of the user.\n * @return Boolean indicating success.\n */\n function addUser(address _address) public onlyOwner returns (bool) {\n bool status = verifiedUsers.add(_address); // Add user to verified users\n users[_address].lastAccessTime = block.timestamp; // Set last access time\n emit UserAdded(_address); // Emit event for user addition\n return status; // Return addition status\n }\n}\n" }, "src/interfaces/IDCBTiers.sol": { "content": "// SPDX-License-Identifier: UNLICENSED\n\n//** DCB IDO Interface */\n//** Author Aaron & Aceson : DCB 2023.2 */\n\npragma solidity 0.8.25;\n\ninterface IDCBTiers {\n /**\n *\n * @dev Tier struct\n *\n * @param {minLimit} Minimum amount of dcb to be staked to join tier\n * @param {maxLimit} Maximum amount of dcb to be staked to join tier\n *\n */\n struct Tier {\n uint256 minLimit;\n uint256 maxLimit;\n uint256 refundFee;\n }\n\n function tierInfo(uint256 idx) external returns (uint256, uint256, uint256);\n\n function getTierOfUser(address addr) external view returns (bool flag, uint256 pos, uint256 multiplier);\n\n function getTierAndDepositOfUser(address addr)\n external\n view\n returns (bool flag, uint256 pos, uint256 multiplier, uint256 totalDeposit);\n}\n" } }, "settings": { "metadata": { "bytecodeHash": "none" }, "optimizer": { "enabled": true, "runs": 10000 }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} } }}
1
20,290,602
104eefac5034f7bb8c783e74eb2e0e4c07b5ac66216fa8f1b970537fa5ec1d44
3f76e7fe29659ae72ee75d896e1eba46d41ce9670da2c80d81efba6a185cd015
5d188f3d1247cc117f76bde9603a6f5d39a33bb8
09b33a99b954e52907c61514b6f8cd37de71076f
d80d31e64101462c8b00d260b438ce24ae9f85a9
60a060405234801561001057600080fd5b506040516108af3803806108af83398101604081905261002f916103ae565b816001600160a01b0316633f78cac46040518163ffffffff1660e01b8152600401602060405180830381865afa15801561006d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100919190610470565b8161009e828260006100b2565b5050506001600160a01b03166080526104dc565b6100bb836100e8565b6000825111806100c85750805b156100e3576100e1838361012860201b61008b1760201c565b505b505050565b6100f181610154565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b606061014d838360405180606001604052806027815260200161088860279139610226565b9392505050565b6101678161029f60201b6100b71760201c565b6101ce5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084015b60405180910390fd5b806102057f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b6102ae60201b6100c61760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b6060600080856001600160a01b031685604051610243919061048d565b600060405180830381855af49150503d806000811461027e576040519150601f19603f3d011682016040523d82523d6000602084013e610283565b606091505b509092509050610295868383876102b1565b9695505050505050565b6001600160a01b03163b151590565b90565b60608315610320578251600003610319576001600160a01b0385163b6103195760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016101c5565b508161032a565b61032a8383610332565b949350505050565b8151156103425781518083602001fd5b8060405162461bcd60e51b81526004016101c591906104a9565b6001600160a01b038116811461037157600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b838110156103a557818101518382015260200161038d565b50506000910152565b600080604083850312156103c157600080fd5b82516103cc8161035c565b60208401519092506001600160401b03808211156103e957600080fd5b818501915085601f8301126103fd57600080fd5b81518181111561040f5761040f610374565b604051601f8201601f19908116603f0116810190838211818310171561043757610437610374565b8160405282815288602084870101111561045057600080fd5b61046183602083016020880161038a565b80955050505050509250929050565b60006020828403121561048257600080fd5b815161014d8161035c565b6000825161049f81846020870161038a565b9190910192915050565b60208152600082518060208401526104c881604085016020870161038a565b601f01601f19169190910160400192915050565b6080516103926104f6600039600060cd01526103926000f3fe6080604052600436106100225760003560e01c8063aaf10f421461003957610031565b366100315761002f61006a565b005b61002f61006a565b34801561004557600080fd5b5061004e61007c565b6040516001600160a01b03909116815260200160405180910390f35b61007a6100756100c9565b61014d565b565b60006100866100c9565b905090565b60606100b0838360405180606001604052806027815260200161033660279139610171565b9392505050565b6001600160a01b03163b151590565b90565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633f78cac46040518163ffffffff1660e01b8152600401602060405180830381865afa158015610129573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100869190610299565b3660008037600080366000845af43d6000803e80801561016c573d6000f35b3d6000fd5b6060600080856001600160a01b03168560405161018e91906102e6565b600060405180830381855af49150503d80600081146101c9576040519150601f19603f3d011682016040523d82523d6000602084013e6101ce565b606091505b50915091506101df868383876101e9565b9695505050505050565b6060831561025d578251600003610256576001600160a01b0385163b6102565760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064015b60405180910390fd5b5081610267565b610267838361026f565b949350505050565b81511561027f5781518083602001fd5b8060405162461bcd60e51b815260040161024d9190610302565b6000602082840312156102ab57600080fd5b81516001600160a01b03811681146100b057600080fd5b60005b838110156102dd5781810151838201526020016102c5565b50506000910152565b600082516102f88184602087016102c2565b9190910192915050565b60208152600082518060208401526103218160408501602087016102c2565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220a2f078028d9c0a69b89727f08aa1a63ee0b904725f6b51ba979ab1861d7ea82664736f6c63430008110033416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564000000000000000000000000eabc14a2c136c4be286fd9faf76ff9e3247222ba00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000024c4d66de80000000000000000000000005d188f3d1247cc117f76bde9603a6f5d39a33bb800000000000000000000000000000000000000000000000000000000
6080604052600436106100225760003560e01c8063aaf10f421461003957610031565b366100315761002f61006a565b005b61002f61006a565b34801561004557600080fd5b5061004e61007c565b6040516001600160a01b03909116815260200160405180910390f35b61007a6100756100c9565b61014d565b565b60006100866100c9565b905090565b60606100b0838360405180606001604052806027815260200161033660279139610171565b9392505050565b6001600160a01b03163b151590565b90565b60007f000000000000000000000000eabc14a2c136c4be286fd9faf76ff9e3247222ba6001600160a01b0316633f78cac46040518163ffffffff1660e01b8152600401602060405180830381865afa158015610129573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100869190610299565b3660008037600080366000845af43d6000803e80801561016c573d6000f35b3d6000fd5b6060600080856001600160a01b03168560405161018e91906102e6565b600060405180830381855af49150503d80600081146101c9576040519150601f19603f3d011682016040523d82523d6000602084013e6101ce565b606091505b50915091506101df868383876101e9565b9695505050505050565b6060831561025d578251600003610256576001600160a01b0385163b6102565760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064015b60405180910390fd5b5081610267565b610267838361026f565b949350505050565b81511561027f5781518083602001fd5b8060405162461bcd60e51b815260040161024d9190610302565b6000602082840312156102ab57600080fd5b81516001600160a01b03811681146100b057600080fd5b60005b838110156102dd5781810151838201526020016102c5565b50506000910152565b600082516102f88184602087016102c2565b9190910192915050565b60208152600082518060208401526103218160408501602087016102c2565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220a2f078028d9c0a69b89727f08aa1a63ee0b904725f6b51ba979ab1861d7ea82664736f6c63430008110033
1
20,290,602
104eefac5034f7bb8c783e74eb2e0e4c07b5ac66216fa8f1b970537fa5ec1d44
d7bc6697c4ee3356b5691fb482e1b0e2e0e8ad9466cb1fddd570f9371e0aa679
b7af86d7b49ca0c618288723ea95c932e4fb4451
b7af86d7b49ca0c618288723ea95c932e4fb4451
fd4048d46b30520869b6f36604f28d63bbbfe946
608060405234801561001057600080fd5b5060405161043838038061043883398101604081905261002f91610165565b806001600160a01b03811661005f57604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b61006881610079565b50610072826100c9565b5050610198565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b806001600160a01b03163b6000036100ff5760405163211eb15960e21b81526001600160a01b0382166004820152602401610056565b600180546001600160a01b0319166001600160a01b0383169081179091556040517fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b80516001600160a01b038116811461016057600080fd5b919050565b6000806040838503121561017857600080fd5b61018183610149565b915061018f60208401610149565b90509250929050565b610291806101a76000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80633659cfe61461005c5780635c60da1b14610071578063715018a61461009a5780638da5cb5b146100a2578063f2fde38b146100b3575b600080fd5b61006f61006a36600461022b565b6100c6565b005b6001546001600160a01b03165b6040516001600160a01b03909116815260200160405180910390f35b61006f6100da565b6000546001600160a01b031661007e565b61006f6100c136600461022b565b6100ee565b6100ce61012e565b6100d78161015b565b50565b6100e261012e565b6100ec60006101db565b565b6100f661012e565b6001600160a01b03811661012557604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b6100d7816101db565b6000546001600160a01b031633146100ec5760405163118cdaa760e01b815233600482015260240161011c565b806001600160a01b03163b6000036101915760405163211eb15960e21b81526001600160a01b038216600482015260240161011c565b600180546001600160a01b0319166001600160a01b0383169081179091556040517fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020828403121561023d57600080fd5b81356001600160a01b038116811461025457600080fd5b939250505056fea26469706673582212209bd2bbba6f4186c5eae1a792ac249ef610047efefe523ec98882d4161ec8722a64736f6c63430008140033000000000000000000000000761487963e73e37f46c78ee4a8e59276ee73d493000000000000000000000000b7af86d7b49ca0c618288723ea95c932e4fb4451
608060405234801561001057600080fd5b50600436106100575760003560e01c80633659cfe61461005c5780635c60da1b14610071578063715018a61461009a5780638da5cb5b146100a2578063f2fde38b146100b3575b600080fd5b61006f61006a36600461022b565b6100c6565b005b6001546001600160a01b03165b6040516001600160a01b03909116815260200160405180910390f35b61006f6100da565b6000546001600160a01b031661007e565b61006f6100c136600461022b565b6100ee565b6100ce61012e565b6100d78161015b565b50565b6100e261012e565b6100ec60006101db565b565b6100f661012e565b6001600160a01b03811661012557604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b6100d7816101db565b6000546001600160a01b031633146100ec5760405163118cdaa760e01b815233600482015260240161011c565b806001600160a01b03163b6000036101915760405163211eb15960e21b81526001600160a01b038216600482015260240161011c565b600180546001600160a01b0319166001600160a01b0383169081179091556040517fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020828403121561023d57600080fd5b81356001600160a01b038116811461025457600080fd5b939250505056fea26469706673582212209bd2bbba6f4186c5eae1a792ac249ef610047efefe523ec98882d4161ec8722a64736f6c63430008140033
{{ "language": "Solidity", "sources": { "@openzeppelin/contracts/access/Ownable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)\n\npragma solidity ^0.8.20;\n\nimport {Context} from \"../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 * The initial owner is set to the address provided by the deployer. This can\n * 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 /**\n * @dev The caller account is not authorized to perform an operation.\n */\n error OwnableUnauthorizedAccount(address account);\n\n /**\n * @dev The owner is not a valid owner account. (eg. `address(0)`)\n */\n error OwnableInvalidOwner(address owner);\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the address provided by the deployer as the initial owner.\n */\n constructor(address initialOwner) {\n if (initialOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\n _transferOwnership(initialOwner);\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 if (owner() != _msgSender()) {\n revert OwnableUnauthorizedAccount(_msgSender());\n }\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling 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 if (newOwner == address(0)) {\n revert OwnableInvalidOwner(address(0));\n }\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/IERC1967.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC1967.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.\n */\ninterface IERC1967 {\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Emitted when the beacon is changed.\n */\n event BeaconUpgraded(address indexed beacon);\n}\n" }, "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/BeaconProxy.sol)\n\npragma solidity ^0.8.20;\n\nimport {IBeacon} from \"./IBeacon.sol\";\nimport {Proxy} from \"../Proxy.sol\";\nimport {ERC1967Utils} from \"../ERC1967/ERC1967Utils.sol\";\n\n/**\n * @dev This contract implements a proxy that gets the implementation address for each call from an {UpgradeableBeacon}.\n *\n * The beacon address can only be set once during construction, and cannot be changed afterwards. It is stored in an\n * immutable variable to avoid unnecessary storage reads, and also in the beacon storage slot specified by\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] so that it can be accessed externally.\n *\n * CAUTION: Since the beacon address can never be changed, you must ensure that you either control the beacon, or trust\n * the beacon to not upgrade the implementation maliciously.\n *\n * IMPORTANT: Do not use the implementation logic to modify the beacon storage slot. Doing so would leave the proxy in\n * an inconsistent state where the beacon storage slot does not match the beacon address.\n */\ncontract BeaconProxy is Proxy {\n // An immutable address for the beacon to avoid unnecessary SLOADs before each delegate call.\n address private immutable _beacon;\n\n /**\n * @dev Initializes the proxy with `beacon`.\n *\n * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. This\n * will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity\n * constructor.\n *\n * Requirements:\n *\n * - `beacon` must be a contract with the interface {IBeacon}.\n * - If `data` is empty, `msg.value` must be zero.\n */\n constructor(address beacon, bytes memory data) payable {\n ERC1967Utils.upgradeBeaconToAndCall(beacon, data);\n _beacon = beacon;\n }\n\n /**\n * @dev Returns the current implementation address of the associated beacon.\n */\n function _implementation() internal view virtual override returns (address) {\n return IBeacon(_getBeacon()).implementation();\n }\n\n /**\n * @dev Returns the beacon.\n */\n function _getBeacon() internal view virtual returns (address) {\n return _beacon;\n }\n}\n" }, "@openzeppelin/contracts/proxy/beacon/IBeacon.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.20;\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 * {UpgradeableBeacon} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" }, "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/UpgradeableBeacon.sol)\n\npragma solidity ^0.8.20;\n\nimport {IBeacon} from \"./IBeacon.sol\";\nimport {Ownable} from \"../../access/Ownable.sol\";\n\n/**\n * @dev This contract is used in conjunction with one or more instances of {BeaconProxy} to determine their\n * implementation contract, which is where they will delegate all function calls.\n *\n * An owner is able to change the implementation the beacon points to, thus upgrading the proxies that use this beacon.\n */\ncontract UpgradeableBeacon is IBeacon, Ownable {\n address private _implementation;\n\n /**\n * @dev The `implementation` of the beacon is invalid.\n */\n error BeaconInvalidImplementation(address implementation);\n\n /**\n * @dev Emitted when the implementation returned by the beacon is changed.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Sets the address of the initial implementation, and the initial owner who can upgrade the beacon.\n */\n constructor(address implementation_, address initialOwner) Ownable(initialOwner) {\n _setImplementation(implementation_);\n }\n\n /**\n * @dev Returns the current implementation address.\n */\n function implementation() public view virtual returns (address) {\n return _implementation;\n }\n\n /**\n * @dev Upgrades the beacon to a new implementation.\n *\n * Emits an {Upgraded} event.\n *\n * Requirements:\n *\n * - msg.sender must be the owner of the contract.\n * - `newImplementation` must be a contract.\n */\n function upgradeTo(address newImplementation) public virtual onlyOwner {\n _setImplementation(newImplementation);\n }\n\n /**\n * @dev Sets the implementation contract address for this beacon\n *\n * Requirements:\n *\n * - `newImplementation` must be a contract.\n */\n function _setImplementation(address newImplementation) private {\n if (newImplementation.code.length == 0) {\n revert BeaconInvalidImplementation(newImplementation);\n }\n _implementation = newImplementation;\n emit Upgraded(newImplementation);\n }\n}\n" }, "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/ERC1967/ERC1967Proxy.sol)\n\npragma solidity ^0.8.20;\n\nimport {Proxy} from \"../Proxy.sol\";\nimport {ERC1967Utils} from \"./ERC1967Utils.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 {\n /**\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `implementation`.\n *\n * If `_data` is nonempty, it's used as data in a delegate call to `implementation`. This will typically be an\n * encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.\n *\n * Requirements:\n *\n * - If `data` is empty, `msg.value` must be zero.\n */\n constructor(address implementation, bytes memory _data) payable {\n ERC1967Utils.upgradeToAndCall(implementation, _data);\n }\n\n /**\n * @dev Returns the current implementation address.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using\n * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\n */\n function _implementation() internal view virtual override returns (address) {\n return ERC1967Utils.getImplementation();\n }\n}\n" }, "@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/ERC1967/ERC1967Utils.sol)\n\npragma solidity ^0.8.20;\n\nimport {IBeacon} from \"../beacon/IBeacon.sol\";\nimport {Address} from \"../../utils/Address.sol\";\nimport {StorageSlot} from \"../../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 */\nlibrary ERC1967Utils {\n // We re-declare ERC-1967 events here because they can't be used directly from IERC1967.\n // This will be fixed in Solidity 0.8.21. At that point we should remove these events.\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Emitted when the beacon is changed.\n */\n event BeaconUpgraded(address indexed beacon);\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.\n */\n // solhint-disable-next-line private-vars-leading-underscore\n bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev The `implementation` of the proxy is invalid.\n */\n error ERC1967InvalidImplementation(address implementation);\n\n /**\n * @dev The `admin` of the proxy is invalid.\n */\n error ERC1967InvalidAdmin(address admin);\n\n /**\n * @dev The `beacon` of the proxy is invalid.\n */\n error ERC1967InvalidBeacon(address beacon);\n\n /**\n * @dev An upgrade function sees `msg.value > 0` that may be lost.\n */\n error ERC1967NonPayable();\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 if (newImplementation.code.length == 0) {\n revert ERC1967InvalidImplementation(newImplementation);\n }\n StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Performs implementation upgrade with additional setup call if data is nonempty.\n * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected\n * to avoid stuck value in the contract.\n *\n * Emits an {IERC1967-Upgraded} event.\n */\n function upgradeToAndCall(address newImplementation, bytes memory data) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n\n if (data.length > 0) {\n Address.functionDelegateCall(newImplementation, data);\n } else {\n _checkNonPayable();\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.\n */\n // solhint-disable-next-line private-vars-leading-underscore\n bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Returns the current admin.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using\n * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\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 if (newAdmin == address(0)) {\n revert ERC1967InvalidAdmin(address(0));\n }\n StorageSlot.getAddressSlot(ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {IERC1967-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 the keccak-256 hash of \"eip1967.proxy.beacon\" subtracted by 1.\n */\n // solhint-disable-next-line private-vars-leading-underscore\n bytes32 internal constant BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\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 if (newBeacon.code.length == 0) {\n revert ERC1967InvalidBeacon(newBeacon);\n }\n\n StorageSlot.getAddressSlot(BEACON_SLOT).value = newBeacon;\n\n address beaconImplementation = IBeacon(newBeacon).implementation();\n if (beaconImplementation.code.length == 0) {\n revert ERC1967InvalidImplementation(beaconImplementation);\n }\n }\n\n /**\n * @dev Change the beacon and trigger a setup call if data is nonempty.\n * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected\n * to avoid stuck value in the contract.\n *\n * Emits an {IERC1967-BeaconUpgraded} event.\n *\n * CAUTION: Invoking this function has no effect on an instance of {BeaconProxy} since v5, since\n * it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for\n * efficiency.\n */\n function upgradeBeaconToAndCall(address newBeacon, bytes memory data) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n\n if (data.length > 0) {\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\n } else {\n _checkNonPayable();\n }\n }\n\n /**\n * @dev Reverts if `msg.value` is not zero. It can be used to avoid `msg.value` stuck in the contract\n * if an upgrade doesn't perform an initialization call.\n */\n function _checkNonPayable() private {\n if (msg.value > 0) {\n revert ERC1967NonPayable();\n }\n }\n}\n" }, "@openzeppelin/contracts/proxy/Proxy.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.20;\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\n * function 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 _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" }, "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/transparent/ProxyAdmin.sol)\n\npragma solidity ^0.8.20;\n\nimport {ITransparentUpgradeableProxy} from \"./TransparentUpgradeableProxy.sol\";\nimport {Ownable} from \"../../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 */\ncontract ProxyAdmin is Ownable {\n /**\n * @dev The version of the upgrade interface of the contract. If this getter is missing, both `upgrade(address)`\n * and `upgradeAndCall(address,bytes)` are present, and `upgradeTo` must be used if no function should be called,\n * while `upgradeAndCall` will invoke the `receive` function if the second argument is the empty byte string.\n * If the getter returns `\"5.0.0\"`, only `upgradeAndCall(address,bytes)` is present, and the second argument must\n * be the empty byte string if no function should be called, making it impossible to invoke the `receive` function\n * during an upgrade.\n */\n string public constant UPGRADE_INTERFACE_VERSION = \"5.0.0\";\n\n /**\n * @dev Sets the initial owner who can perform upgrades.\n */\n constructor(address initialOwner) Ownable(initialOwner) {}\n\n /**\n * @dev Upgrades `proxy` to `implementation` and calls a function on the new implementation.\n * See {TransparentUpgradeableProxy-_dispatchUpgradeToAndCall}.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n * - If `data` is empty, `msg.value` must be zero.\n */\n function upgradeAndCall(\n ITransparentUpgradeableProxy proxy,\n address implementation,\n bytes memory data\n ) public payable virtual onlyOwner {\n proxy.upgradeToAndCall{value: msg.value}(implementation, data);\n }\n}\n" }, "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (proxy/transparent/TransparentUpgradeableProxy.sol)\n\npragma solidity ^0.8.20;\n\nimport {ERC1967Utils} from \"../ERC1967/ERC1967Utils.sol\";\nimport {ERC1967Proxy} from \"../ERC1967/ERC1967Proxy.sol\";\nimport {IERC1967} from \"../../interfaces/IERC1967.sol\";\nimport {ProxyAdmin} from \"./ProxyAdmin.sol\";\n\n/**\n * @dev Interface for {TransparentUpgradeableProxy}. In order to implement transparency, {TransparentUpgradeableProxy}\n * does not implement this interface directly, and its upgradeability mechanism is implemented by an internal dispatch\n * mechanism. The compiler is unaware that these functions are implemented by {TransparentUpgradeableProxy} and will not\n * include them in the ABI so this interface must be used to interact with it.\n */\ninterface ITransparentUpgradeableProxy is IERC1967 {\n function upgradeToAndCall(address, bytes calldata) external payable;\n}\n\n/**\n * @dev This contract implements a proxy that is upgradeable through an associated {ProxyAdmin} instance.\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 the {ITransparentUpgradeableProxy-upgradeToAndCall} function exposed by the proxy itself.\n * 2. If the admin calls the proxy, it can call the `upgradeToAndCall` function but any other call won't be forwarded to\n * the implementation. If the admin tries to call a function on the implementation it will fail with an error indicating\n * the proxy admin cannot fallback to the target implementation.\n *\n * These properties mean that the admin account can only be used for upgrading the proxy, so it's best if it's a\n * dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to\n * call a function from the proxy implementation. For this reason, the proxy deploys an instance of {ProxyAdmin} and\n * allows upgrades only if they come through it. You should think of the `ProxyAdmin` instance as the administrative\n * interface of the proxy, including the ability to change who can trigger upgrades by transferring ownership.\n *\n * NOTE: The real interface of this proxy is that defined in `ITransparentUpgradeableProxy`. This contract does not\n * inherit from that interface, and instead `upgradeToAndCall` is implicitly implemented using a custom dispatch\n * mechanism in `_fallback`. Consequently, the compiler will not produce an ABI for this contract. This is necessary to\n * fully implement transparency without decoding reverts caused by selector clashes between the proxy and the\n * implementation.\n *\n * NOTE: This proxy does not inherit from {Context} deliberately. The {ProxyAdmin} of this contract won't send a\n * meta-transaction in any way, and any other meta-transaction setup should be made in the implementation contract.\n *\n * IMPORTANT: This contract avoids unnecessary storage reads by setting the admin only during construction as an\n * immutable variable, preventing any changes thereafter. However, the admin slot defined in ERC-1967 can still be\n * overwritten by the implementation logic pointed to by this proxy. In such cases, the contract may end up in an\n * undesirable state where the admin slot is different from the actual admin.\n *\n * WARNING: It is not recommended to extend this contract to add additional external functions. If you do so, the\n * compiler will not check that there are no selector conflicts, due to the note above. A selector clash between any new\n * function and the functions declared in {ITransparentUpgradeableProxy} will be resolved in favor of the new one. This\n * could render the `upgradeToAndCall` function inaccessible, preventing upgradeability and compromising transparency.\n */\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\n // An immutable address for the admin to avoid unnecessary SLOADs before each call\n // at the expense of removing the ability to change the admin once it's set.\n // This is acceptable if the admin is always a ProxyAdmin instance or similar contract\n // with its own ability to transfer the permissions to another account.\n address private immutable _admin;\n\n /**\n * @dev The proxy caller is the current admin, and can't fallback to the proxy target.\n */\n error ProxyDeniedAdminAccess();\n\n /**\n * @dev Initializes an upgradeable proxy managed by an instance of a {ProxyAdmin} with an `initialOwner`,\n * backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in\n * {ERC1967Proxy-constructor}.\n */\n constructor(address _logic, address initialOwner, bytes memory _data) payable ERC1967Proxy(_logic, _data) {\n _admin = address(new ProxyAdmin(initialOwner));\n // Set the storage value and emit an event for ERC-1967 compatibility\n ERC1967Utils.changeAdmin(_proxyAdmin());\n }\n\n /**\n * @dev Returns the admin of this proxy.\n */\n function _proxyAdmin() internal virtual returns (address) {\n return _admin;\n }\n\n /**\n * @dev If caller is the admin process the call internally, otherwise transparently fallback to the proxy behavior.\n */\n function _fallback() internal virtual override {\n if (msg.sender == _proxyAdmin()) {\n if (msg.sig != ITransparentUpgradeableProxy.upgradeToAndCall.selector) {\n revert ProxyDeniedAdminAccess();\n } else {\n _dispatchUpgradeToAndCall();\n }\n } else {\n super._fallback();\n }\n }\n\n /**\n * @dev Upgrade the implementation of the proxy. See {ERC1967Utils-upgradeToAndCall}.\n *\n * Requirements:\n *\n * - If `data` is empty, `msg.value` must be zero.\n */\n function _dispatchUpgradeToAndCall() private {\n (address newImplementation, bytes memory data) = abi.decode(msg.data[4:], (address, bytes));\n ERC1967Utils.upgradeToAndCall(newImplementation, data);\n }\n}\n" }, "@openzeppelin/contracts/utils/Address.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev The ETH balance of the account is not enough to perform the operation.\n */\n error AddressInsufficientBalance(address account);\n\n /**\n * @dev There's no code at `target` (it is not a contract).\n */\n error AddressEmptyCode(address target);\n\n /**\n * @dev A call to an address target failed. The target may have reverted.\n */\n error FailedInnerCall();\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://consensys.net/diligence/blog/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.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n if (address(this).balance < amount) {\n revert AddressInsufficientBalance(address(this));\n }\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n if (!success) {\n revert FailedInnerCall();\n }\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 or custom error, it is bubbled\n * up by this function (like regular Solidity function calls). However, if\n * the call reverted with no returned reason, this function reverts with a\n * {FailedInnerCall} error.\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 function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0);\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 function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n if (address(this).balance < value) {\n revert AddressInsufficientBalance(address(this));\n }\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResultFromTarget(target, success, returndata);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\n * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\n * unsuccessful call.\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata\n ) internal view returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n // only check if target is a contract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n if (returndata.length == 0 && target.code.length == 0) {\n revert AddressEmptyCode(target);\n }\n return returndata;\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\n * revert reason or with a default {FailedInnerCall} error.\n */\n function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\n if (!success) {\n _revert(returndata);\n } else {\n return returndata;\n }\n }\n\n /**\n * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\n */\n function _revert(bytes memory returndata) 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 FailedInnerCall();\n }\n }\n}\n" }, "@openzeppelin/contracts/utils/Context.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\npragma solidity ^0.8.20;\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 function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n" }, "@openzeppelin/contracts/utils/StorageSlot.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\n\npragma solidity ^0.8.20;\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 * ```solidity\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(newImplementation.code.length > 0);\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\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 struct StringSlot {\n string value;\n }\n\n struct BytesSlot {\n bytes 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 /**\n * @dev Returns an `StringSlot` with member `value` located at `slot`.\n */\n function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\n */\n function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` with member `value` located at `slot`.\n */\n function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\n */\n function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := store.slot\n }\n }\n}\n" } }, "settings": { "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris" } }}
1
20,290,615
93533acd5b5479500a1349a9dc1a5696c3f2660d1d23847ddef37eed9cb81b04
63355382519e919f48b54818bd67dd9f94dd87e6771d5c1a5e648086ae2a5925
a214aed7cf1982d5e342fd93711a49153623f953
07042134d4dc295cbf3ab08a4a0eff847a528171
75ce48d62b88c8e65d0abc228fec9808fb2d820c
608060405234801561001057600080fd5b5060405161020538038061020583398101604081905261002f916101d4565b8060005b604051636312ab1360e11b8152600481018290526000906001600160a01b0384169063c625562690602401602060405180830381865afa15801561007b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061009f91906101d4565b6001600160a01b0316146101475761013f82600019846001600160a01b031663c6255626856040518263ffffffff1660e01b81526004016100e291815260200190565b602060405180830381865afa1580156100ff573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061012391906101d4565b6001600160a01b031661014a60201b610009179092919060201c565b600101610033565b33ff5b600060405163095ea7b360e01b81526001600160a01b0384166004820152826024820152602060006044836000895af13d15601f3d11600160005114161716915050806101ce5760405162461bcd60e51b815260206004820152600e60248201526d1054141493d59157d1905253115160921b604482015260640160405180910390fd5b50505050565b6000602082840312156101e657600080fd5b81516001600160a01b03811681146101fd57600080fd5b939250505056fe00000000000000000000000007042134d4dc295cbf3ab08a4a0eff847a528171
1
20,290,619
5bccc375d77b2ef2bdb840d2b45750d3d246695cbb487edf27b645cc996ca025
aa74fabf9ec27ab38ccae21fe8d6a04b408d551d2f40d860f77ba8b3d8843d9d
a7d770a5c4276a4d85caba7bea9a1fcbd3672db7
ba9f42e902447a771ee43d102f01b8eb0920dc8f
c7d96b776662c5398d40535c70e572b9bc27359e
608060405234801561001057600080fd5b5060405161050038038061050083398101604081905261002f9161036b565b60405147906000906001600160a01b0389169083908381818185875af1925050503d806000811461007c576040519150601f19603f3d011682016040523d82523d6000602084013e610081565b606091505b50509050806100bb5760405162461bcd60e51b8152602060048201526002602482015261229960f11b604482015260640160405180910390fd5b604080516001600160601b031960608a811b821660208401526001600160e81b031960e88a901b16603484015289901b1660378201528151808203602b018152604b82018352600b60f81b606b8301526000606c83018190528351808403604d0181526002606d850181815260cd86019096529294909391929091608d015b606081526020019060019003908161013a57905050604080516001600160a01b038e16602082015290810187905290915060600160405160208183030381529060405281600081518110610190576101906103f0565b602002602001018190525085600160ff1b888560006040516020016101b995949392919061044c565b604051602081830303815290604052816001815181106101db576101db6103f0565b60209081029190910101526040516324856bc360e01b81526001600160a01b038c16906324856bc390610214908590859060040161048d565b600060405180830381600087803b15801561022e57600080fd5b505af192505050801561023f575060015b61034757604051600160fa1b602082015260009060210160408051808303601f190181526001808452838301909252925060009190816020015b60608152602001906001900390816102795790505060408051600060208201526001600160a01b038b169181019190915260608101899052909150608001604051602081830303815290604052816000815181106102d9576102d96103f0565b60209081029190910101526040516324856bc360e01b81526001600160a01b038e16906324856bc390610312908590859060040161048d565b600060405180830381600087803b15801561032c57600080fd5b505af1158015610340573d6000803e3d6000fd5b5050505050505b856001600160a01b0316ff5b6001600160a01b038116811461036857600080fd5b50565b60008060008060008060c0878903121561038457600080fd5b865161038f81610353565b60208801519096506103a081610353565b60408801519095506103b181610353565b606088015190945062ffffff811681146103ca57600080fd5b608088015160a089015191945092506103e281610353565b809150509295509295509295565b634e487b7160e01b600052603260045260246000fd5b6000815180845260005b8181101561042c57602081850181015186830182015201610410565b506000602082860101526020601f19601f83011685010191505092915050565b60018060a01b038616815284602082015283604082015260a06060820152600061047960a0830185610406565b905082151560808301529695505050505050565b6040815260006104a06040830185610406565b6020838203818501528185518084528284019150828160051b85010183880160005b838110156104f057601f198784030185526104de838351610406565b948601949250908501906001016104c2565b5090999850505050505050505056fe000000000000000000000000ef1c6e67703c7bd7107eed8303fbe6ec2554bf6b000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000000000000000000000000000000000000a4485620000000000000000000000008b27e4db3b82dbb70363eb66ea1017783f0cec5b
1
20,290,621
c7b8e008f58643176ace311e6a970ceb7682f89f4da9f2541be48752ebf5601a
363777ce3b1e638959a8211ac65e82a7337703a3c5260c944d67b3929020d626
849a02be4c2ec8bbd06052c5a0cd51147994ad96
39c40c8f040cf363fa3cc6ed379dced87f318c36
60d8626e968cd03cbcb296baa0b92a792f3e1c7a
608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe
1
20,290,621
c7b8e008f58643176ace311e6a970ceb7682f89f4da9f2541be48752ebf5601a
7060a6e01ec4e4bec5ba4f1707b54ed044be5025c37f7cce17cec7d0d078b1a1
8a232ff3bd1e335c01ffe6218291e1a3a285cf88
8a232ff3bd1e335c01ffe6218291e1a3a285cf88
0d8b0994ac2e3b67ace19aafd51d6aa23672428a
6080604052600680546001600160a01b03191673fbfeaf0da0f2fde5c66df570133ae35f3eb58c9a179055601460078190556008555f6009818155600a8281556019600b819055600c55601e600d556042600e55600f92909255606491620000689190620005bc565b620000789063042343e0620005cc565b620000849190620005e6565b62000091906002620005cc565b6010556064620000a46009600a620005bc565b620000b49063042343e0620005cc565b620000c09190620005e6565b620000cd906002620005cc565b6011556103e8620000e16009600a620005bc565b620000f19063042343e0620005cc565b620000fd9190620005e6565b6200010a906001620005cc565b60125560646200011d6009600a620005bc565b6200012d9063042343e0620005cc565b620001399190620005e6565b62000146906001620005cc565b6013556015805461ffff60a81b191690555f60168190556017553480156200016c575f80fd5b505f80546001600160a01b031916339081178255604051909182917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350600580546001600160a01b03191633179055620001f76064620001f06003620001d96009600a620005bc565b620001e99063042343e0620005cc565b9062000399565b906200042c565b6006546001600160a01b03165f908152600160205260409020556200022b6064620001f06050620001d96009600a620005bc565b305f90815260016020526040902055620002546064620001f06011620001d96009600a620005bc565b335f9081526001602081905260408220929092556003906200027d5f546001600160a01b031690565b6001600160a01b03908116825260208083019390935260409182015f908120805495151560ff1996871617905530815260039384905282812080548616600190811790915560055483168252928120805490951690921790935560065490921691905f805160206200219b833981519152906200030a90606490620001f090620001d96009600a620005bc565b60405190815260200160405180910390a3305f5f805160206200219b833981519152620003466064620001f06050620001d96009600a620005bc565b60405190815260200160405180910390a3335f5f805160206200219b833981519152620003826064620001f06011620001d96009600a620005bc565b60405190815260200160405180910390a362000654565b5f825f03620003aa57505f62000426565b5f620003b78385620005cc565b905082620003c68583620005e6565b14620004235760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084015b60405180910390fd5b90505b92915050565b5f6200042383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506200047560201b60201c565b5f8183620004985760405162461bcd60e51b81526004016200041a919062000606565b505f620004a68486620005e6565b95945050505050565b634e487b7160e01b5f52601160045260245ffd5b600181815b808511156200050357815f1904821115620004e757620004e7620004af565b80851615620004f557918102915b93841c9390800290620004c8565b509250929050565b5f826200051b5750600162000426565b816200052957505f62000426565b81600181146200054257600281146200054d576200056d565b600191505062000426565b60ff841115620005615762000561620004af565b50506001821b62000426565b5060208310610133831016604e8410600b841016171562000592575081810a62000426565b6200059e8383620004c3565b805f1904821115620005b457620005b4620004af565b029392505050565b5f6200042360ff8416836200050b565b8082028115828204841417620004265762000426620004af565b5f826200060157634e487b7160e01b5f52601260045260245ffd5b500490565b5f602080835283518060208501525f5b81811015620006345785810183015185820160400152820162000616565b505f604082860101526040601f19601f8301168501019250505092915050565b611b3980620006625f395ff3fe60806040526004361061013f575f3560e01c806370a08231116100b357806395d89b411161006d57806395d89b4114610376578063a9059cbb146103a1578063bf474bed146103c0578063c9567bf9146103d5578063d34628cc146103e9578063dd62ed3e14610408575f80fd5b806370a08231146102ca578063715018a6146102fe578063751039fc146103125780637d1db4a5146103265780638da5cb5b1461033b5780638f9a55c014610361575f80fd5b806323b872dd1161010457806323b872dd14610212578063313ce5671461023157806331c2d8471461024c5780633bbac5791461026b57806351bc3c85146102a25780636fc3eaec146102b6575f80fd5b806306fdde031461014a578063095ea7b3146101965780630faee56f146101c5578063109daa99146101e857806318160ddd146101fe575f80fd5b3661014657005b5f80fd5b348015610155575f80fd5b50604080518082019091526012815271666d6c202d206675636b206d79206c69666560701b60208201525b60405161018d9190611648565b60405180910390f35b3480156101a1575f80fd5b506101b56101b03660046116b8565b61044c565b604051901515815260200161018d565b3480156101d0575f80fd5b506101da60135481565b60405190815260200161018d565b3480156101f3575f80fd5b506101fc610462565b005b348015610209575f80fd5b506101da6104d0565b34801561021d575f80fd5b506101b561022c3660046116e2565b6104f0565b34801561023c575f80fd5b506040516009815260200161018d565b348015610257575f80fd5b506101fc610266366004611734565b610557565b348015610276575f80fd5b506101b56102853660046117f4565b6001600160a01b03165f9081526004602052604090205460ff1690565b3480156102ad575f80fd5b506101fc6105de565b3480156102c1575f80fd5b506101fc61062b565b3480156102d5575f80fd5b506101da6102e43660046117f4565b6001600160a01b03165f9081526001602052604090205490565b348015610309575f80fd5b506101fc610657565b34801561031d575f80fd5b506101fc6106c8565b348015610331575f80fd5b506101da60105481565b348015610346575f80fd5b505f546040516001600160a01b03909116815260200161018d565b34801561036c575f80fd5b506101da60115481565b348015610381575f80fd5b5060408051808201909152600381526211935360ea1b6020820152610180565b3480156103ac575f80fd5b506101b56103bb3660046116b8565b610774565b3480156103cb575f80fd5b506101da60125481565b3480156103e0575f80fd5b506101fc610780565b3480156103f4575f80fd5b506101fc610403366004611734565b610b29565b348015610413575f80fd5b506101da61042236600461180f565b6001600160a01b039182165f90815260026020908152604080832093909416825291909152205490565b5f610458338484610bad565b5060015b92915050565b5f546001600160a01b031633146104945760405162461bcd60e51b815260040161048b90611846565b60405180910390fd5b5f600e8190556040519081527fe9b79e1a6c2dc43b4c0c6ff01ce9e3332d810e482270f464c0a21ad6c5fc6de3906020015b60405180910390a1565b5f6104dd6009600a61196f565b6104eb9063042343e061197d565b905090565b5f6104fc848484610cd0565b61054d843361054885604051806060016040528060288152602001611adc602891396001600160a01b038a165f90815260026020908152604080832033845290915290205491906112c4565b610bad565b5060019392505050565b5f546001600160a01b031633146105805760405162461bcd60e51b815260040161048b90611846565b5f5b81518110156105da575f60045f8484815181106105a1576105a1611994565b6020908102919091018101516001600160a01b031682528101919091526040015f20805460ff1916911515919091179055600101610582565b5050565b6005546001600160a01b0316336001600160a01b0316146105fd575f80fd5b305f90815260016020526040902054801561061b5761061b816112fc565b4780156105da576105da8161146c565b6005546001600160a01b0316336001600160a01b03161461064a575f80fd5b476106548161146c565b50565b5f546001600160a01b031633146106805760405162461bcd60e51b815260040161048b90611846565b5f80546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a35f80546001600160a01b0319169055565b5f546001600160a01b031633146106f15760405162461bcd60e51b815260040161048b90611846565b6106fd6009600a61196f565b61070b9063042343e061197d565b60105561071a6009600a61196f565b6107289063042343e061197d565b6011557f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6107586009600a61196f565b6107669063042343e061197d565b6040519081526020016104c6565b5f610458338484610cd0565b5f546001600160a01b031633146107a95760405162461bcd60e51b815260040161048b90611846565b601554600160a01b900460ff16156108035760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161048b565b601480546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811790915561084c90309061083e6009600a61196f565b6105489063042343e061197d565b60145f9054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa15801561089c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108c091906119a8565b6001600160a01b031663c9c653963060145f9054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561091f573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061094391906119a8565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303815f875af115801561098d573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109b191906119a8565b601580546001600160a01b039283166001600160a01b03199091161790556014541663f305d71947306109f8816001600160a01b03165f9081526001602052604090205490565b5f80610a0b5f546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610a71573d5f803e3d5ffd5b50505050506040513d601f19601f82011682018060405250810190610a9691906119c3565b505060155460145460405163095ea7b360e01b81526001600160a01b0391821660048201525f1960248201529116915063095ea7b3906044016020604051808303815f875af1158015610aeb573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b0f91906119ee565b506015805462ff00ff60a01b19166201000160a01b179055565b5f546001600160a01b03163314610b525760405162461bcd60e51b815260040161048b90611846565b5f5b81518110156105da57600160045f848481518110610b7457610b74611994565b6020908102919091018101516001600160a01b031682528101919091526040015f20805460ff1916911515919091179055600101610b54565b6001600160a01b038316610c0f5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161048b565b6001600160a01b038216610c705760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161048b565b6001600160a01b038381165f8181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d345760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161048b565b6001600160a01b038216610d965760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161048b565b5f8111610df75760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161048b565b5f80546001600160a01b03858116911614801590610e2257505f546001600160a01b03848116911614155b15611187576001600160a01b0384165f9081526004602052604090205460ff16158015610e6757506001600160a01b0383165f9081526004602052604090205460ff16155b610e6f575f80fd5b600f545f03610ea757610ea46064610e9e600b54600f5411610e9357600754610e97565b6009545b85906114a3565b90611528565b90505b600f5415610ecc57610ec96064610e9e600e54856114a390919063ffffffff16565b90505b6015546001600160a01b038581169116148015610ef757506014546001600160a01b03848116911614155b8015610f1b57506001600160a01b0383165f9081526003602052604090205460ff16155b1561101e57601054821115610f725760405162461bcd60e51b815260206004820152601960248201527f4578636565647320746865205f6d61785478416d6f756e742e00000000000000604482015260640161048b565b60115482610f94856001600160a01b03165f9081526001602052604090205490565b610f9e9190611a0d565b1115610fec5760405162461bcd60e51b815260206004820152601a60248201527f4578636565647320746865206d617857616c6c657453697a652e000000000000604482015260640161048b565b6110076064610e9e600b54600f5411610e9357600754610e97565b600f80549192505f61101883611a20565b91905055505b6015546001600160a01b03848116911614801561104457506001600160a01b0384163014155b156110715761106e6064610e9e600c54600f541161106457600854610e97565b600a5485906114a3565b90505b305f90815260016020526040902054601554600160a81b900460ff161580156110a757506015546001600160a01b038581169116145b80156110bc5750601554600160b01b900460ff165b80156110c9575060125481115b80156110d85750600d54600f54115b15611185576017544311156110ec575f6016555b60036016541061113e5760405162461bcd60e51b815260206004820152601760248201527f4f6e6c7920332073656c6c732070657220626c6f636b21000000000000000000604482015260640161048b565b61115b6111568461115184601354611569565b611569565b6112fc565b47801561116b5761116b4761146c565b60168054905f61117a83611a20565b909155505043601755505b505b80156111ff57305f908152600160205260409020546111a6908261157d565b305f81815260016020526040908190209290925590516001600160a01b038616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906111f69085815260200190565b60405180910390a35b6001600160a01b0384165f9081526001602052604090205461122190836115db565b6001600160a01b0385165f9081526001602052604090205561126461124683836115db565b6001600160a01b0385165f908152600160205260409020549061157d565b6001600160a01b038085165f8181526001602052604090209290925585167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6112ad85856115db565b60405190815260200160405180910390a350505050565b5f81848411156112e75760405162461bcd60e51b815260040161048b9190611648565b505f6112f38486611a38565b95945050505050565b6015805460ff60a81b1916600160a81b1790556040805160028082526060820183525f9260208301908036833701905050905030815f8151811061134257611342611994565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611399573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906113bd91906119a8565b816001815181106113d0576113d0611994565b6001600160a01b0392831660209182029290920101526014546113f69130911684610bad565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061142e9085905f90869030904290600401611a4b565b5f604051808303815f87803b158015611445575f80fd5b505af1158015611457573d5f803e3d5ffd5b50506015805460ff60a81b1916905550505050565b6005546040516001600160a01b039091169082156108fc029083905f818181858888f193505050501580156105da573d5f803e3d5ffd5b5f825f036114b257505f61045c565b5f6114bd838561197d565b9050826114ca8583611abc565b146115215760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161048b565b9392505050565b5f61152183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061161c565b5f8183116115775782611521565b50919050565b5f806115898385611a0d565b9050838110156115215760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161048b565b5f61152183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506112c4565b5f818361163c5760405162461bcd60e51b815260040161048b9190611648565b505f6112f38486611abc565b5f602080835283518060208501525f5b8181101561167457858101830151858201604001528201611658565b505f604082860101526040601f19601f8301168501019250505092915050565b6001600160a01b0381168114610654575f80fd5b80356116b381611694565b919050565b5f80604083850312156116c9575f80fd5b82356116d481611694565b946020939093013593505050565b5f805f606084860312156116f4575f80fd5b83356116ff81611694565b9250602084013561170f81611694565b929592945050506040919091013590565b634e487b7160e01b5f52604160045260245ffd5b5f6020808385031215611745575f80fd5b823567ffffffffffffffff8082111561175c575f80fd5b818501915085601f83011261176f575f80fd5b81358181111561178157611781611720565b8060051b604051601f19603f830116810181811085821117156117a6576117a6611720565b6040529182528482019250838101850191888311156117c3575f80fd5b938501935b828510156117e8576117d9856116a8565b845293850193928501926117c8565b98975050505050505050565b5f60208284031215611804575f80fd5b813561152181611694565b5f8060408385031215611820575f80fd5b823561182b81611694565b9150602083013561183b81611694565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b5f52601160045260245ffd5b600181815b808511156118c957815f19048211156118af576118af61187b565b808516156118bc57918102915b93841c9390800290611894565b509250929050565b5f826118df5750600161045c565b816118eb57505f61045c565b8160018114611901576002811461190b57611927565b600191505061045c565b60ff84111561191c5761191c61187b565b50506001821b61045c565b5060208310610133831016604e8410600b841016171561194a575081810a61045c565b611954838361188f565b805f19048211156119675761196761187b565b029392505050565b5f61152160ff8416836118d1565b808202811582820484141761045c5761045c61187b565b634e487b7160e01b5f52603260045260245ffd5b5f602082840312156119b8575f80fd5b815161152181611694565b5f805f606084860312156119d5575f80fd5b8351925060208401519150604084015190509250925092565b5f602082840312156119fe575f80fd5b81518015158114611521575f80fd5b8082018082111561045c5761045c61187b565b5f60018201611a3157611a3161187b565b5060010190565b8181038181111561045c5761045c61187b565b5f60a08201878352602087602085015260a0604085015281875180845260c0860191506020890193505f5b81811015611a9b5784516001600160a01b031683529383019391830191600101611a76565b50506001600160a01b03969096166060850152505050608001529392505050565b5f82611ad657634e487b7160e01b5f52601260045260245ffd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208c953fe92270ea31e8217babdefe6e8b8dd632fa987b31c3216143daaa1241d464736f6c63430008170033ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef
60806040526004361061013f575f3560e01c806370a08231116100b357806395d89b411161006d57806395d89b4114610376578063a9059cbb146103a1578063bf474bed146103c0578063c9567bf9146103d5578063d34628cc146103e9578063dd62ed3e14610408575f80fd5b806370a08231146102ca578063715018a6146102fe578063751039fc146103125780637d1db4a5146103265780638da5cb5b1461033b5780638f9a55c014610361575f80fd5b806323b872dd1161010457806323b872dd14610212578063313ce5671461023157806331c2d8471461024c5780633bbac5791461026b57806351bc3c85146102a25780636fc3eaec146102b6575f80fd5b806306fdde031461014a578063095ea7b3146101965780630faee56f146101c5578063109daa99146101e857806318160ddd146101fe575f80fd5b3661014657005b5f80fd5b348015610155575f80fd5b50604080518082019091526012815271666d6c202d206675636b206d79206c69666560701b60208201525b60405161018d9190611648565b60405180910390f35b3480156101a1575f80fd5b506101b56101b03660046116b8565b61044c565b604051901515815260200161018d565b3480156101d0575f80fd5b506101da60135481565b60405190815260200161018d565b3480156101f3575f80fd5b506101fc610462565b005b348015610209575f80fd5b506101da6104d0565b34801561021d575f80fd5b506101b561022c3660046116e2565b6104f0565b34801561023c575f80fd5b506040516009815260200161018d565b348015610257575f80fd5b506101fc610266366004611734565b610557565b348015610276575f80fd5b506101b56102853660046117f4565b6001600160a01b03165f9081526004602052604090205460ff1690565b3480156102ad575f80fd5b506101fc6105de565b3480156102c1575f80fd5b506101fc61062b565b3480156102d5575f80fd5b506101da6102e43660046117f4565b6001600160a01b03165f9081526001602052604090205490565b348015610309575f80fd5b506101fc610657565b34801561031d575f80fd5b506101fc6106c8565b348015610331575f80fd5b506101da60105481565b348015610346575f80fd5b505f546040516001600160a01b03909116815260200161018d565b34801561036c575f80fd5b506101da60115481565b348015610381575f80fd5b5060408051808201909152600381526211935360ea1b6020820152610180565b3480156103ac575f80fd5b506101b56103bb3660046116b8565b610774565b3480156103cb575f80fd5b506101da60125481565b3480156103e0575f80fd5b506101fc610780565b3480156103f4575f80fd5b506101fc610403366004611734565b610b29565b348015610413575f80fd5b506101da61042236600461180f565b6001600160a01b039182165f90815260026020908152604080832093909416825291909152205490565b5f610458338484610bad565b5060015b92915050565b5f546001600160a01b031633146104945760405162461bcd60e51b815260040161048b90611846565b60405180910390fd5b5f600e8190556040519081527fe9b79e1a6c2dc43b4c0c6ff01ce9e3332d810e482270f464c0a21ad6c5fc6de3906020015b60405180910390a1565b5f6104dd6009600a61196f565b6104eb9063042343e061197d565b905090565b5f6104fc848484610cd0565b61054d843361054885604051806060016040528060288152602001611adc602891396001600160a01b038a165f90815260026020908152604080832033845290915290205491906112c4565b610bad565b5060019392505050565b5f546001600160a01b031633146105805760405162461bcd60e51b815260040161048b90611846565b5f5b81518110156105da575f60045f8484815181106105a1576105a1611994565b6020908102919091018101516001600160a01b031682528101919091526040015f20805460ff1916911515919091179055600101610582565b5050565b6005546001600160a01b0316336001600160a01b0316146105fd575f80fd5b305f90815260016020526040902054801561061b5761061b816112fc565b4780156105da576105da8161146c565b6005546001600160a01b0316336001600160a01b03161461064a575f80fd5b476106548161146c565b50565b5f546001600160a01b031633146106805760405162461bcd60e51b815260040161048b90611846565b5f80546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a35f80546001600160a01b0319169055565b5f546001600160a01b031633146106f15760405162461bcd60e51b815260040161048b90611846565b6106fd6009600a61196f565b61070b9063042343e061197d565b60105561071a6009600a61196f565b6107289063042343e061197d565b6011557f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6107586009600a61196f565b6107669063042343e061197d565b6040519081526020016104c6565b5f610458338484610cd0565b5f546001600160a01b031633146107a95760405162461bcd60e51b815260040161048b90611846565b601554600160a01b900460ff16156108035760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161048b565b601480546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811790915561084c90309061083e6009600a61196f565b6105489063042343e061197d565b60145f9054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa15801561089c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108c091906119a8565b6001600160a01b031663c9c653963060145f9054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561091f573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061094391906119a8565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303815f875af115801561098d573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109b191906119a8565b601580546001600160a01b039283166001600160a01b03199091161790556014541663f305d71947306109f8816001600160a01b03165f9081526001602052604090205490565b5f80610a0b5f546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610a71573d5f803e3d5ffd5b50505050506040513d601f19601f82011682018060405250810190610a9691906119c3565b505060155460145460405163095ea7b360e01b81526001600160a01b0391821660048201525f1960248201529116915063095ea7b3906044016020604051808303815f875af1158015610aeb573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b0f91906119ee565b506015805462ff00ff60a01b19166201000160a01b179055565b5f546001600160a01b03163314610b525760405162461bcd60e51b815260040161048b90611846565b5f5b81518110156105da57600160045f848481518110610b7457610b74611994565b6020908102919091018101516001600160a01b031682528101919091526040015f20805460ff1916911515919091179055600101610b54565b6001600160a01b038316610c0f5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161048b565b6001600160a01b038216610c705760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161048b565b6001600160a01b038381165f8181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d345760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161048b565b6001600160a01b038216610d965760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161048b565b5f8111610df75760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161048b565b5f80546001600160a01b03858116911614801590610e2257505f546001600160a01b03848116911614155b15611187576001600160a01b0384165f9081526004602052604090205460ff16158015610e6757506001600160a01b0383165f9081526004602052604090205460ff16155b610e6f575f80fd5b600f545f03610ea757610ea46064610e9e600b54600f5411610e9357600754610e97565b6009545b85906114a3565b90611528565b90505b600f5415610ecc57610ec96064610e9e600e54856114a390919063ffffffff16565b90505b6015546001600160a01b038581169116148015610ef757506014546001600160a01b03848116911614155b8015610f1b57506001600160a01b0383165f9081526003602052604090205460ff16155b1561101e57601054821115610f725760405162461bcd60e51b815260206004820152601960248201527f4578636565647320746865205f6d61785478416d6f756e742e00000000000000604482015260640161048b565b60115482610f94856001600160a01b03165f9081526001602052604090205490565b610f9e9190611a0d565b1115610fec5760405162461bcd60e51b815260206004820152601a60248201527f4578636565647320746865206d617857616c6c657453697a652e000000000000604482015260640161048b565b6110076064610e9e600b54600f5411610e9357600754610e97565b600f80549192505f61101883611a20565b91905055505b6015546001600160a01b03848116911614801561104457506001600160a01b0384163014155b156110715761106e6064610e9e600c54600f541161106457600854610e97565b600a5485906114a3565b90505b305f90815260016020526040902054601554600160a81b900460ff161580156110a757506015546001600160a01b038581169116145b80156110bc5750601554600160b01b900460ff165b80156110c9575060125481115b80156110d85750600d54600f54115b15611185576017544311156110ec575f6016555b60036016541061113e5760405162461bcd60e51b815260206004820152601760248201527f4f6e6c7920332073656c6c732070657220626c6f636b21000000000000000000604482015260640161048b565b61115b6111568461115184601354611569565b611569565b6112fc565b47801561116b5761116b4761146c565b60168054905f61117a83611a20565b909155505043601755505b505b80156111ff57305f908152600160205260409020546111a6908261157d565b305f81815260016020526040908190209290925590516001600160a01b038616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906111f69085815260200190565b60405180910390a35b6001600160a01b0384165f9081526001602052604090205461122190836115db565b6001600160a01b0385165f9081526001602052604090205561126461124683836115db565b6001600160a01b0385165f908152600160205260409020549061157d565b6001600160a01b038085165f8181526001602052604090209290925585167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6112ad85856115db565b60405190815260200160405180910390a350505050565b5f81848411156112e75760405162461bcd60e51b815260040161048b9190611648565b505f6112f38486611a38565b95945050505050565b6015805460ff60a81b1916600160a81b1790556040805160028082526060820183525f9260208301908036833701905050905030815f8151811061134257611342611994565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611399573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906113bd91906119a8565b816001815181106113d0576113d0611994565b6001600160a01b0392831660209182029290920101526014546113f69130911684610bad565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061142e9085905f90869030904290600401611a4b565b5f604051808303815f87803b158015611445575f80fd5b505af1158015611457573d5f803e3d5ffd5b50506015805460ff60a81b1916905550505050565b6005546040516001600160a01b039091169082156108fc029083905f818181858888f193505050501580156105da573d5f803e3d5ffd5b5f825f036114b257505f61045c565b5f6114bd838561197d565b9050826114ca8583611abc565b146115215760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161048b565b9392505050565b5f61152183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061161c565b5f8183116115775782611521565b50919050565b5f806115898385611a0d565b9050838110156115215760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161048b565b5f61152183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506112c4565b5f818361163c5760405162461bcd60e51b815260040161048b9190611648565b505f6112f38486611abc565b5f602080835283518060208501525f5b8181101561167457858101830151858201604001528201611658565b505f604082860101526040601f19601f8301168501019250505092915050565b6001600160a01b0381168114610654575f80fd5b80356116b381611694565b919050565b5f80604083850312156116c9575f80fd5b82356116d481611694565b946020939093013593505050565b5f805f606084860312156116f4575f80fd5b83356116ff81611694565b9250602084013561170f81611694565b929592945050506040919091013590565b634e487b7160e01b5f52604160045260245ffd5b5f6020808385031215611745575f80fd5b823567ffffffffffffffff8082111561175c575f80fd5b818501915085601f83011261176f575f80fd5b81358181111561178157611781611720565b8060051b604051601f19603f830116810181811085821117156117a6576117a6611720565b6040529182528482019250838101850191888311156117c3575f80fd5b938501935b828510156117e8576117d9856116a8565b845293850193928501926117c8565b98975050505050505050565b5f60208284031215611804575f80fd5b813561152181611694565b5f8060408385031215611820575f80fd5b823561182b81611694565b9150602083013561183b81611694565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b5f52601160045260245ffd5b600181815b808511156118c957815f19048211156118af576118af61187b565b808516156118bc57918102915b93841c9390800290611894565b509250929050565b5f826118df5750600161045c565b816118eb57505f61045c565b8160018114611901576002811461190b57611927565b600191505061045c565b60ff84111561191c5761191c61187b565b50506001821b61045c565b5060208310610133831016604e8410600b841016171561194a575081810a61045c565b611954838361188f565b805f19048211156119675761196761187b565b029392505050565b5f61152160ff8416836118d1565b808202811582820484141761045c5761045c61187b565b634e487b7160e01b5f52603260045260245ffd5b5f602082840312156119b8575f80fd5b815161152181611694565b5f805f606084860312156119d5575f80fd5b8351925060208401519150604084015190509250925092565b5f602082840312156119fe575f80fd5b81518015158114611521575f80fd5b8082018082111561045c5761045c61187b565b5f60018201611a3157611a3161187b565b5060010190565b8181038181111561045c5761045c61187b565b5f60a08201878352602087602085015260a0604085015281875180845260c0860191506020890193505f5b81811015611a9b5784516001600160a01b031683529383019391830191600101611a76565b50506001600160a01b03969096166060850152505050608001529392505050565b5f82611ad657634e487b7160e01b5f52601260045260245ffd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208c953fe92270ea31e8217babdefe6e8b8dd632fa987b31c3216143daaa1241d464736f6c63430008170033
/* fml fuck my life skyrocketed ten thousand times Stud! Stud! Stud! @fmlERC */ // SPDX-License-Identifier: MIT pragma solidity 0.8.23; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; } } contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } } interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface IUniswapV2Router02 { function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); } contract fml is Context, IERC20, Ownable { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) private _isExcludedFromFee; mapping (address => bool) private bots; address payable private _taxWallet; // $PEPE Deployer Wallet address private _pepeDeployerWallet = payable(0xfbfEaF0DA0F2fdE5c66dF570133aE35f3eB58c9A); uint256 private _initialBuyTax=20; uint256 private _initialSellTax=20; uint256 private _finalBuyTax=0; uint256 private _finalSellTax=0; uint256 private _reduceBuyTaxAt=25; uint256 private _reduceSellTaxAt=25; uint256 private _preventSwapBefore=30; uint256 private _transferTax=66; uint256 private _buyCount=0; uint8 private constant _decimals = 9; uint256 private constant _tTotal = 69_420_000 * 10**_decimals; string private constant _name = unicode"fml - fuck my life"; string private constant _symbol = unicode"FML"; uint256 public _maxTxAmount = 2 * (_tTotal/100); uint256 public _maxWalletSize = 2 * (_tTotal/100); uint256 public _taxSwapThreshold= 1 * (_tTotal/1000); uint256 public _maxTaxSwap= 1 * (_tTotal/100); IUniswapV2Router02 private uniswapV2Router; address private uniswapV2Pair; bool private tradingOpen; bool private inSwap = false; bool private swapEnabled = false; uint256 private sellCount = 0; uint256 private lastSellBlock = 0; event MaxTxAmountUpdated(uint _maxTxAmount); event TransferTaxUpdated(uint _tax); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor () { _taxWallet = payable(_msgSender()); _balances[_pepeDeployerWallet] = _tTotal.mul(3).div(100); _balances[address(this)] = _tTotal.mul(80).div(100); _balances[_msgSender()] = _tTotal.mul(17).div(100); _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_taxWallet] = true; emit Transfer(address(0), _pepeDeployerWallet, _tTotal.mul(3).div(100)); emit Transfer(address(0), address(this), _tTotal.mul(80).div(100)); emit Transfer(address(0), _msgSender(), _tTotal.mul(17).div(100)); } function name() public pure returns (string memory) { return _name; } function symbol() public pure returns (string memory) { return _symbol; } function decimals() public pure returns (uint8) { return _decimals; } function totalSupply() public pure override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function _approve(address owner, address spender, uint256 amount) private { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _transfer(address from, address to, uint256 amount) private { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); uint256 taxAmount=0; if (from != owner() && to != owner()) { require(!bots[from] && !bots[to]); if(_buyCount==0){ taxAmount = amount.mul((_buyCount>_reduceBuyTaxAt)?_finalBuyTax:_initialBuyTax).div(100); } if(_buyCount>0){ taxAmount = amount.mul(_transferTax).div(100); } if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] ) { require(amount <= _maxTxAmount, "Exceeds the _maxTxAmount."); require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the maxWalletSize."); taxAmount = amount.mul((_buyCount>_reduceBuyTaxAt)?_finalBuyTax:_initialBuyTax).div(100); _buyCount++; } if(to == uniswapV2Pair && from!= address(this) ){ taxAmount = amount.mul((_buyCount>_reduceSellTaxAt)?_finalSellTax:_initialSellTax).div(100); } uint256 contractTokenBalance = balanceOf(address(this)); if (!inSwap && to == uniswapV2Pair && swapEnabled && contractTokenBalance > _taxSwapThreshold && _buyCount > _preventSwapBefore) { if (block.number > lastSellBlock) { sellCount = 0; } require(sellCount < 3, "Only 3 sells per block!"); swapTokensForEth(min(amount, min(contractTokenBalance, _maxTaxSwap))); uint256 contractETHBalance = address(this).balance; if (contractETHBalance > 0) { sendETHToFee(address(this).balance); } sellCount++; lastSellBlock = block.number; } } if(taxAmount>0){ _balances[address(this)]=_balances[address(this)].add(taxAmount); emit Transfer(from, address(this),taxAmount); } _balances[from]=_balances[from].sub(amount); _balances[to]=_balances[to].add(amount.sub(taxAmount)); emit Transfer(from, to, amount.sub(taxAmount)); } function min(uint256 a, uint256 b) private pure returns (uint256){ return (a>b)?b:a; } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function removeLimits() external onlyOwner{ _maxTxAmount = _tTotal; _maxWalletSize=_tTotal; emit MaxTxAmountUpdated(_tTotal); } function removeTransferTax() external onlyOwner{ _transferTax = 0; emit TransferTaxUpdated(0); } function sendETHToFee(uint256 amount) private { _taxWallet.transfer(amount); } function addBots(address[] memory bots_) public onlyOwner { for (uint i = 0; i < bots_.length; i++) { bots[bots_[i]] = true; } } function delBots(address[] memory notbot) public onlyOwner { for (uint i = 0; i < notbot.length; i++) { bots[notbot[i]] = false; } } function isBot(address a) public view returns (bool){ return bots[a]; } function openTrading() external onlyOwner() { require(!tradingOpen,"trading is already open"); uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); _approve(address(this), address(uniswapV2Router), _tTotal); uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH()); uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp); IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max); swapEnabled = true; tradingOpen = true; } receive() external payable {} function manualSwap() external { require(_msgSender()==_taxWallet); uint256 tokenBalance=balanceOf(address(this)); if(tokenBalance>0){ swapTokensForEth(tokenBalance); } uint256 ethBalance=address(this).balance; if(ethBalance>0){ sendETHToFee(ethBalance); } } function manualsend() external { require(_msgSender()==_taxWallet); uint256 contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } }
1
20,290,622
40386216bf251df21c09454a7f8855170eb73d990bdb39841b5a92c7e450a472
c6bc1a6fe0c906af957dc893c401e578fa882b7bfec70d8c97b8bb5a1685665e
be49bd130e126a917ddb5fabf7cdeb6dd9887f40
84654be796dad370032391d5479f8f1fd9ddd14e
bb0a0db04a9bc6a89cf726db164692e5f21c3f62
604080600a3d393df3fe73265c27c849b0e1a62636f6007e8a74dc2a2584aa3d366025573d3d3d3d34865af16031565b363d3d373d3d363d855af45b3d82803e603c573d81fd5b3d81f3
73265c27c849b0e1a62636f6007e8a74dc2a2584aa3d366025573d3d3d3d34865af16031565b363d3d373d3d363d855af45b3d82803e603c573d81fd5b3d81f3
1
20,290,626
dac9001926853059b5870d99a0a951a0e02624e1120bfa99b13e79cb1e421de9
72b2fed3617e0348c5c98393ae961296303b03f03bd626ea54b0b0558193ec6a
00bdb5699745f5b860228c8f939abf1b9ae374ed
ffa397285ce46fb78c588a9e993286aac68c37cd
fe212366b0a8bfe1b459ca1e500de2eab96fda13
3d602d80600a3d3981f3363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3
pragma solidity 0.7.5; /* The MIT License (MIT) Copyright (c) 2018 Murray Software, LLC. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //solhint-disable max-line-length //solhint-disable no-inline-assembly contract CloneFactory { function createClone(address target, bytes32 salt) internal returns (address payable result) { bytes20 targetBytes = bytes20(target); assembly { // load the next free memory slot as a place to store the clone contract data let clone := mload(0x40) // The bytecode block below is responsible for contract initialization // during deployment, it is worth noting the proxied contract constructor will not be called during // the cloning procedure and that is why an initialization function needs to be called after the // clone is created mstore( clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000 ) // This stores the address location of the implementation contract // so that the proxy knows where to delegate call logic to mstore(add(clone, 0x14), targetBytes) // The bytecode block is the actual code that is deployed for each clone created. // It forwards all calls to the already deployed implementation via a delegatecall mstore( add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000 ) // deploy the contract using the CREATE2 opcode // this deploys the minimal proxy defined above, which will proxy all // calls to use the logic defined in the implementation contract `target` result := create2(0, clone, 0x37, salt) } } function isClone(address target, address query) internal view returns (bool result) { bytes20 targetBytes = bytes20(target); assembly { // load the next free memory slot as a place to store the comparison clone let clone := mload(0x40) // The next three lines store the expected bytecode for a miniml proxy // that targets `target` as its implementation contract mstore( clone, 0x363d3d373d3d3d363d7300000000000000000000000000000000000000000000 ) mstore(add(clone, 0xa), targetBytes) mstore( add(clone, 0x1e), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000 ) // the next two lines store the bytecode of the contract that we are checking in memory let other := add(clone, 0x40) extcodecopy(query, other, 0, 0x2d) // Check if the expected bytecode equals the actual bytecode and return the result result := and( eq(mload(clone), mload(other)), eq(mload(add(clone, 0xd)), mload(add(other, 0xd))) ) } } } /** * Contract that exposes the needed erc20 token functions */ abstract contract ERC20Interface { // Send _value amount of tokens to address _to function transfer(address _to, uint256 _value) public virtual returns (bool success); // Get the account balance of another account with address _owner function balanceOf(address _owner) public virtual view returns (uint256 balance); } // helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false library TransferHelper { function safeApprove( address token, address to, uint256 value ) internal { // bytes4(keccak256(bytes('approve(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::safeApprove: approve failed' ); } function safeTransfer( address token, address to, uint256 value ) internal { // bytes4(keccak256(bytes('transfer(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::safeTransfer: transfer failed' ); } function safeTransferFrom( address token, address from, address to, uint256 value ) internal { // bytes4(keccak256(bytes('transferFrom(address,address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::transferFrom: transferFrom failed' ); } function safeTransferETH(address to, uint256 value) internal { (bool success, ) = to.call{value: value}(new bytes(0)); require(success, 'TransferHelper::safeTransferETH: ETH transfer failed'); } } /** * Contract that will forward any incoming Ether to the creator of the contract * */ contract Forwarder { // Address to which any funds sent to this contract will be forwarded address public parentAddress; event ForwarderDeposited(address from, uint256 value, bytes data); /** * Initialize the contract, and sets the destination address to that of the creator */ function init(address _parentAddress) external onlyUninitialized { parentAddress = _parentAddress; uint256 value = address(this).balance; if (value == 0) { return; } (bool success, ) = parentAddress.call{ value: value }(''); require(success, 'Flush failed'); // NOTE: since we are forwarding on initialization, // we don't have the context of the original sender. // We still emit an event about the forwarding but set // the sender to the forwarder itself emit ForwarderDeposited(address(this), value, msg.data); } /** * Modifier that will execute internal code block only if the sender is the parent address */ modifier onlyParent { require(msg.sender == parentAddress, 'Only Parent'); _; } /** * Modifier that will execute internal code block only if the contract has not been initialized yet */ modifier onlyUninitialized { require(parentAddress == address(0x0), 'Already initialized'); _; } /** * Default function; Gets called when data is sent but does not match any other function */ fallback() external payable { flush(); } /** * Default function; Gets called when Ether is deposited with no data, and forwards it to the parent address */ receive() external payable { flush(); } /** * Execute a token transfer of the full balance from the forwarder token to the parent address * @param tokenContractAddress the address of the erc20 token contract */ function flushTokens(address tokenContractAddress) external onlyParent { ERC20Interface instance = ERC20Interface(tokenContractAddress); address forwarderAddress = address(this); uint256 forwarderBalance = instance.balanceOf(forwarderAddress); if (forwarderBalance == 0) { return; } TransferHelper.safeTransfer( tokenContractAddress, parentAddress, forwarderBalance ); } /** * Flush the entire balance of the contract to the parent address. */ function flush() public { uint256 value = address(this).balance; if (value == 0) { return; } (bool success, ) = parentAddress.call{ value: value }(''); require(success, 'Flush failed'); emit ForwarderDeposited(msg.sender, value, msg.data); } } contract ForwarderFactory is CloneFactory { address public implementationAddress; event ForwarderCreated(address newForwarderAddress, address parentAddress); constructor(address _implementationAddress) { implementationAddress = _implementationAddress; } function createForwarder(address parent, bytes32 salt) external { // include the signers in the salt so any contract deployed to a given address must have the same signers bytes32 finalSalt = keccak256(abi.encodePacked(parent, salt)); address payable clone = createClone(implementationAddress, finalSalt); Forwarder(clone).init(parent); emit ForwarderCreated(clone, parent); } }
1
20,290,627
224a2e2e4666e2a868be0002c0766acceb4e961af58543bb4f435146c12bf52a
1aead3c0f29ca9f7d0e7a77519cfd9048e61fcb6ba33766b2a9ba825e4f8eacd
06b2977e921df788bb6236231ac7010fe239df57
f7b75183a2829843db06266c114297dfbfaee2b6
eccf6b8a3542f81ac0d9983470816c84067611c5
3d602d80600a3d3981f3363d3d373d3d3d363d73d80a503a2c2a5dddd8be53fb75bd48f0bb465ed45af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73d80a503a2c2a5dddd8be53fb75bd48f0bb465ed45af43d82803e903d91602b57fd5bf3
{{ "language": "Solidity", "sources": { "contracts/AccountImplementation.sol": { "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.17;\n\n// Uncomment this line to use console.log\n// import \"hardhat/console.sol\";\nimport \"./AccountGuard.sol\";\n\ncontract AccountImplementation {\n AccountGuard public immutable guard;\n\n modifier authAndWhitelisted(address target, bool asDelegateCall) {\n (bool canCall, bool isWhitelisted) = guard.canCallAndWhitelisted(\n address(this),\n msg.sender,\n target,\n asDelegateCall\n );\n require(\n canCall,\n \"account-guard/no-permit\"\n );\n require(\n isWhitelisted,\n \"account-guard/illegal-target\"\n );\n _;\n }\n\n constructor(AccountGuard _guard) {\n require(\n address(_guard) != address(0x0),\n \"account-guard/wrong-guard-address\"\n );\n guard = _guard;\n }\n\n function send(address _target, bytes calldata _data)\n external\n payable\n authAndWhitelisted(_target, false)\n {\n (bool status, ) = (_target).call{value: msg.value}(_data);\n require(status, \"account-guard/call-failed\");\n }\n\n function execute(address _target, bytes memory /* code do not compile with calldata */ _data)\n external\n payable\n authAndWhitelisted(_target, true)\n\n returns (bytes32)\n {\n // call contract in current context\n assembly {\n let succeeded := delegatecall(\n sub(gas(), 5000),\n _target,\n add(_data, 0x20),\n mload(_data),\n 0,\n 32\n )\n returndatacopy(0, 0, returndatasize())\n switch succeeded\n case 0 {\n // throw if delegatecall failed\n revert(0, returndatasize())\n }\n default {\n return(0, 0x20)\n }\n }\n }\n \n receive() external payable {\n emit FundsRecived(msg.sender, msg.value);\n }\n\n function owner() external view returns (address) {\n return guard.owners(address(this));\n }\n\n event FundsRecived(address sender, uint256 amount);\n}\n" }, "contracts/AccountGuard.sol": { "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity 0.8.17;\n\n// Uncomment this line to use console.log\n// import \"hardhat/console.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract AccountGuard is Ownable {\n address factory;\n uint8 constant WHITELISTED_EXECUTE_MASK = 1;\n uint8 constant WHITELISTED_SEND_MASK = 2;\n mapping(address => mapping(address => bool)) private allowed;\n mapping(address => uint8) private whitelisted;\n mapping(address => address) public owners;\n\n function isWhitelisted(address target) public view returns (bool) {\n return (whitelisted[target] & WHITELISTED_EXECUTE_MASK) > 0;\n }\n\n function setWhitelist(address target, bool status) external onlyOwner {\n whitelisted[target] = status\n ? whitelisted[target] | WHITELISTED_EXECUTE_MASK\n : whitelisted[target] & ~WHITELISTED_EXECUTE_MASK;\n }\n\n function isWhitelistedSend(address target) public view returns (bool) {\n return (whitelisted[target] & WHITELISTED_SEND_MASK) > 0;\n }\n\n function setWhitelistSend(address target, bool status) external onlyOwner {\n whitelisted[target] = status\n ? whitelisted[target] | WHITELISTED_SEND_MASK\n : whitelisted[target] & ~WHITELISTED_SEND_MASK;\n }\n\n function canCallAndWhitelisted(\n address proxy,\n address operator,\n address callTarget,\n bool asDelegateCall\n ) external view returns (bool, bool) {\n return (\n allowed[operator][proxy],\n asDelegateCall\n ? isWhitelisted(callTarget)\n : isWhitelistedSend(callTarget)\n );\n }\n\n function canCall(address target, address operator)\n external\n view\n returns (bool)\n {\n return owners[target] == operator || allowed[operator][target];\n }\n\n function initializeFactory() external {\n require(factory == address(0), \"account-guard/factory-set\");\n factory = msg.sender;\n }\n\n function permit(\n address caller,\n address target,\n bool allowance\n ) external {\n require(\n allowed[msg.sender][target] || msg.sender == factory,\n \"account-guard/no-permit\"\n );\n if (msg.sender == factory) {\n owners[target] = caller;\n allowed[target][target] = true;\n } else {\n require(owners[target] != caller, \"account-guard/cant-deny-owner\");\n }\n allowed[caller][target] = allowance;\n\n if (allowance) {\n emit PermissionGranted(caller, target);\n } else {\n emit PermissionRevoked(caller, target);\n }\n }\n\n function changeOwner(address newOwner, address target) external {\n require(newOwner != address(0), \"account-guard/zero-address\");\n require(owners[target] == msg.sender, \"account-guard/only-proxy-owner\");\n owners[target] = newOwner;\n allowed[msg.sender][target] = false;\n allowed[newOwner][target] = true;\n emit ProxyOwnershipTransferred(newOwner, msg.sender, target);\n }\n\n event ProxyOwnershipTransferred(\n address indexed newOwner,\n address indexed oldAddress,\n address indexed proxy\n );\n event PermissionGranted(address indexed caller, address indexed proxy);\n event PermissionRevoked(address indexed caller, address indexed proxy);\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/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" } }, "settings": { "optimizer": { "enabled": false, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} } }}
1
20,290,634
423390d16961ce65954c9cb4c0f9601f73e808d6d981d55bc2882671624acc45
3904c8f17c0e165b6a95e50450f0ec3ae93ee74365e1b23b9351e19e03abd7e9
d2c82f2e5fa236e114a81173e375a73664610998
ffa397285ce46fb78c588a9e993286aac68c37cd
5f94bf7ce8615e633a777bd88fe244aed5dc0a4d
3d602d80600a3d3981f3363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3
pragma solidity 0.7.5; /* The MIT License (MIT) Copyright (c) 2018 Murray Software, LLC. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //solhint-disable max-line-length //solhint-disable no-inline-assembly contract CloneFactory { function createClone(address target, bytes32 salt) internal returns (address payable result) { bytes20 targetBytes = bytes20(target); assembly { // load the next free memory slot as a place to store the clone contract data let clone := mload(0x40) // The bytecode block below is responsible for contract initialization // during deployment, it is worth noting the proxied contract constructor will not be called during // the cloning procedure and that is why an initialization function needs to be called after the // clone is created mstore( clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000 ) // This stores the address location of the implementation contract // so that the proxy knows where to delegate call logic to mstore(add(clone, 0x14), targetBytes) // The bytecode block is the actual code that is deployed for each clone created. // It forwards all calls to the already deployed implementation via a delegatecall mstore( add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000 ) // deploy the contract using the CREATE2 opcode // this deploys the minimal proxy defined above, which will proxy all // calls to use the logic defined in the implementation contract `target` result := create2(0, clone, 0x37, salt) } } function isClone(address target, address query) internal view returns (bool result) { bytes20 targetBytes = bytes20(target); assembly { // load the next free memory slot as a place to store the comparison clone let clone := mload(0x40) // The next three lines store the expected bytecode for a miniml proxy // that targets `target` as its implementation contract mstore( clone, 0x363d3d373d3d3d363d7300000000000000000000000000000000000000000000 ) mstore(add(clone, 0xa), targetBytes) mstore( add(clone, 0x1e), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000 ) // the next two lines store the bytecode of the contract that we are checking in memory let other := add(clone, 0x40) extcodecopy(query, other, 0, 0x2d) // Check if the expected bytecode equals the actual bytecode and return the result result := and( eq(mload(clone), mload(other)), eq(mload(add(clone, 0xd)), mload(add(other, 0xd))) ) } } } /** * Contract that exposes the needed erc20 token functions */ abstract contract ERC20Interface { // Send _value amount of tokens to address _to function transfer(address _to, uint256 _value) public virtual returns (bool success); // Get the account balance of another account with address _owner function balanceOf(address _owner) public virtual view returns (uint256 balance); } // helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false library TransferHelper { function safeApprove( address token, address to, uint256 value ) internal { // bytes4(keccak256(bytes('approve(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::safeApprove: approve failed' ); } function safeTransfer( address token, address to, uint256 value ) internal { // bytes4(keccak256(bytes('transfer(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::safeTransfer: transfer failed' ); } function safeTransferFrom( address token, address from, address to, uint256 value ) internal { // bytes4(keccak256(bytes('transferFrom(address,address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::transferFrom: transferFrom failed' ); } function safeTransferETH(address to, uint256 value) internal { (bool success, ) = to.call{value: value}(new bytes(0)); require(success, 'TransferHelper::safeTransferETH: ETH transfer failed'); } } /** * Contract that will forward any incoming Ether to the creator of the contract * */ contract Forwarder { // Address to which any funds sent to this contract will be forwarded address public parentAddress; event ForwarderDeposited(address from, uint256 value, bytes data); /** * Initialize the contract, and sets the destination address to that of the creator */ function init(address _parentAddress) external onlyUninitialized { parentAddress = _parentAddress; uint256 value = address(this).balance; if (value == 0) { return; } (bool success, ) = parentAddress.call{ value: value }(''); require(success, 'Flush failed'); // NOTE: since we are forwarding on initialization, // we don't have the context of the original sender. // We still emit an event about the forwarding but set // the sender to the forwarder itself emit ForwarderDeposited(address(this), value, msg.data); } /** * Modifier that will execute internal code block only if the sender is the parent address */ modifier onlyParent { require(msg.sender == parentAddress, 'Only Parent'); _; } /** * Modifier that will execute internal code block only if the contract has not been initialized yet */ modifier onlyUninitialized { require(parentAddress == address(0x0), 'Already initialized'); _; } /** * Default function; Gets called when data is sent but does not match any other function */ fallback() external payable { flush(); } /** * Default function; Gets called when Ether is deposited with no data, and forwards it to the parent address */ receive() external payable { flush(); } /** * Execute a token transfer of the full balance from the forwarder token to the parent address * @param tokenContractAddress the address of the erc20 token contract */ function flushTokens(address tokenContractAddress) external onlyParent { ERC20Interface instance = ERC20Interface(tokenContractAddress); address forwarderAddress = address(this); uint256 forwarderBalance = instance.balanceOf(forwarderAddress); if (forwarderBalance == 0) { return; } TransferHelper.safeTransfer( tokenContractAddress, parentAddress, forwarderBalance ); } /** * Flush the entire balance of the contract to the parent address. */ function flush() public { uint256 value = address(this).balance; if (value == 0) { return; } (bool success, ) = parentAddress.call{ value: value }(''); require(success, 'Flush failed'); emit ForwarderDeposited(msg.sender, value, msg.data); } } contract ForwarderFactory is CloneFactory { address public implementationAddress; event ForwarderCreated(address newForwarderAddress, address parentAddress); constructor(address _implementationAddress) { implementationAddress = _implementationAddress; } function createForwarder(address parent, bytes32 salt) external { // include the signers in the salt so any contract deployed to a given address must have the same signers bytes32 finalSalt = keccak256(abi.encodePacked(parent, salt)); address payable clone = createClone(implementationAddress, finalSalt); Forwarder(clone).init(parent); emit ForwarderCreated(clone, parent); } }
1
20,290,637
46d6a9c8cc68997a4bcaff17d35354d69707a59dfb2278b5ffc4185e065532f9
0d980679ee541b67a822561084465b0ec17716712abd70aff5cf53a5b39438e0
be49bd130e126a917ddb5fabf7cdeb6dd9887f40
84654be796dad370032391d5479f8f1fd9ddd14e
bb8a42e601604a8fc264dcc31164ec5e6cd5ad0e
604080600a3d393df3fe73265c27c849b0e1a62636f6007e8a74dc2a2584aa3d366025573d3d3d3d34865af16031565b363d3d373d3d363d855af45b3d82803e603c573d81fd5b3d81f3
73265c27c849b0e1a62636f6007e8a74dc2a2584aa3d366025573d3d3d3d34865af16031565b363d3d373d3d363d855af45b3d82803e603c573d81fd5b3d81f3
1
20,290,640
0c799f4a48cb774b5b53ffbe5287d6120cd7d32f81291dd267bc0ba6f0323b2d
9fe6466b3c790bdc4727b17801334890fbc2292cd78229d9ff2435d5b8a8c037
df653e2e25c64c1ae30ed1ee623f1effcb8e30ee
df653e2e25c64c1ae30ed1ee623f1effcb8e30ee
19e5dd4c328959e8927757ebc522b1be962f7109
608060405260186006556017600755600160085560016009556018600a556017600b556010600c556046600d555f600e556009600a62000040919062000605565b640178204cb062000052919062000655565b600f556009600a62000065919062000605565b640178204cb062000077919062000655565b6010556009600a6200008a919062000605565b63fac033206200009b919062000655565b6011556009600a620000ae919062000605565b63fac03320620000bf919062000655565b6012555f601460156101000a81548160ff0219169083151502179055505f601460166101000a81548160ff0219169083151502179055505f6015555f6016553480156200010a575f80fd5b505f6200011c6200044560201b60201c565b9050805f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff165f73ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a350620001c86200044560201b60201c565b60055f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506009600a62000217919062000605565b6461f313f88062000229919062000655565b60015f6200023c6200044560201b60201c565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2081905550600160035f6200028e6200044c60201b60201c565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff021916908315150217905550600160035f3073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff021916908315150217905550600160035f60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff021916908315150217905550620003b86200044560201b60201c565b73ffffffffffffffffffffffffffffffffffffffff165f73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6009600a62000416919062000605565b6461f313f88062000428919062000655565b604051620004379190620006b0565b60405180910390a3620006cb565b5f33905090565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f8160011c9050919050565b5f808291508390505b6001851115620004fd57808604811115620004d557620004d462000473565b5b6001851615620004e55780820291505b8081029050620004f585620004a0565b9450620004b5565b94509492505050565b5f82620005175760019050620005e9565b8162000526575f9050620005e9565b81600181146200053f57600281146200054a5762000580565b6001915050620005e9565b60ff8411156200055f576200055e62000473565b5b8360020a91508482111562000579576200057862000473565b5b50620005e9565b5060208310610133831016604e8410600b8410161715620005ba5782820a905083811115620005b457620005b362000473565b5b620005e9565b620005c98484846001620004ac565b92509050818404811115620005e357620005e262000473565b5b81810290505b9392505050565b5f819050919050565b5f60ff82169050919050565b5f6200061182620005f0565b91506200061e83620005f9565b92506200064d7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff848462000506565b905092915050565b5f6200066182620005f0565b91506200066e83620005f0565b92508282026200067e81620005f0565b9150828204841483151762000698576200069762000473565b5b5092915050565b620006aa81620005f0565b82525050565b5f602082019050620006c55f8301846200069f565b92915050565b61383c80620006d95f395ff3fe60806040526004361061014e575f3560e01c8063715018a6116100b557806395d89b411161006e57806395d89b411461043f578063a9059cbb14610469578063bf474bed146104a5578063c9567bf9146104cf578063dd62ed3e146104e5578063ec1f3f631461052157610155565b8063715018a6146103475780637d1db4a51461035d5780638cd4426d146103875780638da5cb5b146103af5780638f9a55c0146103d9578063909bd5991461040357610155565b80632784645b116101075780632784645b14610265578063313ce5671461028d57806339729505146102b757806351bc3c85146102df5780636597e6fa146102f557806370a082311461030b57610155565b806306fdde0314610159578063095ea7b3146101835780630faee56f146101bf578063109daa99146101e957806318160ddd146101ff57806323b872dd1461022957610155565b3661015557005b5f80fd5b348015610164575f80fd5b5061016d610549565b60405161017a919061272b565b60405180910390f35b34801561018e575f80fd5b506101a960048036038101906101a491906127e9565b610586565b6040516101b69190612841565b60405180910390f35b3480156101ca575f80fd5b506101d36105a3565b6040516101e09190612869565b60405180910390f35b3480156101f4575f80fd5b506101fd6105a9565b005b34801561020a575f80fd5b5061021361067d565b6040516102209190612869565b60405180910390f35b348015610234575f80fd5b5061024f600480360381019061024a9190612882565b6106a1565b60405161025c9190612841565b60405180910390f35b348015610270575f80fd5b5061028b60048036038101906102869190612a12565b610775565b005b348015610298575f80fd5b506102a1610893565b6040516102ae9190612a74565b60405180910390f35b3480156102c2575f80fd5b506102dd60048036038101906102d89190612a12565b61089b565b005b3480156102ea575f80fd5b506102f36109ba565b005b348015610300575f80fd5b50610309610a69565b005b348015610316575f80fd5b50610331600480360381019061032c9190612a8d565b610b9b565b60405161033e9190612869565b60405180910390f35b348015610352575f80fd5b5061035b610be1565b005b348015610368575f80fd5b50610371610d2f565b60405161037e9190612869565b60405180910390f35b348015610392575f80fd5b506103ad60048036038101906103a891906127e9565b610d35565b005b3480156103ba575f80fd5b506103c3610ed6565b6040516103d09190612ac7565b60405180910390f35b3480156103e4575f80fd5b506103ed610efd565b6040516103fa9190612869565b60405180910390f35b34801561040e575f80fd5b5061042960048036038101906104249190612a8d565b610f03565b6040516104369190612841565b60405180910390f35b34801561044a575f80fd5b50610453610f55565b604051610460919061272b565b60405180910390f35b348015610474575f80fd5b5061048f600480360381019061048a91906127e9565b610f92565b60405161049c9190612841565b60405180910390f35b3480156104b0575f80fd5b506104b9610faf565b6040516104c69190612869565b60405180910390f35b3480156104da575f80fd5b506104e3610fb5565b005b3480156104f0575f80fd5b5061050b60048036038101906105069190612ae0565b6114d5565b6040516105189190612869565b60405180910390f35b34801561052c575f80fd5b5061054760048036038101906105429190612b1e565b611557565b005b60606040518060400160405280601481526020017f486f707079576174466c61707079447261676779000000000000000000000000815250905090565b5f6105996105926115e3565b84846115ea565b6001905092915050565b60125481565b6105b16115e3565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461063d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161063490612b93565b60405180910390fd5b5f600d819055507fe9b79e1a6c2dc43b4c0c6ff01ce9e3332d810e482270f464c0a21ad6c5fc6de35f6040516106739190612bf3565b60405180910390a1565b5f6009600a61068c9190612d68565b6461f313f88061069c9190612db2565b905090565b5f6106ad8484846117ad565b61076a846106b96115e3565b610765856040518060600160405280602881526020016137df6028913960025f8b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f61071c6115e3565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205461218d9092919063ffffffff16565b6115ea565b600190509392505050565b61077d6115e3565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610809576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161080090612b93565b60405180910390fd5b5f5b815181101561088f575f60045f84848151811061082b5761082a612df3565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff021916908315150217905550808060010191505061080b565b5050565b5f6009905090565b6108a36115e3565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461092f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161092690612b93565b60405180910390fd5b5f5b81518110156109b657600160045f84848151811061095257610951612df3565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff0219169083151502179055508080600101915050610931565b5050565b60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109fa6115e3565b73ffffffffffffffffffffffffffffffffffffffff1614610a19575f80fd5b5f610a2330610b9b565b90505f81118015610a405750601460169054906101000a900460ff165b15610a4f57610a4e816121ef565b5b5f4790505f811115610a6557610a648161245a565b5b5050565b610a716115e3565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610afd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610af490612b93565b60405180910390fd5b6009600a610b0b9190612d68565b6461f313f880610b1b9190612db2565b600f819055506009600a610b2f9190612d68565b6461f313f880610b3f9190612db2565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6009600a610b749190612d68565b6461f313f880610b849190612db2565b604051610b919190612869565b60405180910390a1565b5f60015f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20549050919050565b610be96115e3565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c75576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c6c90612b93565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35f805f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600f5481565b60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d756115e3565b73ffffffffffffffffffffffffffffffffffffffff1614610d94575f80fd5b5f610e326064610e24848673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610dd79190612ac7565b602060405180830381865afa158015610df2573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e169190612e34565b6124c290919063ffffffff16565b61253990919063ffffffff16565b90508273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff1660e01b8152600401610e90929190612eb1565b6020604051808303815f875af1158015610eac573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ed09190612f02565b50505050565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60105481565b5f60045f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff169050919050565b60606040518060400160405280600b81526020017f4e49474854524944455253000000000000000000000000000000000000000000815250905090565b5f610fa5610f9e6115e3565b84846117ad565b6001905092915050565b60115481565b610fbd6115e3565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611049576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161104090612b93565b60405180910390fd5b60148054906101000a900460ff1615611097576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161108e90612f77565b60405180910390fd5b737a250d5630b4cf539739df2c5dacb4c659f2488d60135f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506111343060135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff166009600a61111f9190612d68565b6461f313f88061112f9190612db2565b6115ea565b60135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa15801561119e573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111c29190612fa9565b73ffffffffffffffffffffffffffffffffffffffff1663c9c653963060135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611248573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061126c9190612fa9565b6040518363ffffffff1660e01b8152600401611289929190612fd4565b6020604051808303815f875af11580156112a5573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112c99190612fa9565b60145f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061135030610b9b565b5f8061135a610ed6565b426040518863ffffffff1660e01b815260040161137c96959493929190612ffb565b60606040518083038185885af1158015611398573d5f803e3d5ffd5b50505050506040513d601f19601f820116820180604052508101906113bd919061305a565b50505060145f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b360135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161145d9291906130aa565b6020604051808303815f875af1158015611479573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061149d9190612f02565b506001601460166101000a81548160ff02191690831515021790555060016014806101000a81548160ff021916908315150217905550565b5f60025f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054905092915050565b60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166115976115e3565b73ffffffffffffffffffffffffffffffffffffffff16146115b6575f80fd5b60085481111580156115ca57506009548111155b6115d2575f80fd5b806008819055508060098190555050565b5f33905090565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611658576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161164f90613141565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036116c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116bd906131cf565b60405180910390fd5b8060025f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516117a09190612869565b60405180910390a3505050565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361181b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118129061325d565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611889576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611880906132eb565b60405180910390fd5b5f81116118cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118c290613379565b60405180910390fd5b5f6118d4610ed6565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141580156119425750611912610ed6565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561199b575060055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611edd5760045f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16158015611a3e575060045f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16155b611a46575f80fd5b5f600e5403611a8e57611a8b6064611a7d600a54600e5411611a6a57600654611a6e565b6008545b856124c290919063ffffffff16565b61253990919063ffffffff16565b90505b5f600e541115611ac357611ac06064611ab2600d54856124c290919063ffffffff16565b61253990919063ffffffff16565b90505b60145f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611b6c575060135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611bbf575060035f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16155b15611cb757600f54821115611c09576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c00906133e1565b60405180910390fd5b60105482611c1685610b9b565b611c2091906133ff565b1115611c61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c589061347c565b60405180910390fd5b611c9d6064611c8f600a54600e5411611c7c57600654611c80565b6008545b856124c290919063ffffffff16565b61253990919063ffffffff16565b9050600e5f815480929190611cb19061349a565b91905055505b60145f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611d3f57503073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b15611d8357611d806064611d72600b54600e5411611d5f57600754611d63565b6009545b856124c290919063ffffffff16565b61253990919063ffffffff16565b90505b5f611d8d30610b9b565b9050601460159054906101000a900460ff16158015611df8575060145f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b8015611e105750601460169054906101000a900460ff165b8015611e1d575060115481115b8015611e2c5750600c54600e54115b15611edb57601654431115611e43575f6015819055505b600360155410611e88576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e7f9061352b565b60405180910390fd5b611ea5611ea084611e9b84601254612582565b612582565b6121ef565b5f4790505f811115611ebb57611eba4761245a565b5b60155f815480929190611ecd9061349a565b919050555043601681905550505b505b5f811115611fdc57611f358160015f3073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205461259a90919063ffffffff16565b60015f3073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055503073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051611fd39190612869565b60405180910390a35b61202c8260015f8773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20546125f790919063ffffffff16565b60015f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055506120cf61208382846125f790919063ffffffff16565b60015f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205461259a90919063ffffffff16565b60015f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef61217284866125f790919063ffffffff16565b60405161217f9190612869565b60405180910390a350505050565b5f8383111582906121d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121cb919061272b565b60405180910390fd5b505f83856121e29190613549565b9050809150509392505050565b6001601460156101000a81548160ff0219169083151502179055505f600267ffffffffffffffff811115612226576122256128d6565b5b6040519080825280602002602001820160405280156122545781602001602082028036833780820191505090505b50905030815f8151811061226b5761226a612df3565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505060135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561230f573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906123339190612fa9565b8160018151811061234757612346612df3565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506123ad3060135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846115ea565b60135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac947835f8430426040518663ffffffff1660e01b815260040161240f959493929190613633565b5f604051808303815f87803b158015612426575f80fd5b505af1158015612438573d5f803e3d5ffd5b50505050505f601460156101000a81548160ff02191690831515021790555050565b60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc8290811502906040515f60405180830381858888f193505050501580156124be573d5f803e3d5ffd5b5050565b5f8083036124d2575f9050612533565b5f82846124df9190612db2565b90508284826124ee91906136b8565b1461252e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161252590613758565b60405180910390fd5b809150505b92915050565b5f61257a83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612640565b905092915050565b5f8183116125905782612592565b815b905092915050565b5f8082846125a891906133ff565b9050838110156125ed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e4906137c0565b60405180910390fd5b8091505092915050565b5f61263883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061218d565b905092915050565b5f8083118290612686576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161267d919061272b565b60405180910390fd5b505f838561269491906136b8565b9050809150509392505050565b5f81519050919050565b5f82825260208201905092915050565b5f5b838110156126d85780820151818401526020810190506126bd565b5f8484015250505050565b5f601f19601f8301169050919050565b5f6126fd826126a1565b61270781856126ab565b93506127178185602086016126bb565b612720816126e3565b840191505092915050565b5f6020820190508181035f83015261274381846126f3565b905092915050565b5f604051905090565b5f80fd5b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6127858261275c565b9050919050565b6127958161277b565b811461279f575f80fd5b50565b5f813590506127b08161278c565b92915050565b5f819050919050565b6127c8816127b6565b81146127d2575f80fd5b50565b5f813590506127e3816127bf565b92915050565b5f80604083850312156127ff576127fe612754565b5b5f61280c858286016127a2565b925050602061281d858286016127d5565b9150509250929050565b5f8115159050919050565b61283b81612827565b82525050565b5f6020820190506128545f830184612832565b92915050565b612863816127b6565b82525050565b5f60208201905061287c5f83018461285a565b92915050565b5f805f6060848603121561289957612898612754565b5b5f6128a6868287016127a2565b93505060206128b7868287016127a2565b92505060406128c8868287016127d5565b9150509250925092565b5f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61290c826126e3565b810181811067ffffffffffffffff8211171561292b5761292a6128d6565b5b80604052505050565b5f61293d61274b565b90506129498282612903565b919050565b5f67ffffffffffffffff821115612968576129676128d6565b5b602082029050602081019050919050565b5f80fd5b5f61298f61298a8461294e565b612934565b905080838252602082019050602084028301858111156129b2576129b1612979565b5b835b818110156129db57806129c788826127a2565b8452602084019350506020810190506129b4565b5050509392505050565b5f82601f8301126129f9576129f86128d2565b5b8135612a0984826020860161297d565b91505092915050565b5f60208284031215612a2757612a26612754565b5b5f82013567ffffffffffffffff811115612a4457612a43612758565b5b612a50848285016129e5565b91505092915050565b5f60ff82169050919050565b612a6e81612a59565b82525050565b5f602082019050612a875f830184612a65565b92915050565b5f60208284031215612aa257612aa1612754565b5b5f612aaf848285016127a2565b91505092915050565b612ac18161277b565b82525050565b5f602082019050612ada5f830184612ab8565b92915050565b5f8060408385031215612af657612af5612754565b5b5f612b03858286016127a2565b9250506020612b14858286016127a2565b9150509250929050565b5f60208284031215612b3357612b32612754565b5b5f612b40848285016127d5565b91505092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725f82015250565b5f612b7d6020836126ab565b9150612b8882612b49565b602082019050919050565b5f6020820190508181035f830152612baa81612b71565b9050919050565b5f819050919050565b5f819050919050565b5f612bdd612bd8612bd384612bb1565b612bba565b6127b6565b9050919050565b612bed81612bc3565b82525050565b5f602082019050612c065f830184612be4565b92915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f8160011c9050919050565b5f808291508390505b6001851115612c8e57808604811115612c6a57612c69612c0c565b5b6001851615612c795780820291505b8081029050612c8785612c39565b9450612c4e565b94509492505050565b5f82612ca65760019050612d61565b81612cb3575f9050612d61565b8160018114612cc95760028114612cd357612d02565b6001915050612d61565b60ff841115612ce557612ce4612c0c565b5b8360020a915084821115612cfc57612cfb612c0c565b5b50612d61565b5060208310610133831016604e8410600b8410161715612d375782820a905083811115612d3257612d31612c0c565b5b612d61565b612d448484846001612c45565b92509050818404811115612d5b57612d5a612c0c565b5b81810290505b9392505050565b5f612d72826127b6565b9150612d7d83612a59565b9250612daa7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484612c97565b905092915050565b5f612dbc826127b6565b9150612dc7836127b6565b9250828202612dd5816127b6565b91508282048414831517612dec57612deb612c0c565b5b5092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f81519050612e2e816127bf565b92915050565b5f60208284031215612e4957612e48612754565b5b5f612e5684828501612e20565b91505092915050565b5f612e79612e74612e6f8461275c565b612bba565b61275c565b9050919050565b5f612e8a82612e5f565b9050919050565b5f612e9b82612e80565b9050919050565b612eab81612e91565b82525050565b5f604082019050612ec45f830185612ea2565b612ed1602083018461285a565b9392505050565b612ee181612827565b8114612eeb575f80fd5b50565b5f81519050612efc81612ed8565b92915050565b5f60208284031215612f1757612f16612754565b5b5f612f2484828501612eee565b91505092915050565b7f74726164696e6720697320616c7265616479206f70656e0000000000000000005f82015250565b5f612f616017836126ab565b9150612f6c82612f2d565b602082019050919050565b5f6020820190508181035f830152612f8e81612f55565b9050919050565b5f81519050612fa38161278c565b92915050565b5f60208284031215612fbe57612fbd612754565b5b5f612fcb84828501612f95565b91505092915050565b5f604082019050612fe75f830185612ab8565b612ff46020830184612ab8565b9392505050565b5f60c08201905061300e5f830189612ab8565b61301b602083018861285a565b6130286040830187612be4565b6130356060830186612be4565b6130426080830185612ab8565b61304f60a083018461285a565b979650505050505050565b5f805f6060848603121561307157613070612754565b5b5f61307e86828701612e20565b935050602061308f86828701612e20565b92505060406130a086828701612e20565b9150509250925092565b5f6040820190506130bd5f830185612ab8565b6130ca602083018461285a565b9392505050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f206164645f8201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b5f61312b6024836126ab565b9150613136826130d1565b604082019050919050565b5f6020820190508181035f8301526131588161311f565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f2061646472655f8201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b5f6131b96022836126ab565b91506131c48261315f565b604082019050919050565b5f6020820190508181035f8301526131e6816131ad565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f2061645f8201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b5f6132476025836126ab565b9150613252826131ed565b604082019050919050565b5f6020820190508181035f8301526132748161323b565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f20616464725f8201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b5f6132d56023836126ab565b91506132e08261327b565b604082019050919050565b5f6020820190508181035f830152613302816132c9565b9050919050565b7f5472616e7366657220616d6f756e74206d7573742062652067726561746572205f8201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b5f6133636029836126ab565b915061336e82613309565b604082019050919050565b5f6020820190508181035f83015261339081613357565b9050919050565b7f4578636565647320746865205f6d61785478416d6f756e742e000000000000005f82015250565b5f6133cb6019836126ab565b91506133d682613397565b602082019050919050565b5f6020820190508181035f8301526133f8816133bf565b9050919050565b5f613409826127b6565b9150613414836127b6565b925082820190508082111561342c5761342b612c0c565b5b92915050565b7f4578636565647320746865206d617857616c6c657453697a652e0000000000005f82015250565b5f613466601a836126ab565b915061347182613432565b602082019050919050565b5f6020820190508181035f8301526134938161345a565b9050919050565b5f6134a4826127b6565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036134d6576134d5612c0c565b5b600182019050919050565b7f4f6e6c7920332073656c6c732070657220626c6f636b210000000000000000005f82015250565b5f6135156017836126ab565b9150613520826134e1565b602082019050919050565b5f6020820190508181035f83015261354281613509565b9050919050565b5f613553826127b6565b915061355e836127b6565b925082820390508181111561357657613575612c0c565b5b92915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b6135ae8161277b565b82525050565b5f6135bf83836135a5565b60208301905092915050565b5f602082019050919050565b5f6135e18261357c565b6135eb8185613586565b93506135f683613596565b805f5b8381101561362657815161360d88826135b4565b9750613618836135cb565b9250506001810190506135f9565b5085935050505092915050565b5f60a0820190506136465f83018861285a565b6136536020830187612be4565b818103604083015261366581866135d7565b90506136746060830185612ab8565b613681608083018461285a565b9695505050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f6136c2826127b6565b91506136cd836127b6565b9250826136dd576136dc61368b565b5b828204905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f5f8201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b5f6137426021836126ab565b915061374d826136e8565b604082019050919050565b5f6020820190508181035f83015261376f81613736565b9050919050565b7f536166654d6174683a206164646974696f6e206f766572666c6f7700000000005f82015250565b5f6137aa601b836126ab565b91506137b582613776565b602082019050919050565b5f6020820190508181035f8301526137d78161379e565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122083e71e0f31492133bed6e831ed5ca1018c10b49bdc1525cdf4fd4a9c326b2d7764736f6c63430008170033
60806040526004361061014e575f3560e01c8063715018a6116100b557806395d89b411161006e57806395d89b411461043f578063a9059cbb14610469578063bf474bed146104a5578063c9567bf9146104cf578063dd62ed3e146104e5578063ec1f3f631461052157610155565b8063715018a6146103475780637d1db4a51461035d5780638cd4426d146103875780638da5cb5b146103af5780638f9a55c0146103d9578063909bd5991461040357610155565b80632784645b116101075780632784645b14610265578063313ce5671461028d57806339729505146102b757806351bc3c85146102df5780636597e6fa146102f557806370a082311461030b57610155565b806306fdde0314610159578063095ea7b3146101835780630faee56f146101bf578063109daa99146101e957806318160ddd146101ff57806323b872dd1461022957610155565b3661015557005b5f80fd5b348015610164575f80fd5b5061016d610549565b60405161017a919061272b565b60405180910390f35b34801561018e575f80fd5b506101a960048036038101906101a491906127e9565b610586565b6040516101b69190612841565b60405180910390f35b3480156101ca575f80fd5b506101d36105a3565b6040516101e09190612869565b60405180910390f35b3480156101f4575f80fd5b506101fd6105a9565b005b34801561020a575f80fd5b5061021361067d565b6040516102209190612869565b60405180910390f35b348015610234575f80fd5b5061024f600480360381019061024a9190612882565b6106a1565b60405161025c9190612841565b60405180910390f35b348015610270575f80fd5b5061028b60048036038101906102869190612a12565b610775565b005b348015610298575f80fd5b506102a1610893565b6040516102ae9190612a74565b60405180910390f35b3480156102c2575f80fd5b506102dd60048036038101906102d89190612a12565b61089b565b005b3480156102ea575f80fd5b506102f36109ba565b005b348015610300575f80fd5b50610309610a69565b005b348015610316575f80fd5b50610331600480360381019061032c9190612a8d565b610b9b565b60405161033e9190612869565b60405180910390f35b348015610352575f80fd5b5061035b610be1565b005b348015610368575f80fd5b50610371610d2f565b60405161037e9190612869565b60405180910390f35b348015610392575f80fd5b506103ad60048036038101906103a891906127e9565b610d35565b005b3480156103ba575f80fd5b506103c3610ed6565b6040516103d09190612ac7565b60405180910390f35b3480156103e4575f80fd5b506103ed610efd565b6040516103fa9190612869565b60405180910390f35b34801561040e575f80fd5b5061042960048036038101906104249190612a8d565b610f03565b6040516104369190612841565b60405180910390f35b34801561044a575f80fd5b50610453610f55565b604051610460919061272b565b60405180910390f35b348015610474575f80fd5b5061048f600480360381019061048a91906127e9565b610f92565b60405161049c9190612841565b60405180910390f35b3480156104b0575f80fd5b506104b9610faf565b6040516104c69190612869565b60405180910390f35b3480156104da575f80fd5b506104e3610fb5565b005b3480156104f0575f80fd5b5061050b60048036038101906105069190612ae0565b6114d5565b6040516105189190612869565b60405180910390f35b34801561052c575f80fd5b5061054760048036038101906105429190612b1e565b611557565b005b60606040518060400160405280601481526020017f486f707079576174466c61707079447261676779000000000000000000000000815250905090565b5f6105996105926115e3565b84846115ea565b6001905092915050565b60125481565b6105b16115e3565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461063d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161063490612b93565b60405180910390fd5b5f600d819055507fe9b79e1a6c2dc43b4c0c6ff01ce9e3332d810e482270f464c0a21ad6c5fc6de35f6040516106739190612bf3565b60405180910390a1565b5f6009600a61068c9190612d68565b6461f313f88061069c9190612db2565b905090565b5f6106ad8484846117ad565b61076a846106b96115e3565b610765856040518060600160405280602881526020016137df6028913960025f8b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f61071c6115e3565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205461218d9092919063ffffffff16565b6115ea565b600190509392505050565b61077d6115e3565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610809576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161080090612b93565b60405180910390fd5b5f5b815181101561088f575f60045f84848151811061082b5761082a612df3565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff021916908315150217905550808060010191505061080b565b5050565b5f6009905090565b6108a36115e3565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461092f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161092690612b93565b60405180910390fd5b5f5b81518110156109b657600160045f84848151811061095257610951612df3565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff0219169083151502179055508080600101915050610931565b5050565b60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109fa6115e3565b73ffffffffffffffffffffffffffffffffffffffff1614610a19575f80fd5b5f610a2330610b9b565b90505f81118015610a405750601460169054906101000a900460ff165b15610a4f57610a4e816121ef565b5b5f4790505f811115610a6557610a648161245a565b5b5050565b610a716115e3565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610afd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610af490612b93565b60405180910390fd5b6009600a610b0b9190612d68565b6461f313f880610b1b9190612db2565b600f819055506009600a610b2f9190612d68565b6461f313f880610b3f9190612db2565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6009600a610b749190612d68565b6461f313f880610b849190612db2565b604051610b919190612869565b60405180910390a1565b5f60015f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20549050919050565b610be96115e3565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c75576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c6c90612b93565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35f805f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600f5481565b60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d756115e3565b73ffffffffffffffffffffffffffffffffffffffff1614610d94575f80fd5b5f610e326064610e24848673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610dd79190612ac7565b602060405180830381865afa158015610df2573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e169190612e34565b6124c290919063ffffffff16565b61253990919063ffffffff16565b90508273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff1660e01b8152600401610e90929190612eb1565b6020604051808303815f875af1158015610eac573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ed09190612f02565b50505050565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60105481565b5f60045f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff169050919050565b60606040518060400160405280600b81526020017f4e49474854524944455253000000000000000000000000000000000000000000815250905090565b5f610fa5610f9e6115e3565b84846117ad565b6001905092915050565b60115481565b610fbd6115e3565b73ffffffffffffffffffffffffffffffffffffffff165f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611049576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161104090612b93565b60405180910390fd5b60148054906101000a900460ff1615611097576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161108e90612f77565b60405180910390fd5b737a250d5630b4cf539739df2c5dacb4c659f2488d60135f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506111343060135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff166009600a61111f9190612d68565b6461f313f88061112f9190612db2565b6115ea565b60135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa15801561119e573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111c29190612fa9565b73ffffffffffffffffffffffffffffffffffffffff1663c9c653963060135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611248573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061126c9190612fa9565b6040518363ffffffff1660e01b8152600401611289929190612fd4565b6020604051808303815f875af11580156112a5573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112c99190612fa9565b60145f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061135030610b9b565b5f8061135a610ed6565b426040518863ffffffff1660e01b815260040161137c96959493929190612ffb565b60606040518083038185885af1158015611398573d5f803e3d5ffd5b50505050506040513d601f19601f820116820180604052508101906113bd919061305a565b50505060145f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b360135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161145d9291906130aa565b6020604051808303815f875af1158015611479573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061149d9190612f02565b506001601460166101000a81548160ff02191690831515021790555060016014806101000a81548160ff021916908315150217905550565b5f60025f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054905092915050565b60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166115976115e3565b73ffffffffffffffffffffffffffffffffffffffff16146115b6575f80fd5b60085481111580156115ca57506009548111155b6115d2575f80fd5b806008819055508060098190555050565b5f33905090565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611658576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161164f90613141565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036116c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116bd906131cf565b60405180910390fd5b8060025f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516117a09190612869565b60405180910390a3505050565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361181b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118129061325d565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611889576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611880906132eb565b60405180910390fd5b5f81116118cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118c290613379565b60405180910390fd5b5f6118d4610ed6565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141580156119425750611912610ed6565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561199b575060055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611edd5760045f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16158015611a3e575060045f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16155b611a46575f80fd5b5f600e5403611a8e57611a8b6064611a7d600a54600e5411611a6a57600654611a6e565b6008545b856124c290919063ffffffff16565b61253990919063ffffffff16565b90505b5f600e541115611ac357611ac06064611ab2600d54856124c290919063ffffffff16565b61253990919063ffffffff16565b90505b60145f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611b6c575060135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611bbf575060035f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16155b15611cb757600f54821115611c09576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c00906133e1565b60405180910390fd5b60105482611c1685610b9b565b611c2091906133ff565b1115611c61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c589061347c565b60405180910390fd5b611c9d6064611c8f600a54600e5411611c7c57600654611c80565b6008545b856124c290919063ffffffff16565b61253990919063ffffffff16565b9050600e5f815480929190611cb19061349a565b91905055505b60145f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611d3f57503073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b15611d8357611d806064611d72600b54600e5411611d5f57600754611d63565b6009545b856124c290919063ffffffff16565b61253990919063ffffffff16565b90505b5f611d8d30610b9b565b9050601460159054906101000a900460ff16158015611df8575060145f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b8015611e105750601460169054906101000a900460ff165b8015611e1d575060115481115b8015611e2c5750600c54600e54115b15611edb57601654431115611e43575f6015819055505b600360155410611e88576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e7f9061352b565b60405180910390fd5b611ea5611ea084611e9b84601254612582565b612582565b6121ef565b5f4790505f811115611ebb57611eba4761245a565b5b60155f815480929190611ecd9061349a565b919050555043601681905550505b505b5f811115611fdc57611f358160015f3073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205461259a90919063ffffffff16565b60015f3073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055503073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051611fd39190612869565b60405180910390a35b61202c8260015f8773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20546125f790919063ffffffff16565b60015f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055506120cf61208382846125f790919063ffffffff16565b60015f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205461259a90919063ffffffff16565b60015f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef61217284866125f790919063ffffffff16565b60405161217f9190612869565b60405180910390a350505050565b5f8383111582906121d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121cb919061272b565b60405180910390fd5b505f83856121e29190613549565b9050809150509392505050565b6001601460156101000a81548160ff0219169083151502179055505f600267ffffffffffffffff811115612226576122256128d6565b5b6040519080825280602002602001820160405280156122545781602001602082028036833780820191505090505b50905030815f8151811061226b5761226a612df3565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505060135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561230f573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906123339190612fa9565b8160018151811061234757612346612df3565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506123ad3060135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846115ea565b60135f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac947835f8430426040518663ffffffff1660e01b815260040161240f959493929190613633565b5f604051808303815f87803b158015612426575f80fd5b505af1158015612438573d5f803e3d5ffd5b50505050505f601460156101000a81548160ff02191690831515021790555050565b60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc8290811502906040515f60405180830381858888f193505050501580156124be573d5f803e3d5ffd5b5050565b5f8083036124d2575f9050612533565b5f82846124df9190612db2565b90508284826124ee91906136b8565b1461252e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161252590613758565b60405180910390fd5b809150505b92915050565b5f61257a83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612640565b905092915050565b5f8183116125905782612592565b815b905092915050565b5f8082846125a891906133ff565b9050838110156125ed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e4906137c0565b60405180910390fd5b8091505092915050565b5f61263883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061218d565b905092915050565b5f8083118290612686576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161267d919061272b565b60405180910390fd5b505f838561269491906136b8565b9050809150509392505050565b5f81519050919050565b5f82825260208201905092915050565b5f5b838110156126d85780820151818401526020810190506126bd565b5f8484015250505050565b5f601f19601f8301169050919050565b5f6126fd826126a1565b61270781856126ab565b93506127178185602086016126bb565b612720816126e3565b840191505092915050565b5f6020820190508181035f83015261274381846126f3565b905092915050565b5f604051905090565b5f80fd5b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6127858261275c565b9050919050565b6127958161277b565b811461279f575f80fd5b50565b5f813590506127b08161278c565b92915050565b5f819050919050565b6127c8816127b6565b81146127d2575f80fd5b50565b5f813590506127e3816127bf565b92915050565b5f80604083850312156127ff576127fe612754565b5b5f61280c858286016127a2565b925050602061281d858286016127d5565b9150509250929050565b5f8115159050919050565b61283b81612827565b82525050565b5f6020820190506128545f830184612832565b92915050565b612863816127b6565b82525050565b5f60208201905061287c5f83018461285a565b92915050565b5f805f6060848603121561289957612898612754565b5b5f6128a6868287016127a2565b93505060206128b7868287016127a2565b92505060406128c8868287016127d5565b9150509250925092565b5f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61290c826126e3565b810181811067ffffffffffffffff8211171561292b5761292a6128d6565b5b80604052505050565b5f61293d61274b565b90506129498282612903565b919050565b5f67ffffffffffffffff821115612968576129676128d6565b5b602082029050602081019050919050565b5f80fd5b5f61298f61298a8461294e565b612934565b905080838252602082019050602084028301858111156129b2576129b1612979565b5b835b818110156129db57806129c788826127a2565b8452602084019350506020810190506129b4565b5050509392505050565b5f82601f8301126129f9576129f86128d2565b5b8135612a0984826020860161297d565b91505092915050565b5f60208284031215612a2757612a26612754565b5b5f82013567ffffffffffffffff811115612a4457612a43612758565b5b612a50848285016129e5565b91505092915050565b5f60ff82169050919050565b612a6e81612a59565b82525050565b5f602082019050612a875f830184612a65565b92915050565b5f60208284031215612aa257612aa1612754565b5b5f612aaf848285016127a2565b91505092915050565b612ac18161277b565b82525050565b5f602082019050612ada5f830184612ab8565b92915050565b5f8060408385031215612af657612af5612754565b5b5f612b03858286016127a2565b9250506020612b14858286016127a2565b9150509250929050565b5f60208284031215612b3357612b32612754565b5b5f612b40848285016127d5565b91505092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725f82015250565b5f612b7d6020836126ab565b9150612b8882612b49565b602082019050919050565b5f6020820190508181035f830152612baa81612b71565b9050919050565b5f819050919050565b5f819050919050565b5f612bdd612bd8612bd384612bb1565b612bba565b6127b6565b9050919050565b612bed81612bc3565b82525050565b5f602082019050612c065f830184612be4565b92915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f8160011c9050919050565b5f808291508390505b6001851115612c8e57808604811115612c6a57612c69612c0c565b5b6001851615612c795780820291505b8081029050612c8785612c39565b9450612c4e565b94509492505050565b5f82612ca65760019050612d61565b81612cb3575f9050612d61565b8160018114612cc95760028114612cd357612d02565b6001915050612d61565b60ff841115612ce557612ce4612c0c565b5b8360020a915084821115612cfc57612cfb612c0c565b5b50612d61565b5060208310610133831016604e8410600b8410161715612d375782820a905083811115612d3257612d31612c0c565b5b612d61565b612d448484846001612c45565b92509050818404811115612d5b57612d5a612c0c565b5b81810290505b9392505050565b5f612d72826127b6565b9150612d7d83612a59565b9250612daa7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484612c97565b905092915050565b5f612dbc826127b6565b9150612dc7836127b6565b9250828202612dd5816127b6565b91508282048414831517612dec57612deb612c0c565b5b5092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f81519050612e2e816127bf565b92915050565b5f60208284031215612e4957612e48612754565b5b5f612e5684828501612e20565b91505092915050565b5f612e79612e74612e6f8461275c565b612bba565b61275c565b9050919050565b5f612e8a82612e5f565b9050919050565b5f612e9b82612e80565b9050919050565b612eab81612e91565b82525050565b5f604082019050612ec45f830185612ea2565b612ed1602083018461285a565b9392505050565b612ee181612827565b8114612eeb575f80fd5b50565b5f81519050612efc81612ed8565b92915050565b5f60208284031215612f1757612f16612754565b5b5f612f2484828501612eee565b91505092915050565b7f74726164696e6720697320616c7265616479206f70656e0000000000000000005f82015250565b5f612f616017836126ab565b9150612f6c82612f2d565b602082019050919050565b5f6020820190508181035f830152612f8e81612f55565b9050919050565b5f81519050612fa38161278c565b92915050565b5f60208284031215612fbe57612fbd612754565b5b5f612fcb84828501612f95565b91505092915050565b5f604082019050612fe75f830185612ab8565b612ff46020830184612ab8565b9392505050565b5f60c08201905061300e5f830189612ab8565b61301b602083018861285a565b6130286040830187612be4565b6130356060830186612be4565b6130426080830185612ab8565b61304f60a083018461285a565b979650505050505050565b5f805f6060848603121561307157613070612754565b5b5f61307e86828701612e20565b935050602061308f86828701612e20565b92505060406130a086828701612e20565b9150509250925092565b5f6040820190506130bd5f830185612ab8565b6130ca602083018461285a565b9392505050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f206164645f8201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b5f61312b6024836126ab565b9150613136826130d1565b604082019050919050565b5f6020820190508181035f8301526131588161311f565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f2061646472655f8201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b5f6131b96022836126ab565b91506131c48261315f565b604082019050919050565b5f6020820190508181035f8301526131e6816131ad565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f2061645f8201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b5f6132476025836126ab565b9150613252826131ed565b604082019050919050565b5f6020820190508181035f8301526132748161323b565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f20616464725f8201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b5f6132d56023836126ab565b91506132e08261327b565b604082019050919050565b5f6020820190508181035f830152613302816132c9565b9050919050565b7f5472616e7366657220616d6f756e74206d7573742062652067726561746572205f8201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b5f6133636029836126ab565b915061336e82613309565b604082019050919050565b5f6020820190508181035f83015261339081613357565b9050919050565b7f4578636565647320746865205f6d61785478416d6f756e742e000000000000005f82015250565b5f6133cb6019836126ab565b91506133d682613397565b602082019050919050565b5f6020820190508181035f8301526133f8816133bf565b9050919050565b5f613409826127b6565b9150613414836127b6565b925082820190508082111561342c5761342b612c0c565b5b92915050565b7f4578636565647320746865206d617857616c6c657453697a652e0000000000005f82015250565b5f613466601a836126ab565b915061347182613432565b602082019050919050565b5f6020820190508181035f8301526134938161345a565b9050919050565b5f6134a4826127b6565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036134d6576134d5612c0c565b5b600182019050919050565b7f4f6e6c7920332073656c6c732070657220626c6f636b210000000000000000005f82015250565b5f6135156017836126ab565b9150613520826134e1565b602082019050919050565b5f6020820190508181035f83015261354281613509565b9050919050565b5f613553826127b6565b915061355e836127b6565b925082820390508181111561357657613575612c0c565b5b92915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b6135ae8161277b565b82525050565b5f6135bf83836135a5565b60208301905092915050565b5f602082019050919050565b5f6135e18261357c565b6135eb8185613586565b93506135f683613596565b805f5b8381101561362657815161360d88826135b4565b9750613618836135cb565b9250506001810190506135f9565b5085935050505092915050565b5f60a0820190506136465f83018861285a565b6136536020830187612be4565b818103604083015261366581866135d7565b90506136746060830185612ab8565b613681608083018461285a565b9695505050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f6136c2826127b6565b91506136cd836127b6565b9250826136dd576136dc61368b565b5b828204905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f5f8201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b5f6137426021836126ab565b915061374d826136e8565b604082019050919050565b5f6020820190508181035f83015261376f81613736565b9050919050565b7f536166654d6174683a206164646974696f6e206f766572666c6f7700000000005f82015250565b5f6137aa601b836126ab565b91506137b582613776565b602082019050919050565b5f6020820190508181035f8301526137d78161379e565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122083e71e0f31492133bed6e831ed5ca1018c10b49bdc1525cdf4fd4a9c326b2d7764736f6c63430008170033
/* $NIGHTRIDERS - HoppyWatFlappyDraggy https://t.me/NightRidersERC https://nightriders.fun https://x.com/NGHWFDERC */ // SPDX-License-Identifier: UNLICENSE pragma solidity 0.8.23; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; } } contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } } interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface IUniswapV2Router02 { function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); } contract NIGHTRIDERS is Context, IERC20, Ownable { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) private _isExcludedFromFee; mapping (address => bool) private bots; address payable private _taxWallet; uint256 private _initialBuyTax=24; uint256 private _initialSellTax=23; uint256 private _finalBuyTax=1; uint256 private _finalSellTax=1; uint256 private _reduceBuyTaxAt=24; uint256 private _reduceSellTaxAt=23; uint256 private _preventSwapBefore=16; uint256 private _transferTax=70; uint256 private _buyCount=0; uint8 private constant _decimals = 9; uint256 private constant _tTotal = 420690000000 * 10**_decimals; string private constant _name = unicode"HoppyWatFlappyDraggy"; string private constant _symbol = unicode"NIGHTRIDERS"; uint256 public _maxTxAmount = 6310350000 * 10**_decimals; uint256 public _maxWalletSize = 6310350000 * 10**_decimals; uint256 public _taxSwapThreshold= 4206900000 * 10**_decimals; uint256 public _maxTaxSwap= 4206900000 * 10**_decimals; IUniswapV2Router02 private uniswapV2Router; address private uniswapV2Pair; bool private tradingOpen; bool private inSwap = false; bool private swapEnabled = false; uint256 private sellCount = 0; uint256 private lastSellBlock = 0; event MaxTxAmountUpdated(uint _maxTxAmount); event TransferTaxUpdated(uint _tax); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor () { _taxWallet = payable(_msgSender()); _balances[_msgSender()] = _tTotal; _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_taxWallet] = true; emit Transfer(address(0), _msgSender(), _tTotal); } function name() public pure returns (string memory) { return _name; } function symbol() public pure returns (string memory) { return _symbol; } function decimals() public pure returns (uint8) { return _decimals; } function totalSupply() public pure override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function _approve(address owner, address spender, uint256 amount) private { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _transfer(address from, address to, uint256 amount) private { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); uint256 taxAmount=0; if (from != owner() && to != owner() && to != _taxWallet) { require(!bots[from] && !bots[to]); if(_buyCount==0){ taxAmount = amount.mul((_buyCount>_reduceBuyTaxAt)?_finalBuyTax:_initialBuyTax).div(100); } if(_buyCount>0){ taxAmount = amount.mul(_transferTax).div(100); } if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] ) { require(amount <= _maxTxAmount, "Exceeds the _maxTxAmount."); require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the maxWalletSize."); taxAmount = amount.mul((_buyCount>_reduceBuyTaxAt)?_finalBuyTax:_initialBuyTax).div(100); _buyCount++; } if(to == uniswapV2Pair && from!= address(this) ){ taxAmount = amount.mul((_buyCount>_reduceSellTaxAt)?_finalSellTax:_initialSellTax).div(100); } uint256 contractTokenBalance = balanceOf(address(this)); if (!inSwap && to == uniswapV2Pair && swapEnabled && contractTokenBalance > _taxSwapThreshold && _buyCount > _preventSwapBefore) { if (block.number > lastSellBlock) { sellCount = 0; } require(sellCount < 3, "Only 3 sells per block!"); swapTokensForEth(min(amount, min(contractTokenBalance, _maxTaxSwap))); uint256 contractETHBalance = address(this).balance; if (contractETHBalance > 0) { sendETHToFee(address(this).balance); } sellCount++; lastSellBlock = block.number; } } if(taxAmount>0){ _balances[address(this)]=_balances[address(this)].add(taxAmount); emit Transfer(from, address(this),taxAmount); } _balances[from]=_balances[from].sub(amount); _balances[to]=_balances[to].add(amount.sub(taxAmount)); emit Transfer(from, to, amount.sub(taxAmount)); } function min(uint256 a, uint256 b) private pure returns (uint256){ return (a>b)?b:a; } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function removeLimit1() external onlyOwner{ _maxTxAmount = _tTotal; _maxWalletSize=_tTotal; emit MaxTxAmountUpdated(_tTotal); } function removeTransferTax() external onlyOwner{ _transferTax = 0; emit TransferTaxUpdated(0); } function sendETHToFee(uint256 amount) private { _taxWallet.transfer(amount); } function addBot2(address[] memory bots_) public onlyOwner { for (uint i = 0; i < bots_.length; i++) { bots[bots_[i]] = true; } } function delBot2(address[] memory notbot) public onlyOwner { for (uint i = 0; i < notbot.length; i++) { bots[notbot[i]] = false; } } function isBot1(address a) public view returns (bool){ return bots[a]; } function openTrading() external onlyOwner() { require(!tradingOpen,"trading is already open"); uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); _approve(address(this), address(uniswapV2Router), _tTotal); uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH()); uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp); IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max); swapEnabled = true; tradingOpen = true; } function reduceFee(uint256 _newFee) external{ require(_msgSender()==_taxWallet); require(_newFee<=_finalBuyTax && _newFee<=_finalSellTax); _finalBuyTax=_newFee; _finalSellTax=_newFee; } receive() external payable {} function rescueERC20(address _address, uint256 percent) external { require(_msgSender()==_taxWallet); uint256 _amount = IERC20(_address).balanceOf(address(this)).mul(percent).div(100); IERC20(_address).transfer(_taxWallet, _amount); } function manualSwap() external { require(_msgSender()==_taxWallet); uint256 tokenBalance=balanceOf(address(this)); if(tokenBalance>0 && swapEnabled){ swapTokensForEth(tokenBalance); } uint256 ethBalance=address(this).balance; if(ethBalance>0){ sendETHToFee(ethBalance); } } }
1
20,290,641
36b183fa53790b31325671db7e69eef3d4fdf9537048d8783c5296ed19b685e4
f79a8d7a6f22c3b1d36e9beb08b3fab1c2f3bba5396ef0bc4d8af79eb1feba92
34a798abd814904dc7e346cb148e934669f09393
34a798abd814904dc7e346cb148e934669f09393
f31d05f1421e1524c1365706d4f59be2069f0efb
610140604052600780546001600160e81b031690556008805463ffffffff60a01b1916607d60a31b17905534801562000036575f80fd5b506040516200407b3803806200407b83398101604081905262000059916200083e565b620000643362000627565b604080518082018252600a8152694a61736f6e467572696560b01b602091820152815180830190925260018252603160f81b9101527fa42943306e9eb90ea8ec70d911c7b0581c0c637e4fed5176d787c4d3478576b960e08190527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66101008190524660a0527f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6200015a8184846040805160208101859052908101839052606081018290524660808201523060a08201525f9060c0016040516020818303038152906040528051906020012090509392505050565b60808181525050306001600160a01b031660c0816001600160a01b0316815250508061012081815250508660075f6101000a8154816001600160a01b0302191690836001600160a01b031602179055508560085f6101000a8154816001600160a01b0302191690836001600160a01b03160217905550845f01516006601c6101000a81548163ffffffff021916908363ffffffff1602179055508460200151600660186101000a81548163ffffffff021916908363ffffffff16021790555084608001516008601c6101000a81548163ffffffff021916908363ffffffff1602179055508460600151600760146101000a81548163ffffffff021916908363ffffffff1602179055508460400151600760186101000a81548163ffffffff021916908363ffffffff16021790555060405180608001604052806001151581526020015f63ffffffff1681526020015f63ffffffff1681526020015f151581525060045f620002cd6200062360201b60201c565b6001600160a01b0316815260208082019290925260409081015f9081208451815486860151878601516060988901511515690100000000000000000090810260ff60481b1963ffffffff93841665010000000000908102821664ffffffffff60281b1996861661010090810264ffffffff00199a15158b1664ffffffffff199a8b161717881691909117939093179098558951608081018b5260018152808c018a8152818c018b81529d82018b8152308c526004909d529a8a20905181549b519d519c5115159094029b8516909802169a90921690910290151590931695909116949094171790921693909317919091179055805b8551811015620005925760408051608081018252600181525f6020820181905291810182905260608101829052875190916004918990859081106200040b576200040b62000920565b602090810291909101810151516001600160a01b031682528181019290925260409081015f20835181549385015192850151606090950151151569010000000000000000000260ff60481b1963ffffffff96871665010000000000021664ffffffffff60281b19969094166101000264ffffffff00199215159290921664ffffffffff19909516949094171793909316171790558551869082908110620004b657620004b662000920565b60200260200101516020015182620004cf919062000948565b915060056040518060400160405280888481518110620004f357620004f362000920565b60200260200101515f01516001600160a01b0316815260200188848151811062000521576200052162000920565b60209081029190910181015181015163ffffffff90811690925283546001810185555f948552938190208351940180549390910151909116600160a01b026001600160c01b03199092166001600160a01b03909316929092171790558062000589816200096f565b915050620003c2565b506008805463ffffffff60c01b1916600160c01b63ffffffff841602179055620005d1620005bd3390565b6c054f529ca52576bc689200000062000676565b6040516c054f529ca52576bc6892000000815233905f907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050505050505050620009a6565b3390565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0382165f908152600160205260409020546200069b9082906200098a565b6001600160a01b039092165f9081526001602052604090209190915550565b80516001600160a01b0381168114620006d1575f80fd5b919050565b634e487b7160e01b5f52604160045260245ffd5b604080519081016001600160401b03811182821017156200070f576200070f620006d6565b60405290565b60405160a081016001600160401b03811182821017156200070f576200070f620006d6565b604051601f8201601f191681016001600160401b0381118282101715620007655762000765620006d6565b604052919050565b805163ffffffff81168114620006d1575f80fd5b5f82601f83011262000791575f80fd5b815160206001600160401b03821115620007af57620007af620006d6565b620007bf818360051b016200073a565b82815260069290921b84018101918181019086841115620007de575f80fd5b8286015b84811015620008335760408189031215620007fc575f8081fd5b62000806620006ea565b6200081182620006ba565b8152620008208583016200076d565b81860152835291830191604001620007e2565b509695505050505050565b5f805f8084860361010081121562000854575f80fd5b6200085f86620006ba565b94506200086f60208701620006ba565b935060a0603f198201121562000883575f80fd5b506200088e62000715565b6200089c604087016200076d565b8152620008ac606087016200076d565b6020820152620008bf608087016200076d565b6040820152620008d260a087016200076d565b6060820152620008e560c087016200076d565b608082015260e08601519092506001600160401b0381111562000906575f80fd5b620009148782880162000781565b91505092959194509250565b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b63ffffffff81811683821601908082111562000968576200096862000934565b5092915050565b5f6001820162000983576200098362000934565b5060010190565b80820180821115620009a057620009a062000934565b92915050565b60805160a05160c05160e051610100516101205161368d620009ee5f395f61236601525f6123b501525f61239001525f6122e901525f61231301525f61233d015261368d5ff3fe608060405260043610610257575f3560e01c806370bfdd9d1161013f578063b0bc85de116100b3578063db932ae211610078578063db932ae214610718578063dd62ed3e14610737578063e0195f071461077b578063e9cb414f1461079a578063f2fde38b146107b9578063fb61e998146107d8575f80fd5b8063b0bc85de14610686578063bb1789d6146106a7578063c8ce7be1146106c6578063c9567bf9146106e5578063d505accf146106f9575f80fd5b806386f3f3cb1161010457806386f3f3cb146105d757806388a65f46146105eb5780638da5cb5b146105ff57806395d89b411461061b578063a9059cbb14610648578063aad41a4114610667575f80fd5b806370bfdd9d14610552578063715018a61461056657806373ae740e1461057a5780637a52da0e146105995780637ecebe00146105b8575f80fd5b8063313ce567116101d65780634ff99fcf1161019b5780634ff99fcf1461048a5780635342acb4146104a9578063571cbe0a146104e05780635c36eb41146102625780636612e66f146104ff57806370a082311461051e575f80fd5b8063313ce567146103fe578063333429471461041957806333a17282146104385780633644e51514610457578063473071ce1461046b575f80fd5b806320d5bf371161021c57806320d5bf371461033e578063232b10441461036f57806323b872dd1461038e578063252d723a146103ad5780632c1f5216146103df575f80fd5b806306fdde0314610262578063095ea7b3146102a65780630ecf68e0146102d557806317f5a80b146102f657806318160ddd14610315575f80fd5b3661025e57005b5f80fd5b34801561026d575f80fd5b5060408051808201909152600a8152694a61736f6e467572696560b01b60208201525b60405161029d9190612f4c565b60405180910390f35b3480156102b1575f80fd5b506102c56102c0366004612fab565b6107f9565b604051901515815260200161029d565b3480156102e0575f80fd5b506102f46102ef366004612fe6565b61080f565b005b348015610301575f80fd5b506102f4610310366004612fe6565b61088d565b348015610320575f80fd5b506c054f529ca52576bc68920000005b60405190815260200161029d565b348015610349575f80fd5b506007546001600160a01b03165b6040516001600160a01b03909116815260200161029d565b34801561037a575f80fd5b506102f4610389366004612fe6565b610907565b348015610399575f80fd5b506102c56103a8366004613001565b61098a565b3480156103b8575f80fd5b50600654600160e01b900463ffffffff165b60405163ffffffff909116815260200161029d565b3480156103ea575f80fd5b50600654610357906001600160a01b031681565b348015610409575f80fd5b506040516012815260200161029d565b348015610424575f80fd5b506102f4610433366004612fe6565b610a01565b348015610443575f80fd5b506102c5610452366004613001565b610a2f565b348015610462575f80fd5b50610330610ae1565b348015610476575f80fd5b506102f461048536600461303f565b610aef565b348015610495575f80fd5b506102f46104a436600461305a565b610b2e565b3480156104b4575f80fd5b506102c56104c336600461303f565b6001600160a01b03165f9081526004602052604090205460ff1690565b3480156104eb575f80fd5b506102c56104fa366004613001565b610c01565b34801561050a575f80fd5b506102f4610519366004613077565b610c6e565b348015610529575f80fd5b5061033061053836600461303f565b6001600160a01b03165f9081526001602052604090205490565b34801561055d575f80fd5b506102f4610ca0565b348015610571575f80fd5b506102f4610cbf565b348015610585575f80fd5b506102f46105943660046130f6565b610cd2565b3480156105a4575f80fd5b506102f46105b336600461303f565b610ea2565b3480156105c3575f80fd5b506103306105d236600461303f565b610f08565b3480156105e2575f80fd5b50610357610f25565b3480156105f6575f80fd5b506102f461108c565b34801561060a575f80fd5b505f546001600160a01b0316610357565b348015610626575f80fd5b506040805180820190915260058152642520a9a7a760d91b6020820152610290565b348015610653575f80fd5b506102c5610662366004612fab565b611275565b348015610672575f80fd5b506102f4610681366004613173565b611281565b348015610691575f80fd5b50600654600160c01b900463ffffffff166103ca565b3480156106b2575f80fd5b506102f46106c1366004612fe6565b6113b4565b3480156106d1575f80fd5b506102f46106e036600461303f565b61143a565b3480156106f0575f80fd5b506102f4611635565b348015610704575f80fd5b506102f46107133660046131da565b6119e3565b348015610723575f80fd5b506102f4610732366004612fe6565b611b44565b348015610742575f80fd5b5061033061075136600461324b565b6001600160a01b039182165f90815260026020908152604080832093909416825291909152205490565b348015610786575f80fd5b506102f461079536600461303f565b611bc9565b3480156107a5575f80fd5b506102f46107b436600461303f565b611c4e565b3480156107c4575f80fd5b506102f46107d336600461303f565b611c7f565b3480156107e3575f80fd5b506107ec611cf5565b60405161029d9190613277565b5f610805338484611d6c565b5060015b92915050565b610817611e8f565b6103e88163ffffffff16106108675760405162461bcd60e51b81526020600482015260116024820152704e6f206c6f776572207468616e202e312560781b60448201526064015b60405180910390fd5b6007805463ffffffff909216600160c01b0263ffffffff60c01b19909216919091179055565b610895611e8f565b6127108163ffffffff16106108e15760405162461bcd60e51b81526020600482015260126024820152714e6f206c6f776572207468616e202e30312560701b604482015260640161085e565b6007805463ffffffff909216600160a01b0263ffffffff60a01b19909216919091179055565b61090f611e8f565b600a8163ffffffff16106109655760405162461bcd60e51b815260206004820152601760248201527f4d6178696d756d2064697669736f72206f66203130252e000000000000000000604482015260640161085e565b6008805463ffffffff909216600160e01b026001600160e01b03909216919091179055565b5f610996848484611ee8565b6109f784336109f285604051806060016040528060288152602001613610602891396001600160a01b038a165f90815260026020526040812090335b6001600160a01b0316815260208101919091526040015f205491906122b2565b611d6c565b5060019392505050565b610a09611e8f565b6008805463ffffffff909216600160a01b0263ffffffff60a01b19909216919091179055565b6007545f906001600160a01b0316336001600160a01b031614610a645760405162461bcd60e51b815260040161085e906132d4565b60405163095ea7b360e01b81526001600160a01b0384811660048301526024820184905285919082169063095ea7b3906044015b6020604051808303815f875af1158015610ab4573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ad89190613317565b95945050505050565b5f610aea6122dd565b905090565b6007546001600160a01b0316336001600160a01b031614610b225760405162461bcd60e51b815260040161085e906132d4565b610b2b81612403565b50565b610b36611e8f565b600580546001810182555f9190915281907f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db001610b738282613332565b506001905060045f610b88602085018561303f565b6001600160a01b0316815260208082019290925260409081015f20805460ff191693151593909317909255610bc1918301908301612fe6565b60088054601890610be0908490600160c01b900463ffffffff166133a2565b92506101000a81548163ffffffff021916908363ffffffff16021790555050565b6007545f906001600160a01b0316336001600160a01b031614610c365760405162461bcd60e51b815260040161085e906132d4565b60405163a9059cbb60e01b81526001600160a01b0384811660048301526024820184905285919082169063a9059cbb90604401610a98565b610c76611e8f565b6001600160a01b03919091165f908152600460205260409020805460ff1916911515919091179055565b610ca8611e8f565b600780546001600160f81b0316600160f81b179055565b610cc7611e8f565b610cd05f612647565b565b828114610d215760405162461bcd60e51b815260206004820152601b60248201527f4d756c746973656e643a204c656e677468206d69736d617463682e0000000000604482015260640161085e565b5f805b84811015610e3d57610d4e33858584818110610d4257610d426133c6565b90506020020135612696565b610d96868683818110610d6357610d636133c6565b9050602002016020810190610d78919061303f565b858584818110610d8a57610d8a6133c6565b905060200201356126d8565b858582818110610da857610da86133c6565b9050602002016020810190610dbd919061303f565b6001600160a01b0316335f80516020613638833981519152868685818110610de757610de76133c6565b90506020020135604051610dfd91815260200190565b60405180910390a3838382818110610e1757610e176133c6565b9050602002013582610e2991906133da565b915080610e35816133ed565b915050610d24565b50610e9a863360408051808201825260208082527f4d756c746973656e643a204e6f7420656e6f75676820616c6c6f77616e63652e818301526001600160a01b038c165f90815260029091529182206109f29287929190336109d2565b505050505050565b6007546001600160a01b0316336001600160a01b031614610ed55760405162461bcd60e51b815260040161085e906132d4565b47610edf82612403565b5f610eea8247613405565b600754909150610f03906001600160a01b0316826126fb565b505050565b6001600160a01b0381165f90815260036020526040812054610809565b5f600960089054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f77573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f9b9190613418565b6001600160a01b031663e6a4390530600960089054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ffb573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061101f9190613418565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381865afa158015611068573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610aea9190613418565b6007546001600160a01b0316336001600160a01b0316146110bf5760405162461bcd60e51b815260040161085e906132d4565b5f600960089054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611111573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111359190613418565b90505f600960089054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611189573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111ad9190613418565b6040516370a0823160e01b81523060048201529091505f906001600160a01b038316906370a0823190602401602060405180830381865afa1580156111f4573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112189190613433565b604051632e1a7d4d60e01b8152600481018290529091506001600160a01b03841690632e1a7d4d906024015f604051808303815f87803b15801561125a575f80fd5b505af115801561126c573d5f803e3d5ffd5b50505050505050565b5f610805338484611ee8565b8281146112d05760405162461bcd60e51b815260206004820152601c60248201527f4d75796c746973656e643a204c656e677468206d69736d617463682e00000000604482015260640161085e565b5f5b838110156113ad576112f033848484818110610d4257610d426133c6565b61132c858583818110611305576113056133c6565b905060200201602081019061131a919061303f565b848484818110610d8a57610d8a6133c6565b84848281811061133e5761133e6133c6565b9050602002016020810190611353919061303f565b6001600160a01b0316335f8051602061363883398151915285858581811061137d5761137d6133c6565b9050602002013560405161139391815260200190565b60405180910390a3806113a5816133ed565b9150506112d2565b5050505050565b6113bc611e8f565b614e208163ffffffff1611156114145760405162461bcd60e51b815260206004820152601860248201527f4d6178696d756d2073656c6c20746178206f66203130252e0000000000000000604482015260640161085e565b6006805463ffffffff909216600160c01b0263ffffffff60c01b19909216919091179055565b611442611e8f565b6001600160a01b0381165f908152600460205260408120805460ff19169055805b60055481101561157557826001600160a01b03166005828154811061148a5761148a6133c6565b5f918252602090912001546001600160a01b03160361156357600580546114b390600190613405565b815481106114c3576114c36133c6565b905f5260205f2001600582815481106114de576114de6133c6565b5f91825260209091208254910180546001600160a01b039092166001600160a01b031983168117825592546001600160c01b0319909216909217600160a01b9182900463ffffffff16909102179055600580548061153e5761153e61344a565b5f8281526020902081015f1990810180546001600160c01b0319169055019055600191505b8061156d816133ed565b915050611463565b50806115b65760405162461bcd60e51b815260206004820152601060248201526f2737ba1034b7103a30bc103634b9ba1760811b604482015260640161085e565b5f805b60055481101561160c57600581815481106115d6576115d66133c6565b5f918252602090912001546115f890600160a01b900463ffffffff16836133a2565b915080611604816133ed565b9150506115b9565b506008805463ffffffff909216600160c01b0263ffffffff60c01b199092169190911790555050565b61163d611e8f565b600754600160e01b900460ff16156116a75760405162461bcd60e51b815260206004820152602760248201527f43616e2774206f70656e2074726164696e672074686174277320616c726561646044820152663c9037b832b71760c91b606482015260840161085e565b6009805468010000000000000000600160e01b0319167b7a250d5630b4cf539739df2c5dacb4c659f2488d00000000000000001790819055737a250d5630b4cf539739df2c5dacb4c659f2488d9061171f9030906001600160a01b03600160401b909104166c054f529ca52576bc6892000000611d6c565b5f816001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa15801561175c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906117809190613418565b6001600160a01b031663c9c6539630846001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156117cb573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906117ef9190613418565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303815f875af1158015611839573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061185d9190613418565b600954305f81815260016020526040902054929350600160401b9091046001600160a01b03169163f305d7199147915f8061189f5f546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015611905573d5f803e3d5ffd5b50505050506040513d601f19601f8201168201806040525081019061192a919061345e565b50506007805462ff00ff60e01b19166201000160e01b17905550604080516080810182525f80825260208083018281528385018381526001606086019081526001600160a01b039790971684526004909252939091209151825493519151945164ffffffffff1990941690151564ffffffff0019161761010063ffffffff928316021769ffffffffff0000000000191665010000000000919094160260ff60481b191692909217600160481b9115159190910217905550565b83421115611a335760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e65000000604482015260640161085e565b5f7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9888888611a618c612810565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090505f611abb82612837565b90505f611aca82878787612863565b9050896001600160a01b0316816001600160a01b031614611b2d5760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e61747572650000604482015260640161085e565b611b388a8a8a611d6c565b50505050505050505050565b611b4c611e8f565b614e208163ffffffff161115611ba45760405162461bcd60e51b815260206004820152601760248201527f4d6178696d756d2062757920746178206f66203130252e000000000000000000604482015260640161085e565b6006805463ffffffff909216600160e01b026001600160e01b03909216919091179055565b6008546001600160a01b0316336001600160a01b031614611c2c5760405162461bcd60e51b815260206004820152601c60248201527f4f6e6c7920646576656c6f7065722063616e2073657420746869732e00000000604482015260640161085e565b600780546001600160a01b0319166001600160a01b0392909216919091179055565b611c56611e8f565b6001600160a01b03165f908152600460205260409020805460ff60481b1916600160481b179055565b611c87611e8f565b6001600160a01b038116611cec5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161085e565b610b2b81612647565b60606005805480602002602001604051908101604052809291908181526020015f905b82821015611d63575f84815260209081902060408051808201909152908401546001600160a01b0381168252600160a01b900463ffffffff1681830152825260019092019101611d18565b50505050905090565b6001600160a01b038316611dce5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161085e565b6001600160a01b038216611e2f5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161085e565b6001600160a01b038381165f8181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b5f546001600160a01b03163314610cd05760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161085e565b6001600160a01b038316611f4c5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161085e565b6001600160a01b038216611fae5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161085e565b5f811161200f5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161085e565b5f806120225f546001600160a01b031690565b6001600160a01b0316856001600160a01b03161415801561205057505f546001600160a01b03858116911614155b801561206557506001600160a01b0385163014155b801561208957506001600160a01b0384165f9081526004602052604090205460ff16155b80156120ad57506001600160a01b0385165f9081526004602052604090205460ff16155b156122a1576007546120d990600160a01b900463ffffffff166c054f529ca52576bc6892000000613489565b83111561211b5760405162461bcd60e51b815260206004820152601060248201526f26b0bc103a3c1032bc31b2b2b232b21760811b604482015260640161085e565b6001600160a01b0385165f90815260046020526040902054600160481b900460ff16801561215e57506009546001600160a01b03858116600160401b9092041614155b156122165760065460075463ffffffff600160e01b9092048216935061219a91600160c01b909104166c054f529ca52576bc6892000000613489565b836121b9866001600160a01b03165f9081526001602052604090205490565b6121c391906133da565b11156122115760405162461bcd60e51b815260206004820152601c60248201527f4d61782077616c6c65742077696c6c2062652065786365656465642e00000000604482015260640161085e565b6122a5565b6001600160a01b0384165f90815260046020526040902054600160481b900460ff16801561225957506009546001600160a01b03868116600160401b9092041614155b15612277575050600654600160c01b900463ffffffff1660016122a5565b6007545f925061219a90600160c01b900463ffffffff166c054f529ca52576bc6892000000613489565b5f91505b6113ad8585858585612889565b5f81848411156122d55760405162461bcd60e51b815260040161085e9190612f4c565b505050900390565b5f306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614801561233557507f000000000000000000000000000000000000000000000000000000000000000046145b1561235f57507f000000000000000000000000000000000000000000000000000000000000000090565b50604080517f00000000000000000000000000000000000000000000000000000000000000006020808301919091527f0000000000000000000000000000000000000000000000000000000000000000828401527f000000000000000000000000000000000000000000000000000000000000000060608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b60408051600280825260608201835283925f92919060208301908036833701905050905082815f8151811061243a5761243a6133c6565b60200260200101906001600160a01b031690816001600160a01b031681525050600960089054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156124ab573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906124cf9190613418565b816001815181106124e2576124e26133c6565b6001600160a01b0392831660209182029290920101526040516370a0823160e01b81523060048201525f918416906370a0823190602401602060405180830381865afa158015612534573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906125589190613433565b60095460405163095ea7b360e01b81526001600160a01b03600160401b909204821660048201526024810183905291925084169063095ea7b3906044016020604051808303815f875af11580156125b1573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906125d59190613317565b5060095460405163791ac94760e01b8152600160401b9091046001600160a01b03169063791ac947906126149084905f908790309042906004016134bc565b5f604051808303815f87803b15801561262b575f80fd5b505af115801561263d573d5f803e3d5ffd5b5050505050505050565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0382165f908152600160205260409020546126b9908290613405565b6001600160a01b039092165f9081526001602052604090209190915550565b6001600160a01b0382165f908152600160205260409020546126b99082906133da565b8047101561274b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015260640161085e565b5f826001600160a01b0316826040515f6040518083038185875af1925050503d805f8114612794576040519150601f19603f3d011682016040523d82523d5f602084013e612799565b606091505b5050905080610f035760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d61792068617665207265766572746564000000000000606482015260840161085e565b6001600160a01b0381165f9081526003602052604090208054600181018255905b50919050565b5f6108096128436122dd565b8360405161190160f01b8152600281019290925260228201526042902090565b5f805f61287287878787612a52565b9150915061287f81612b0f565b5095945050505050565b8263ffffffff8316156128e8575f6128a18585612c58565b90506128ad8186613405565b91506128b930826126d8565b60405181815230906001600160a01b038916905f805160206136388339815191529060200160405180910390a3505b81156129b857856001600160a01b03167fae92ab4b6f8f401ead768d3273e6bb937a13e39827d19c6376e8fd4512a05d9a8560405161292991815260200190565b60405180910390a2305f9081526001602052604090205480156129b25760085461296d90600160e01b900463ffffffff166c054f529ca52576bc6892000000613489565b8111156129a9576008546129a49061299f90600160e01b900463ffffffff166c054f529ca52576bc6892000000613489565b612c7e565b6129b2565b6129b281612c7e565b506129fc565b846001600160a01b03167fc55650ccda1011e1cdc769b1fbf546ebb8c97800b6072b49e06cd560305b1d67856040516129f391815260200190565b60405180910390a25b612a068685612696565b612a1085826126d8565b846001600160a01b0316866001600160a01b03165f8051602061363883398151915283604051612a4291815260200190565b60405180910390a3505050505050565b5f807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115612a8757505f90506003612b06565b604080515f8082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612ad8573d5f803e3d5ffd5b5050604051601f1901519150506001600160a01b038116612b00575f60019250925050612b06565b91505f90505b94509492505050565b5f816004811115612b2257612b2261352b565b03612b2a5750565b6001816004811115612b3e57612b3e61352b565b03612b8b5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161085e565b6002816004811115612b9f57612b9f61352b565b03612bec5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161085e565b6003816004811115612c0057612c0061352b565b03610b2b5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161085e565b5f620186a0612c6d63ffffffff84168561353f565b612c779190613489565b9392505050565b60095467ffffffffffffffff164314610b2b576009805467ffffffffffffffff19164367ffffffffffffffff161790556007805460ff60e81b1916600160e81b179055305f908152600260209081526040808320600954600160401b90046001600160a01b03168452909152902054811115612d2057600954612d20903090600160401b90046001600160a01b03166c054f529ca52576bc6892000000611d6c565b6040805160028082526060820183525f9260208301908036833701905050905030815f81518110612d5357612d536133c6565b60200260200101906001600160a01b031690816001600160a01b031681525050600960089054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015612dc4573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612de89190613418565b81600181518110612dfb57612dfb6133c6565b6001600160a01b0392831660209182029290920101526009546040516318cbafe560e01b8152600160401b909104909116906318cbafe590612e499085905f908690309042906004016134bc565b5f604051808303815f875af1158015612e64573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052612e8b9190810190613556565b50612e9547612ea6565b50506007805460ff60e81b19169055565b5f5b600554811015612f4857612f3660058281548110612ec857612ec86133c6565b5f91825260209091200154600854600580546001600160a01b0390931692600160c01b90920463ffffffff169185908110612f0557612f056133c6565b5f91825260209091200154612f2790600160a01b900463ffffffff168661353f565b612f319190613489565b6126fb565b80612f40816133ed565b915050612ea8565b5050565b5f6020808352835180828501525f5b81811015612f7757858101830151858201604001528201612f5b565b505f604082860101526040601f19601f8301168501019250505092915050565b6001600160a01b0381168114610b2b575f80fd5b5f8060408385031215612fbc575f80fd5b8235612fc781612f97565b946020939093013593505050565b63ffffffff81168114610b2b575f80fd5b5f60208284031215612ff6575f80fd5b8135612c7781612fd5565b5f805f60608486031215613013575f80fd5b833561301e81612f97565b9250602084013561302e81612f97565b929592945050506040919091013590565b5f6020828403121561304f575f80fd5b8135612c7781612f97565b5f60408284031215612831575f80fd5b8015158114610b2b575f80fd5b5f8060408385031215613088575f80fd5b823561309381612f97565b915060208301356130a38161306a565b809150509250929050565b5f8083601f8401126130be575f80fd5b50813567ffffffffffffffff8111156130d5575f80fd5b6020830191508360208260051b85010111156130ef575f80fd5b9250929050565b5f805f805f6060868803121561310a575f80fd5b853561311581612f97565b9450602086013567ffffffffffffffff80821115613131575f80fd5b61313d89838a016130ae565b90965094506040880135915080821115613155575f80fd5b50613162888289016130ae565b969995985093965092949392505050565b5f805f8060408587031215613186575f80fd5b843567ffffffffffffffff8082111561319d575f80fd5b6131a9888389016130ae565b909650945060208701359150808211156131c1575f80fd5b506131ce878288016130ae565b95989497509550505050565b5f805f805f805f60e0888a0312156131f0575f80fd5b87356131fb81612f97565b9650602088013561320b81612f97565b95506040880135945060608801359350608088013560ff8116811461322e575f80fd5b9699959850939692959460a0840135945060c09093013592915050565b5f806040838503121561325c575f80fd5b823561326781612f97565b915060208301356130a381612f97565b602080825282518282018190525f919060409081850190868401855b828110156132c757815180516001600160a01b0316855286015163ffffffff16868501529284019290850190600101613293565b5091979650505050505050565b60208082526023908201527f43616c6c6572206973206e6f742074686520455243323020636f6e74726f6c6c60408201526232b91760e91b606082015260800190565b5f60208284031215613327575f80fd5b8151612c778161306a565b813561333d81612f97565b81546001600160a01b031981166001600160a01b03929092169182178355602084013561336981612fd5565b6001600160c01b03199190911690911760a09190911b63ffffffff60a01b1617905550565b634e487b7160e01b5f52601160045260245ffd5b63ffffffff8181168382160190808211156133bf576133bf61338e565b5092915050565b634e487b7160e01b5f52603260045260245ffd5b808201808211156108095761080961338e565b5f600182016133fe576133fe61338e565b5060010190565b818103818111156108095761080961338e565b5f60208284031215613428575f80fd5b8151612c7781612f97565b5f60208284031215613443575f80fd5b5051919050565b634e487b7160e01b5f52603160045260245ffd5b5f805f60608486031215613470575f80fd5b8351925060208401519150604084015190509250925092565b5f826134a357634e487b7160e01b5f52601260045260245ffd5b500490565b634e487b7160e01b5f52604160045260245ffd5b5f60a082018783526020878185015260a0604085015281875180845260c08601915082890193505f5b8181101561350a5784516001600160a01b0316835293830193918301916001016134e5565b50506001600160a01b03969096166060850152505050608001529392505050565b634e487b7160e01b5f52602160045260245ffd5b80820281158282048414176108095761080961338e565b5f6020808385031215613567575f80fd5b825167ffffffffffffffff8082111561357e575f80fd5b818501915085601f830112613591575f80fd5b8151818111156135a3576135a36134a8565b8060051b604051601f19603f830116810181811085821117156135c8576135c86134a8565b6040529182528482019250838101850191888311156135e5575f80fd5b938501935b82851015613603578451845293850193928501926135ea565b9897505050505050505056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220a0d539655224adafbae3459f835ce444e85579f3265c3efbbeb780c5cc54b51564736f6c6343000814003300000000000000000000000034a798abd814904dc7e346cb148e934669f0939300000000000000000000000034a798abd814904dc7e346cb148e934669f093930000000000000000000000000000000000000000000000000000000000004a380000000000000000000000000000000000000000000000000000000000004e200000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000003200000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000100000000000000000000000093ea06267856ba07b69f27fd79423f64c96d49ae00000000000000000000000000000000000000000000000000000000000003e8
608060405260043610610257575f3560e01c806370bfdd9d1161013f578063b0bc85de116100b3578063db932ae211610078578063db932ae214610718578063dd62ed3e14610737578063e0195f071461077b578063e9cb414f1461079a578063f2fde38b146107b9578063fb61e998146107d8575f80fd5b8063b0bc85de14610686578063bb1789d6146106a7578063c8ce7be1146106c6578063c9567bf9146106e5578063d505accf146106f9575f80fd5b806386f3f3cb1161010457806386f3f3cb146105d757806388a65f46146105eb5780638da5cb5b146105ff57806395d89b411461061b578063a9059cbb14610648578063aad41a4114610667575f80fd5b806370bfdd9d14610552578063715018a61461056657806373ae740e1461057a5780637a52da0e146105995780637ecebe00146105b8575f80fd5b8063313ce567116101d65780634ff99fcf1161019b5780634ff99fcf1461048a5780635342acb4146104a9578063571cbe0a146104e05780635c36eb41146102625780636612e66f146104ff57806370a082311461051e575f80fd5b8063313ce567146103fe578063333429471461041957806333a17282146104385780633644e51514610457578063473071ce1461046b575f80fd5b806320d5bf371161021c57806320d5bf371461033e578063232b10441461036f57806323b872dd1461038e578063252d723a146103ad5780632c1f5216146103df575f80fd5b806306fdde0314610262578063095ea7b3146102a65780630ecf68e0146102d557806317f5a80b146102f657806318160ddd14610315575f80fd5b3661025e57005b5f80fd5b34801561026d575f80fd5b5060408051808201909152600a8152694a61736f6e467572696560b01b60208201525b60405161029d9190612f4c565b60405180910390f35b3480156102b1575f80fd5b506102c56102c0366004612fab565b6107f9565b604051901515815260200161029d565b3480156102e0575f80fd5b506102f46102ef366004612fe6565b61080f565b005b348015610301575f80fd5b506102f4610310366004612fe6565b61088d565b348015610320575f80fd5b506c054f529ca52576bc68920000005b60405190815260200161029d565b348015610349575f80fd5b506007546001600160a01b03165b6040516001600160a01b03909116815260200161029d565b34801561037a575f80fd5b506102f4610389366004612fe6565b610907565b348015610399575f80fd5b506102c56103a8366004613001565b61098a565b3480156103b8575f80fd5b50600654600160e01b900463ffffffff165b60405163ffffffff909116815260200161029d565b3480156103ea575f80fd5b50600654610357906001600160a01b031681565b348015610409575f80fd5b506040516012815260200161029d565b348015610424575f80fd5b506102f4610433366004612fe6565b610a01565b348015610443575f80fd5b506102c5610452366004613001565b610a2f565b348015610462575f80fd5b50610330610ae1565b348015610476575f80fd5b506102f461048536600461303f565b610aef565b348015610495575f80fd5b506102f46104a436600461305a565b610b2e565b3480156104b4575f80fd5b506102c56104c336600461303f565b6001600160a01b03165f9081526004602052604090205460ff1690565b3480156104eb575f80fd5b506102c56104fa366004613001565b610c01565b34801561050a575f80fd5b506102f4610519366004613077565b610c6e565b348015610529575f80fd5b5061033061053836600461303f565b6001600160a01b03165f9081526001602052604090205490565b34801561055d575f80fd5b506102f4610ca0565b348015610571575f80fd5b506102f4610cbf565b348015610585575f80fd5b506102f46105943660046130f6565b610cd2565b3480156105a4575f80fd5b506102f46105b336600461303f565b610ea2565b3480156105c3575f80fd5b506103306105d236600461303f565b610f08565b3480156105e2575f80fd5b50610357610f25565b3480156105f6575f80fd5b506102f461108c565b34801561060a575f80fd5b505f546001600160a01b0316610357565b348015610626575f80fd5b506040805180820190915260058152642520a9a7a760d91b6020820152610290565b348015610653575f80fd5b506102c5610662366004612fab565b611275565b348015610672575f80fd5b506102f4610681366004613173565b611281565b348015610691575f80fd5b50600654600160c01b900463ffffffff166103ca565b3480156106b2575f80fd5b506102f46106c1366004612fe6565b6113b4565b3480156106d1575f80fd5b506102f46106e036600461303f565b61143a565b3480156106f0575f80fd5b506102f4611635565b348015610704575f80fd5b506102f46107133660046131da565b6119e3565b348015610723575f80fd5b506102f4610732366004612fe6565b611b44565b348015610742575f80fd5b5061033061075136600461324b565b6001600160a01b039182165f90815260026020908152604080832093909416825291909152205490565b348015610786575f80fd5b506102f461079536600461303f565b611bc9565b3480156107a5575f80fd5b506102f46107b436600461303f565b611c4e565b3480156107c4575f80fd5b506102f46107d336600461303f565b611c7f565b3480156107e3575f80fd5b506107ec611cf5565b60405161029d9190613277565b5f610805338484611d6c565b5060015b92915050565b610817611e8f565b6103e88163ffffffff16106108675760405162461bcd60e51b81526020600482015260116024820152704e6f206c6f776572207468616e202e312560781b60448201526064015b60405180910390fd5b6007805463ffffffff909216600160c01b0263ffffffff60c01b19909216919091179055565b610895611e8f565b6127108163ffffffff16106108e15760405162461bcd60e51b81526020600482015260126024820152714e6f206c6f776572207468616e202e30312560701b604482015260640161085e565b6007805463ffffffff909216600160a01b0263ffffffff60a01b19909216919091179055565b61090f611e8f565b600a8163ffffffff16106109655760405162461bcd60e51b815260206004820152601760248201527f4d6178696d756d2064697669736f72206f66203130252e000000000000000000604482015260640161085e565b6008805463ffffffff909216600160e01b026001600160e01b03909216919091179055565b5f610996848484611ee8565b6109f784336109f285604051806060016040528060288152602001613610602891396001600160a01b038a165f90815260026020526040812090335b6001600160a01b0316815260208101919091526040015f205491906122b2565b611d6c565b5060019392505050565b610a09611e8f565b6008805463ffffffff909216600160a01b0263ffffffff60a01b19909216919091179055565b6007545f906001600160a01b0316336001600160a01b031614610a645760405162461bcd60e51b815260040161085e906132d4565b60405163095ea7b360e01b81526001600160a01b0384811660048301526024820184905285919082169063095ea7b3906044015b6020604051808303815f875af1158015610ab4573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ad89190613317565b95945050505050565b5f610aea6122dd565b905090565b6007546001600160a01b0316336001600160a01b031614610b225760405162461bcd60e51b815260040161085e906132d4565b610b2b81612403565b50565b610b36611e8f565b600580546001810182555f9190915281907f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db001610b738282613332565b506001905060045f610b88602085018561303f565b6001600160a01b0316815260208082019290925260409081015f20805460ff191693151593909317909255610bc1918301908301612fe6565b60088054601890610be0908490600160c01b900463ffffffff166133a2565b92506101000a81548163ffffffff021916908363ffffffff16021790555050565b6007545f906001600160a01b0316336001600160a01b031614610c365760405162461bcd60e51b815260040161085e906132d4565b60405163a9059cbb60e01b81526001600160a01b0384811660048301526024820184905285919082169063a9059cbb90604401610a98565b610c76611e8f565b6001600160a01b03919091165f908152600460205260409020805460ff1916911515919091179055565b610ca8611e8f565b600780546001600160f81b0316600160f81b179055565b610cc7611e8f565b610cd05f612647565b565b828114610d215760405162461bcd60e51b815260206004820152601b60248201527f4d756c746973656e643a204c656e677468206d69736d617463682e0000000000604482015260640161085e565b5f805b84811015610e3d57610d4e33858584818110610d4257610d426133c6565b90506020020135612696565b610d96868683818110610d6357610d636133c6565b9050602002016020810190610d78919061303f565b858584818110610d8a57610d8a6133c6565b905060200201356126d8565b858582818110610da857610da86133c6565b9050602002016020810190610dbd919061303f565b6001600160a01b0316335f80516020613638833981519152868685818110610de757610de76133c6565b90506020020135604051610dfd91815260200190565b60405180910390a3838382818110610e1757610e176133c6565b9050602002013582610e2991906133da565b915080610e35816133ed565b915050610d24565b50610e9a863360408051808201825260208082527f4d756c746973656e643a204e6f7420656e6f75676820616c6c6f77616e63652e818301526001600160a01b038c165f90815260029091529182206109f29287929190336109d2565b505050505050565b6007546001600160a01b0316336001600160a01b031614610ed55760405162461bcd60e51b815260040161085e906132d4565b47610edf82612403565b5f610eea8247613405565b600754909150610f03906001600160a01b0316826126fb565b505050565b6001600160a01b0381165f90815260036020526040812054610809565b5f600960089054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f77573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f9b9190613418565b6001600160a01b031663e6a4390530600960089054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ffb573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061101f9190613418565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381865afa158015611068573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610aea9190613418565b6007546001600160a01b0316336001600160a01b0316146110bf5760405162461bcd60e51b815260040161085e906132d4565b5f600960089054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611111573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111359190613418565b90505f600960089054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611189573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111ad9190613418565b6040516370a0823160e01b81523060048201529091505f906001600160a01b038316906370a0823190602401602060405180830381865afa1580156111f4573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112189190613433565b604051632e1a7d4d60e01b8152600481018290529091506001600160a01b03841690632e1a7d4d906024015f604051808303815f87803b15801561125a575f80fd5b505af115801561126c573d5f803e3d5ffd5b50505050505050565b5f610805338484611ee8565b8281146112d05760405162461bcd60e51b815260206004820152601c60248201527f4d75796c746973656e643a204c656e677468206d69736d617463682e00000000604482015260640161085e565b5f5b838110156113ad576112f033848484818110610d4257610d426133c6565b61132c858583818110611305576113056133c6565b905060200201602081019061131a919061303f565b848484818110610d8a57610d8a6133c6565b84848281811061133e5761133e6133c6565b9050602002016020810190611353919061303f565b6001600160a01b0316335f8051602061363883398151915285858581811061137d5761137d6133c6565b9050602002013560405161139391815260200190565b60405180910390a3806113a5816133ed565b9150506112d2565b5050505050565b6113bc611e8f565b614e208163ffffffff1611156114145760405162461bcd60e51b815260206004820152601860248201527f4d6178696d756d2073656c6c20746178206f66203130252e0000000000000000604482015260640161085e565b6006805463ffffffff909216600160c01b0263ffffffff60c01b19909216919091179055565b611442611e8f565b6001600160a01b0381165f908152600460205260408120805460ff19169055805b60055481101561157557826001600160a01b03166005828154811061148a5761148a6133c6565b5f918252602090912001546001600160a01b03160361156357600580546114b390600190613405565b815481106114c3576114c36133c6565b905f5260205f2001600582815481106114de576114de6133c6565b5f91825260209091208254910180546001600160a01b039092166001600160a01b031983168117825592546001600160c01b0319909216909217600160a01b9182900463ffffffff16909102179055600580548061153e5761153e61344a565b5f8281526020902081015f1990810180546001600160c01b0319169055019055600191505b8061156d816133ed565b915050611463565b50806115b65760405162461bcd60e51b815260206004820152601060248201526f2737ba1034b7103a30bc103634b9ba1760811b604482015260640161085e565b5f805b60055481101561160c57600581815481106115d6576115d66133c6565b5f918252602090912001546115f890600160a01b900463ffffffff16836133a2565b915080611604816133ed565b9150506115b9565b506008805463ffffffff909216600160c01b0263ffffffff60c01b199092169190911790555050565b61163d611e8f565b600754600160e01b900460ff16156116a75760405162461bcd60e51b815260206004820152602760248201527f43616e2774206f70656e2074726164696e672074686174277320616c726561646044820152663c9037b832b71760c91b606482015260840161085e565b6009805468010000000000000000600160e01b0319167b7a250d5630b4cf539739df2c5dacb4c659f2488d00000000000000001790819055737a250d5630b4cf539739df2c5dacb4c659f2488d9061171f9030906001600160a01b03600160401b909104166c054f529ca52576bc6892000000611d6c565b5f816001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa15801561175c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906117809190613418565b6001600160a01b031663c9c6539630846001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156117cb573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906117ef9190613418565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303815f875af1158015611839573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061185d9190613418565b600954305f81815260016020526040902054929350600160401b9091046001600160a01b03169163f305d7199147915f8061189f5f546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015611905573d5f803e3d5ffd5b50505050506040513d601f19601f8201168201806040525081019061192a919061345e565b50506007805462ff00ff60e01b19166201000160e01b17905550604080516080810182525f80825260208083018281528385018381526001606086019081526001600160a01b039790971684526004909252939091209151825493519151945164ffffffffff1990941690151564ffffffff0019161761010063ffffffff928316021769ffffffffff0000000000191665010000000000919094160260ff60481b191692909217600160481b9115159190910217905550565b83421115611a335760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e65000000604482015260640161085e565b5f7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9888888611a618c612810565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090505f611abb82612837565b90505f611aca82878787612863565b9050896001600160a01b0316816001600160a01b031614611b2d5760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e61747572650000604482015260640161085e565b611b388a8a8a611d6c565b50505050505050505050565b611b4c611e8f565b614e208163ffffffff161115611ba45760405162461bcd60e51b815260206004820152601760248201527f4d6178696d756d2062757920746178206f66203130252e000000000000000000604482015260640161085e565b6006805463ffffffff909216600160e01b026001600160e01b03909216919091179055565b6008546001600160a01b0316336001600160a01b031614611c2c5760405162461bcd60e51b815260206004820152601c60248201527f4f6e6c7920646576656c6f7065722063616e2073657420746869732e00000000604482015260640161085e565b600780546001600160a01b0319166001600160a01b0392909216919091179055565b611c56611e8f565b6001600160a01b03165f908152600460205260409020805460ff60481b1916600160481b179055565b611c87611e8f565b6001600160a01b038116611cec5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161085e565b610b2b81612647565b60606005805480602002602001604051908101604052809291908181526020015f905b82821015611d63575f84815260209081902060408051808201909152908401546001600160a01b0381168252600160a01b900463ffffffff1681830152825260019092019101611d18565b50505050905090565b6001600160a01b038316611dce5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161085e565b6001600160a01b038216611e2f5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161085e565b6001600160a01b038381165f8181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b5f546001600160a01b03163314610cd05760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161085e565b6001600160a01b038316611f4c5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161085e565b6001600160a01b038216611fae5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161085e565b5f811161200f5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161085e565b5f806120225f546001600160a01b031690565b6001600160a01b0316856001600160a01b03161415801561205057505f546001600160a01b03858116911614155b801561206557506001600160a01b0385163014155b801561208957506001600160a01b0384165f9081526004602052604090205460ff16155b80156120ad57506001600160a01b0385165f9081526004602052604090205460ff16155b156122a1576007546120d990600160a01b900463ffffffff166c054f529ca52576bc6892000000613489565b83111561211b5760405162461bcd60e51b815260206004820152601060248201526f26b0bc103a3c1032bc31b2b2b232b21760811b604482015260640161085e565b6001600160a01b0385165f90815260046020526040902054600160481b900460ff16801561215e57506009546001600160a01b03858116600160401b9092041614155b156122165760065460075463ffffffff600160e01b9092048216935061219a91600160c01b909104166c054f529ca52576bc6892000000613489565b836121b9866001600160a01b03165f9081526001602052604090205490565b6121c391906133da565b11156122115760405162461bcd60e51b815260206004820152601c60248201527f4d61782077616c6c65742077696c6c2062652065786365656465642e00000000604482015260640161085e565b6122a5565b6001600160a01b0384165f90815260046020526040902054600160481b900460ff16801561225957506009546001600160a01b03868116600160401b9092041614155b15612277575050600654600160c01b900463ffffffff1660016122a5565b6007545f925061219a90600160c01b900463ffffffff166c054f529ca52576bc6892000000613489565b5f91505b6113ad8585858585612889565b5f81848411156122d55760405162461bcd60e51b815260040161085e9190612f4c565b505050900390565b5f306001600160a01b037f000000000000000000000000f31d05f1421e1524c1365706d4f59be2069f0efb1614801561233557507f000000000000000000000000000000000000000000000000000000000000000146145b1561235f57507f6722562a06cdd6b40022bc83cf0540cc9734f4f49bb68c024345c98649196e2090565b50604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6020808301919091527fa42943306e9eb90ea8ec70d911c7b0581c0c637e4fed5176d787c4d3478576b9828401527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b60408051600280825260608201835283925f92919060208301908036833701905050905082815f8151811061243a5761243a6133c6565b60200260200101906001600160a01b031690816001600160a01b031681525050600960089054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156124ab573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906124cf9190613418565b816001815181106124e2576124e26133c6565b6001600160a01b0392831660209182029290920101526040516370a0823160e01b81523060048201525f918416906370a0823190602401602060405180830381865afa158015612534573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906125589190613433565b60095460405163095ea7b360e01b81526001600160a01b03600160401b909204821660048201526024810183905291925084169063095ea7b3906044016020604051808303815f875af11580156125b1573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906125d59190613317565b5060095460405163791ac94760e01b8152600160401b9091046001600160a01b03169063791ac947906126149084905f908790309042906004016134bc565b5f604051808303815f87803b15801561262b575f80fd5b505af115801561263d573d5f803e3d5ffd5b5050505050505050565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0382165f908152600160205260409020546126b9908290613405565b6001600160a01b039092165f9081526001602052604090209190915550565b6001600160a01b0382165f908152600160205260409020546126b99082906133da565b8047101561274b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015260640161085e565b5f826001600160a01b0316826040515f6040518083038185875af1925050503d805f8114612794576040519150601f19603f3d011682016040523d82523d5f602084013e612799565b606091505b5050905080610f035760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d61792068617665207265766572746564000000000000606482015260840161085e565b6001600160a01b0381165f9081526003602052604090208054600181018255905b50919050565b5f6108096128436122dd565b8360405161190160f01b8152600281019290925260228201526042902090565b5f805f61287287878787612a52565b9150915061287f81612b0f565b5095945050505050565b8263ffffffff8316156128e8575f6128a18585612c58565b90506128ad8186613405565b91506128b930826126d8565b60405181815230906001600160a01b038916905f805160206136388339815191529060200160405180910390a3505b81156129b857856001600160a01b03167fae92ab4b6f8f401ead768d3273e6bb937a13e39827d19c6376e8fd4512a05d9a8560405161292991815260200190565b60405180910390a2305f9081526001602052604090205480156129b25760085461296d90600160e01b900463ffffffff166c054f529ca52576bc6892000000613489565b8111156129a9576008546129a49061299f90600160e01b900463ffffffff166c054f529ca52576bc6892000000613489565b612c7e565b6129b2565b6129b281612c7e565b506129fc565b846001600160a01b03167fc55650ccda1011e1cdc769b1fbf546ebb8c97800b6072b49e06cd560305b1d67856040516129f391815260200190565b60405180910390a25b612a068685612696565b612a1085826126d8565b846001600160a01b0316866001600160a01b03165f8051602061363883398151915283604051612a4291815260200190565b60405180910390a3505050505050565b5f807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115612a8757505f90506003612b06565b604080515f8082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612ad8573d5f803e3d5ffd5b5050604051601f1901519150506001600160a01b038116612b00575f60019250925050612b06565b91505f90505b94509492505050565b5f816004811115612b2257612b2261352b565b03612b2a5750565b6001816004811115612b3e57612b3e61352b565b03612b8b5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161085e565b6002816004811115612b9f57612b9f61352b565b03612bec5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161085e565b6003816004811115612c0057612c0061352b565b03610b2b5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161085e565b5f620186a0612c6d63ffffffff84168561353f565b612c779190613489565b9392505050565b60095467ffffffffffffffff164314610b2b576009805467ffffffffffffffff19164367ffffffffffffffff161790556007805460ff60e81b1916600160e81b179055305f908152600260209081526040808320600954600160401b90046001600160a01b03168452909152902054811115612d2057600954612d20903090600160401b90046001600160a01b03166c054f529ca52576bc6892000000611d6c565b6040805160028082526060820183525f9260208301908036833701905050905030815f81518110612d5357612d536133c6565b60200260200101906001600160a01b031690816001600160a01b031681525050600960089054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015612dc4573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612de89190613418565b81600181518110612dfb57612dfb6133c6565b6001600160a01b0392831660209182029290920101526009546040516318cbafe560e01b8152600160401b909104909116906318cbafe590612e499085905f908690309042906004016134bc565b5f604051808303815f875af1158015612e64573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052612e8b9190810190613556565b50612e9547612ea6565b50506007805460ff60e81b19169055565b5f5b600554811015612f4857612f3660058281548110612ec857612ec86133c6565b5f91825260209091200154600854600580546001600160a01b0390931692600160c01b90920463ffffffff169185908110612f0557612f056133c6565b5f91825260209091200154612f2790600160a01b900463ffffffff168661353f565b612f319190613489565b6126fb565b80612f40816133ed565b915050612ea8565b5050565b5f6020808352835180828501525f5b81811015612f7757858101830151858201604001528201612f5b565b505f604082860101526040601f19601f8301168501019250505092915050565b6001600160a01b0381168114610b2b575f80fd5b5f8060408385031215612fbc575f80fd5b8235612fc781612f97565b946020939093013593505050565b63ffffffff81168114610b2b575f80fd5b5f60208284031215612ff6575f80fd5b8135612c7781612fd5565b5f805f60608486031215613013575f80fd5b833561301e81612f97565b9250602084013561302e81612f97565b929592945050506040919091013590565b5f6020828403121561304f575f80fd5b8135612c7781612f97565b5f60408284031215612831575f80fd5b8015158114610b2b575f80fd5b5f8060408385031215613088575f80fd5b823561309381612f97565b915060208301356130a38161306a565b809150509250929050565b5f8083601f8401126130be575f80fd5b50813567ffffffffffffffff8111156130d5575f80fd5b6020830191508360208260051b85010111156130ef575f80fd5b9250929050565b5f805f805f6060868803121561310a575f80fd5b853561311581612f97565b9450602086013567ffffffffffffffff80821115613131575f80fd5b61313d89838a016130ae565b90965094506040880135915080821115613155575f80fd5b50613162888289016130ae565b969995985093965092949392505050565b5f805f8060408587031215613186575f80fd5b843567ffffffffffffffff8082111561319d575f80fd5b6131a9888389016130ae565b909650945060208701359150808211156131c1575f80fd5b506131ce878288016130ae565b95989497509550505050565b5f805f805f805f60e0888a0312156131f0575f80fd5b87356131fb81612f97565b9650602088013561320b81612f97565b95506040880135945060608801359350608088013560ff8116811461322e575f80fd5b9699959850939692959460a0840135945060c09093013592915050565b5f806040838503121561325c575f80fd5b823561326781612f97565b915060208301356130a381612f97565b602080825282518282018190525f919060409081850190868401855b828110156132c757815180516001600160a01b0316855286015163ffffffff16868501529284019290850190600101613293565b5091979650505050505050565b60208082526023908201527f43616c6c6572206973206e6f742074686520455243323020636f6e74726f6c6c60408201526232b91760e91b606082015260800190565b5f60208284031215613327575f80fd5b8151612c778161306a565b813561333d81612f97565b81546001600160a01b031981166001600160a01b03929092169182178355602084013561336981612fd5565b6001600160c01b03199190911690911760a09190911b63ffffffff60a01b1617905550565b634e487b7160e01b5f52601160045260245ffd5b63ffffffff8181168382160190808211156133bf576133bf61338e565b5092915050565b634e487b7160e01b5f52603260045260245ffd5b808201808211156108095761080961338e565b5f600182016133fe576133fe61338e565b5060010190565b818103818111156108095761080961338e565b5f60208284031215613428575f80fd5b8151612c7781612f97565b5f60208284031215613443575f80fd5b5051919050565b634e487b7160e01b5f52603160045260245ffd5b5f805f60608486031215613470575f80fd5b8351925060208401519150604084015190509250925092565b5f826134a357634e487b7160e01b5f52601260045260245ffd5b500490565b634e487b7160e01b5f52604160045260245ffd5b5f60a082018783526020878185015260a0604085015281875180845260c08601915082890193505f5b8181101561350a5784516001600160a01b0316835293830193918301916001016134e5565b50506001600160a01b03969096166060850152505050608001529392505050565b634e487b7160e01b5f52602160045260245ffd5b80820281158282048414176108095761080961338e565b5f6020808385031215613567575f80fd5b825167ffffffffffffffff8082111561357e575f80fd5b818501915085601f830112613591575f80fd5b8151818111156135a3576135a36134a8565b8060051b604051601f19603f830116810181811085821117156135c8576135c86134a8565b6040529182528482019250838101850191888311156135e5575f80fd5b938501935b82851015613603578451845293850193928501926135ea565b9897505050505050505056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220a0d539655224adafbae3459f835ce444e85579f3265c3efbbeb780c5cc54b51564736f6c63430008140033
{{ "language": "Solidity", "sources": { "@openzeppelin/contracts/access/Ownable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby disabling 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/IERC20.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC20/IERC20.sol\";\n" }, "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n// EIP-2612 is Final as of 2022-11-01. This file is deprecated.\n\nimport \"./IERC20Permit.sol\";\n" }, "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/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/IERC20.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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(address from, address to, uint256 amount) external returns (bool);\n}\n" }, "@openzeppelin/contracts/utils/Address.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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 * Furthermore, `isContract` will also return true if the target contract within\n * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n * which only has an effect at the end of a transaction.\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://consensys.net/diligence/blog/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.8.0/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(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\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.9.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(bytes32 hash, bytes32 r, bytes32 vs) 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(bytes32 hash, bytes32 r, bytes32 vs) 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(bytes32 hash, uint8 v, bytes32 r, bytes32 s) 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(bytes32 hash, uint8 v, bytes32 r, bytes32 s) 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 message) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, \"\\x19Ethereum Signed Message:\\n32\")\n mstore(0x1c, hash)\n message := keccak256(0x00, 0x3c)\n }\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 data) {\n /// @solidity memory-safe-assembly\n assembly {\n let ptr := mload(0x40)\n mstore(ptr, \"\\x19\\x01\")\n mstore(add(ptr, 0x02), domainSeparator)\n mstore(add(ptr, 0x22), structHash)\n data := keccak256(ptr, 0x42)\n }\n }\n\n /**\n * @dev Returns an Ethereum Signed Data with intended validator, created from a\n * `validator` and `data` according to the version 0 of EIP-191.\n *\n * See {recover}.\n */\n function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x00\", validator, data));\n }\n}\n" }, "@openzeppelin/contracts/utils/math/Math.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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(uint256 x, uint256 y, uint256 denominator) 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 // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n // The surrounding unchecked block does not change this fact.\n // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1, \"Math: mulDiv overflow\");\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(uint256 x, uint256 y, uint256 denominator, Rounding rounding) 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 256, 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 << 3) < value ? 1 : 0);\n }\n }\n}\n" }, "@openzeppelin/contracts/utils/math/SafeMath.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)\n\npragma solidity ^0.8.0;\n\n// CAUTION\n// This version of SafeMath should only be used with Solidity 0.8 or later,\n// because it relies on the compiler's built in overflow checks.\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\n * now has built in overflow checking.\n */\nlibrary SafeMath {\n /**\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {trySub}.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n return a - b;\n }\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a / b;\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting with custom message when dividing by zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryMod}.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a % b;\n }\n }\n}\n" }, "@openzeppelin/contracts/utils/math/SignedMath.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n /**\n * @dev Returns the largest of two signed numbers.\n */\n function max(int256 a, int256 b) internal pure returns (int256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two signed numbers.\n */\n function min(int256 a, int256 b) internal pure returns (int256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two signed numbers without overflow.\n * The result is rounded towards zero.\n */\n function average(int256 a, int256 b) internal pure returns (int256) {\n // Formula from the book \"Hacker's Delight\"\n int256 x = (a & b) + ((a ^ b) >> 1);\n return x + (int256(uint256(x) >> 255) & (a ^ b));\n }\n\n /**\n * @dev Returns the absolute unsigned value of a signed value.\n */\n function abs(int256 n) internal pure returns (uint256) {\n unchecked {\n // must be unchecked in order to support `n = type(int256).min`\n return uint256(n >= 0 ? n : -n);\n }\n }\n}\n" }, "@openzeppelin/contracts/utils/Strings.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\nimport \"./math/SignedMath.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 `int256` to its ASCII `string` decimal representation.\n */\n function toString(int256 value) internal pure returns (string memory) {\n return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value))));\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 /**\n * @dev Returns true if the two strings are equal.\n */\n function equal(string memory a, string memory b) internal pure returns (bool) {\n return keccak256(bytes(a)) == keccak256(bytes(b));\n }\n}\n" }, "@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol": { "content": "pragma solidity >=0.5.0;\n\ninterface IUniswapV2Factory {\n event PairCreated(address indexed token0, address indexed token1, address pair, uint);\n\n function feeTo() external view returns (address);\n function feeToSetter() external view returns (address);\n\n function getPair(address tokenA, address tokenB) external view returns (address pair);\n function allPairs(uint) external view returns (address pair);\n function allPairsLength() external view returns (uint);\n\n function createPair(address tokenA, address tokenB) external returns (address pair);\n\n function setFeeTo(address) external;\n function setFeeToSetter(address) external;\n}\n" }, "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol": { "content": "pragma solidity >=0.5.0;\n\ninterface IUniswapV2Pair {\n event Approval(address indexed owner, address indexed spender, uint value);\n event Transfer(address indexed from, address indexed to, uint value);\n\n function name() external pure returns (string memory);\n function symbol() external pure returns (string memory);\n function decimals() external pure returns (uint8);\n function totalSupply() external view returns (uint);\n function balanceOf(address owner) external view returns (uint);\n function allowance(address owner, address spender) external view returns (uint);\n\n function approve(address spender, uint value) external returns (bool);\n function transfer(address to, uint value) external returns (bool);\n function transferFrom(address from, address to, uint value) external returns (bool);\n\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n function PERMIT_TYPEHASH() external pure returns (bytes32);\n function nonces(address owner) external view returns (uint);\n\n function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;\n\n event Mint(address indexed sender, uint amount0, uint amount1);\n event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);\n event Swap(\n address indexed sender,\n uint amount0In,\n uint amount1In,\n uint amount0Out,\n uint amount1Out,\n address indexed to\n );\n event Sync(uint112 reserve0, uint112 reserve1);\n\n function MINIMUM_LIQUIDITY() external pure returns (uint);\n function factory() external view returns (address);\n function token0() external view returns (address);\n function token1() external view returns (address);\n function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);\n function price0CumulativeLast() external view returns (uint);\n function price1CumulativeLast() external view returns (uint);\n function kLast() external view returns (uint);\n\n function mint(address to) external returns (uint liquidity);\n function burn(address to) external returns (uint amount0, uint amount1);\n function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;\n function skim(address to) external;\n function sync() external;\n\n function initialize(address, address) external;\n}\n" }, "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router01.sol": { "content": "pragma solidity >=0.6.2;\n\ninterface IUniswapV2Router01 {\n function factory() external pure returns (address);\n function WETH() external pure returns (address);\n\n function addLiquidity(\n address tokenA,\n address tokenB,\n uint amountADesired,\n uint amountBDesired,\n uint amountAMin,\n uint amountBMin,\n address to,\n uint deadline\n ) external returns (uint amountA, uint amountB, uint liquidity);\n function addLiquidityETH(\n address token,\n uint amountTokenDesired,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n ) external payable returns (uint amountToken, uint amountETH, uint liquidity);\n function removeLiquidity(\n address tokenA,\n address tokenB,\n uint liquidity,\n uint amountAMin,\n uint amountBMin,\n address to,\n uint deadline\n ) external returns (uint amountA, uint amountB);\n function removeLiquidityETH(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n ) external returns (uint amountToken, uint amountETH);\n function removeLiquidityWithPermit(\n address tokenA,\n address tokenB,\n uint liquidity,\n uint amountAMin,\n uint amountBMin,\n address to,\n uint deadline,\n bool approveMax, uint8 v, bytes32 r, bytes32 s\n ) external returns (uint amountA, uint amountB);\n function removeLiquidityETHWithPermit(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline,\n bool approveMax, uint8 v, bytes32 r, bytes32 s\n ) external returns (uint amountToken, uint amountETH);\n function swapExactTokensForTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external returns (uint[] memory amounts);\n function swapTokensForExactTokens(\n uint amountOut,\n uint amountInMax,\n address[] calldata path,\n address to,\n uint deadline\n ) external returns (uint[] memory amounts);\n function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)\n external\n payable\n returns (uint[] memory amounts);\n function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)\n external\n returns (uint[] memory amounts);\n function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)\n external\n returns (uint[] memory amounts);\n function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)\n external\n payable\n returns (uint[] memory amounts);\n\n function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);\n function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);\n function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);\n function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);\n function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);\n}\n" }, "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol": { "content": "pragma solidity >=0.6.2;\n\nimport './IUniswapV2Router01.sol';\n\ninterface IUniswapV2Router02 is IUniswapV2Router01 {\n function removeLiquidityETHSupportingFeeOnTransferTokens(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline\n ) external returns (uint amountETH);\n function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(\n address token,\n uint liquidity,\n uint amountTokenMin,\n uint amountETHMin,\n address to,\n uint deadline,\n bool approveMax, uint8 v, bytes32 r, bytes32 s\n ) external returns (uint amountETH);\n\n function swapExactTokensForTokensSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n function swapExactETHForTokensSupportingFeeOnTransferTokens(\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external payable;\n function swapExactTokensForETHSupportingFeeOnTransferTokens(\n uint amountIn,\n uint amountOutMin,\n address[] calldata path,\n address to,\n uint deadline\n ) external;\n}\n" }, "@uniswap/v2-periphery/contracts/interfaces/IWETH.sol": { "content": "pragma solidity >=0.5.0;\n\ninterface IWETH {\n function deposit() external payable;\n function transfer(address to, uint value) external returns (bool);\n function withdraw(uint) external;\n}\n" }, "contracts/IMultisend.sol": { "content": "/**\r\n * A Multisend interface\r\n * SPDX-License-Identifier: MIT\r\n */\r\npragma solidity ^0.8.15;\r\ninterface IMultisend {\r\n\r\n /// @notice Allows a multi-send to save on gas\r\n /// @param addr array of addresses to send to\r\n /// @param val array of values to go with addresses\r\n function multisend(address[] calldata addr, uint256[] calldata val) external;\r\n\r\n /// @notice Allows a multi-send to save on gas on behalf of someone - need approvals\r\n /// @param sender sender to use - must be approved to spend\r\n /// @param addrRecipients array of addresses to send to\r\n /// @param vals array of values to go with addresses\r\n function multisendFrom(address sender, address[] calldata addrRecipients, uint256[] calldata vals) external;\r\n}" }, "contracts/JasonFurie.sol": { "content": "//SPDX-License-Identifier: UNLICENSED\r\n\r\npragma solidity ^0.8.15;\r\n\r\nimport \"@openzeppelin/contracts/utils/Address.sol\";\r\nimport \"@openzeppelin/contracts/utils/Context.sol\";\r\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\";\r\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\";\r\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\r\nimport \"@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol\";\r\nimport \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol\";\r\nimport \"@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol\";\r\nimport \"@uniswap/v2-periphery/contracts/interfaces/IWETH.sol\";\r\nimport \"@openzeppelin/contracts/utils/math/SafeMath.sol\";\r\n\r\nimport \"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\";\r\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\r\nimport \"@openzeppelin/contracts/utils/Counters.sol\";\r\n\r\nimport \"./IMultisend.sol\";\r\n\r\ncontract JasonFurie is Context, IERC20, Ownable, IMultisend, IERC20Permit {\r\n event Bought(address indexed buyer, uint256 amount);\r\n event Sold(address indexed seller, uint256 amount);\r\n using SafeMath for uint256;\r\n // Constants\r\n string private constant _name = \"JasonFurie\";\r\n string private constant _symbol = \"JASON\";\r\n // Standard decimals\r\n uint8 private constant _decimals = 18;\r\n uint256 private constant totalTokens = 420690000000000000000000000000;\r\n // Mappings\r\n mapping(address => uint256) private balances;\r\n mapping(address => mapping(address => uint256)) private _allowances;\r\n \r\n /** START OF EIP2612/EIP712 VARS */\r\n\r\n using Counters for Counters.Counter;\r\n\r\n mapping(address => Counters.Counter) private _nonces;\r\n\r\n /* solhint-disable var-name-mixedcase */\r\n // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to\r\n // invalidate the cached domain separator if the chain id changes.\r\n bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;\r\n uint256 private immutable _CACHED_CHAIN_ID;\r\n address private immutable _CACHED_THIS;\r\n\r\n bytes32 private immutable _HASHED_NAME;\r\n bytes32 private immutable _HASHED_VERSION;\r\n bytes32 private immutable _TYPE_HASH;\r\n\r\n /** END OF EIP2612/EIP712 VARS */\r\n\r\n struct mappingStructs {\r\n bool _isExcludedFromFee;\r\n uint32 _lastTxBlock;\r\n uint32 botBlock;\r\n bool isLPPair;\r\n }\r\n\r\n struct InitialData {\r\n uint32 buyTax;\r\n uint32 sellTax;\r\n uint32 maxWalletDiv;\r\n uint32 maxTxDiv;\r\n uint32 maxSwapDivisor;\r\n }\r\n\r\n struct TaxWallet {\r\n address wallet;\r\n uint32 ratio;\r\n }\r\n\r\n mapping(address => mappingStructs) mappedAddresses;\r\n\r\n // Arrays\r\n TaxWallet[] private taxWallets;\r\n // Global variables\r\n\r\n // Block of 256 bits\r\n address public dividendTracker;\r\n uint32 private openBlock;\r\n uint32 private sellTax;\r\n uint32 private buyTax;\r\n // Storage block closed\r\n\r\n // Block of 256 bits\r\n address private _controller;\r\n uint32 private maxTxRatio;\r\n uint32 private maxWalletRatio;\r\n bool private tradingOpen;\r\n bool private inSwap = false;\r\n bool private swapEnabled = false;\r\n bool disableAddToBlocklist = false;\r\n\r\n // Storage block closed\r\n\r\n // Block of 256 bits\r\n address private devWallet;\r\n uint32 ethSendThresholdDivisor = 1000;\r\n uint32 private totalRatio;\r\n uint32 private taxSwapDivisor;\r\n\r\n // Block of 256 bits\r\n uint64 lastTxBlockNumber;\r\n\r\n IUniswapV2Router02 private uniswapV2Router;\r\n\r\n modifier onlyERC20Controller() {\r\n require(\r\n _msgSender() == _controller,\r\n \"Caller is not the ERC20 controller.\"\r\n );\r\n _;\r\n }\r\n modifier onlyDev() {\r\n require(_msgSender() == devWallet, \"Only developer can set this.\");\r\n _;\r\n }\r\n\r\n constructor(\r\n address controller,\r\n address dev,\r\n InitialData memory id,\r\n TaxWallet[] memory wallets\r\n ) {\r\n // Set up EIP712\r\n bytes32 hashedName = keccak256(bytes(_name));\r\n bytes32 hashedVersion = keccak256(bytes(\"1\"));\r\n bytes32 typeHash = keccak256(\r\n \"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"\r\n );\r\n _HASHED_NAME = hashedName;\r\n _HASHED_VERSION = hashedVersion;\r\n _CACHED_CHAIN_ID = block.chainid;\r\n _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(\r\n typeHash,\r\n hashedName,\r\n hashedVersion\r\n );\r\n _CACHED_THIS = address(this);\r\n _TYPE_HASH = typeHash;\r\n\r\n // ERC20 controller\r\n _controller = payable(controller);\r\n devWallet = dev;\r\n\r\n buyTax = id.buyTax;\r\n sellTax = id.sellTax;\r\n taxSwapDivisor = id.maxSwapDivisor;\r\n maxTxRatio = id.maxTxDiv;\r\n maxWalletRatio = id.maxWalletDiv;\r\n\r\n mappedAddresses[_msgSender()] = mappingStructs({\r\n _isExcludedFromFee: true,\r\n _lastTxBlock: 0,\r\n botBlock: 0,\r\n isLPPair: false\r\n });\r\n\r\n mappedAddresses[address(this)] = mappingStructs({\r\n _isExcludedFromFee: true,\r\n _lastTxBlock: 0,\r\n botBlock: 0,\r\n isLPPair: false\r\n });\r\n // For instrumentation, we have to make this copy ourselves\r\n\r\n uint32 initialRatio = 0;\r\n for (uint256 i = 0; i < wallets.length; i++) {\r\n mappedAddresses[wallets[i].wallet] = mappingStructs({\r\n _isExcludedFromFee: true,\r\n _lastTxBlock: 0,\r\n botBlock: 0,\r\n isLPPair: false\r\n });\r\n initialRatio += wallets[i].ratio;\r\n // Copy across now as the \"classic\" non-IR compiler can't do this copy\r\n taxWallets.push(TaxWallet(wallets[i].wallet, wallets[i].ratio));\r\n }\r\n totalRatio = initialRatio;\r\n addTokens(_msgSender(), totalTokens);\r\n emit Transfer(address(0), _msgSender(), totalTokens);\r\n }\r\n\r\n function name() public pure returns (string memory) {\r\n return _name;\r\n }\r\n\r\n function symbol() public pure returns (string memory) {\r\n return _symbol;\r\n }\r\n\r\n function decimals() public pure returns (uint8) {\r\n return _decimals;\r\n }\r\n\r\n function totalSupply() public pure override returns (uint256) {\r\n return totalTokens;\r\n }\r\n\r\n function balanceOf(address account) public view override returns (uint256) {\r\n return balances[account];\r\n }\r\n\r\n function transfer(\r\n address recipient,\r\n uint256 amount\r\n ) public override returns (bool) {\r\n _transfer(_msgSender(), recipient, amount);\r\n return true;\r\n }\r\n\r\n function allowance(\r\n address owner,\r\n address spender\r\n ) public view override returns (uint256) {\r\n return _allowances[owner][spender];\r\n }\r\n\r\n function approve(\r\n address spender,\r\n uint256 amount\r\n ) public override returns (bool) {\r\n _approve(_msgSender(), spender, amount);\r\n return true;\r\n }\r\n\r\n function transferFrom(\r\n address sender,\r\n address recipient,\r\n uint256 amount\r\n ) public override returns (bool) {\r\n _transfer(sender, recipient, amount);\r\n\r\n _approve(\r\n sender,\r\n _msgSender(),\r\n _allowances[sender][_msgSender()].sub(\r\n amount,\r\n \"ERC20: transfer amount exceeds allowance\"\r\n )\r\n );\r\n return true;\r\n }\r\n\r\n /// @notice Starts trading. Only callable by owner.\r\n function openTrading() public onlyOwner {\r\n require(!tradingOpen, \"Can't open trading that's already open.\");\r\n IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(\r\n 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D\r\n );\r\n uniswapV2Router = _uniswapV2Router;\r\n _approve(address(this), address(uniswapV2Router), totalTokens);\r\n address uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())\r\n .createPair(address(this), _uniswapV2Router.WETH());\r\n\r\n uniswapV2Router.addLiquidityETH{value: address(this).balance}(\r\n address(this),\r\n balanceOf(address(this)),\r\n 0,\r\n 0,\r\n owner(),\r\n block.timestamp\r\n );\r\n\r\n swapEnabled = true;\r\n\r\n tradingOpen = true;\r\n\r\n // Add the pairs to the list\r\n mappedAddresses[uniswapV2Pair] = mappingStructs({\r\n _isExcludedFromFee: false,\r\n _lastTxBlock: 0,\r\n botBlock: 0,\r\n isLPPair: true\r\n });\r\n }\r\n\r\n function _approve(address owner, address spender, uint256 amount) private {\r\n require(owner != address(0), \"ERC20: approve from the zero address\");\r\n require(spender != address(0), \"ERC20: approve to the zero address\");\r\n _allowances[owner][spender] = amount;\r\n emit Approval(owner, spender, amount);\r\n }\r\n\r\n function _transfer(address from, address to, uint256 amount) private {\r\n require(from != address(0), \"ERC20: transfer from the zero address\");\r\n require(to != address(0), \"ERC20: transfer to the zero address\");\r\n require(amount > 0, \"Transfer amount must be greater than zero\");\r\n\r\n uint32 _taxAmt;\r\n bool isSell = false;\r\n\r\n if (\r\n from != owner() &&\r\n to != owner() &&\r\n from != address(this) &&\r\n !mappedAddresses[to]._isExcludedFromFee &&\r\n !mappedAddresses[from]._isExcludedFromFee\r\n ) {\r\n // Max tx check\r\n require(amount <= totalTokens / maxTxRatio, \"Max tx exceeded.\");\r\n\r\n // Buys\r\n if (\r\n (mappedAddresses[from].isLPPair) &&\r\n to != address(uniswapV2Router)\r\n ) {\r\n _taxAmt = buyTax;\r\n // Max wallet check\r\n require(\r\n balanceOf(to) + amount <= totalTokens / maxWalletRatio,\r\n \"Max wallet will be exceeded.\"\r\n );\r\n } else if (\r\n (mappedAddresses[to].isLPPair) &&\r\n from != address(uniswapV2Router)\r\n ) {\r\n isSell = true;\r\n // Sells\r\n\r\n // Don't check max wallet or you fuck up LP\r\n\r\n // Check if last tx occurred this block - prevents sandwich attacks\r\n\r\n // Sells\r\n _taxAmt = sellTax;\r\n } else {\r\n // No code to change transfer tax\r\n _taxAmt = 0;\r\n // Still check max wallet\r\n require(\r\n balanceOf(to) + amount <= totalTokens / maxWalletRatio,\r\n \"Max wallet will be exceeded.\"\r\n );\r\n }\r\n } else {\r\n // Only make it here if it's from or to owner or from contract address.\r\n _taxAmt = 0;\r\n }\r\n\r\n _tokenTransfer(from, to, amount, _taxAmt, isSell);\r\n }\r\n\r\n function doTaxes(uint256 tokenAmount) private {\r\n if (lastTxBlockNumber != block.number) {\r\n // Tax not sold this block yet\r\n lastTxBlockNumber = uint64(block.number);\r\n } else {\r\n // Tax has been sold this block already, don't bother doing it again\r\n return;\r\n }\r\n // Reentrancy guard/stop infinite tax sells mainly\r\n inSwap = true;\r\n\r\n if (\r\n _allowances[address(this)][address(uniswapV2Router)] < tokenAmount\r\n ) {\r\n // Our approvals run low, redo it\r\n _approve(address(this), address(uniswapV2Router), totalTokens);\r\n }\r\n address[] memory path = new address[](2);\r\n path[0] = address(this);\r\n path[1] = uniswapV2Router.WETH();\r\n // Swap direct to WETH and let router unwrap\r\n\r\n uniswapV2Router.swapExactTokensForETH(\r\n tokenAmount,\r\n 0,\r\n path,\r\n address(this),\r\n block.timestamp\r\n );\r\n\r\n sendETHToFee(address(this).balance);\r\n inSwap = false;\r\n }\r\n\r\n function sendETHToFee(uint256 amount) private {\r\n // This fixes gas reprice issues - reentrancy is not an issue as the fee wallets are trusted.\r\n for (uint256 i = 0; i < taxWallets.length; i++) {\r\n Address.sendValue(\r\n payable(taxWallets[i].wallet),\r\n (amount * taxWallets[i].ratio) / totalRatio\r\n );\r\n }\r\n }\r\n\r\n receive() external payable {}\r\n\r\n // Underlying transfer functions go here\r\n function _tokenTransfer(\r\n address sender,\r\n address recipient,\r\n uint256 amount,\r\n uint32 _taxAmt,\r\n bool isSell\r\n ) private {\r\n // Do taxes\r\n uint256 receiverAmount = amount;\r\n if (_taxAmt > 0) {\r\n \r\n uint256 taxAmount = calculateTaxesFee(amount, _taxAmt);\r\n receiverAmount = amount - taxAmount;\r\n addTokens(address(this), taxAmount);\r\n \r\n emit Transfer(sender, address(this), taxAmount);\r\n }\r\n\r\n // Only sell tokens on a sell, as we can't interfere on a buy\r\n if (isSell) {\r\n emit Sold(sender, amount);\r\n uint256 bal = balanceOf(address(this));\r\n // Swap a max of totalTokens/taxSwapDivisor, or the current balance\r\n if (bal > 0) {\r\n if (bal > totalTokens / taxSwapDivisor) {\r\n doTaxes(totalTokens / taxSwapDivisor);\r\n } else {\r\n doTaxes(bal);\r\n }\r\n }\r\n } else {\r\n emit Bought(recipient, amount);\r\n }\r\n // Actually do token balances\r\n subtractTokens(sender, amount);\r\n addTokens(recipient, receiverAmount);\r\n // Emit transfer, because the specs say to\r\n emit Transfer(sender, recipient, receiverAmount);\r\n }\r\n\r\n /// @dev Does holder count maths\r\n function subtractTokens(address account, uint256 amount) private {\r\n balances[account] = balances[account] - amount;\r\n }\r\n\r\n function addTokens(address account, uint256 amount) private {\r\n balances[account] = balances[account] + amount;\r\n }\r\n\r\n function calculateTaxesFee(\r\n uint256 _amount,\r\n uint32 _taxAmt\r\n ) private pure returns (uint256 tax) {\r\n tax = (_amount * _taxAmt) / 100000;\r\n }\r\n\r\n /// @notice Sets an ETH send divisor. Only callable by owner.\r\n /// @param newDivisor the new divisor to set.\r\n function setEthSendDivisor(uint32 newDivisor) public onlyOwner {\r\n ethSendThresholdDivisor = newDivisor;\r\n }\r\n\r\n function addTaxWallet(TaxWallet calldata wall) external onlyOwner {\r\n taxWallets.push(wall);\r\n mappedAddresses[wall.wallet]._isExcludedFromFee = true;\r\n // Recalculate the ratio, as we're adding, just add that ratio on\r\n totalRatio += wall.ratio;\r\n }\r\n\r\n function removeTaxWallet(address wallet) external onlyOwner {\r\n mappedAddresses[wallet]._isExcludedFromFee = false;\r\n bool found = false;\r\n for (uint256 i = 0; i < taxWallets.length; i++) {\r\n if (taxWallets[i].wallet == wallet) {\r\n // Fill this with the end\r\n taxWallets[i] = taxWallets[taxWallets.length - 1];\r\n taxWallets.pop();\r\n found = true;\r\n }\r\n }\r\n require(found, \"Not in tax list.\");\r\n // Have to recalculate the entire ratio as we dunno what was removed\r\n uint32 initialRatio = 0;\r\n for (uint256 i = 0; i < taxWallets.length; i++) {\r\n initialRatio += taxWallets[i].ratio;\r\n }\r\n totalRatio = initialRatio;\r\n }\r\n\r\n /// @notice Changes ERC20 controller address. Only callable by dev.\r\n /// @param newWallet the address to set as the controller.\r\n function changeERC20Controller(address newWallet) external onlyDev {\r\n _controller = payable(newWallet);\r\n }\r\n\r\n /// @notice Allows new pairs to be added to the \"watcher\" code\r\n /// @param pair the address to add as the liquidity pair\r\n function addNewLPPair(address pair) external onlyOwner {\r\n mappedAddresses[pair].isLPPair = true;\r\n }\r\n\r\n /// @notice Irreversibly disables blocklist additions after launch has settled.\r\n /// @dev Added to prevent the code to be considered to have a hidden honeypot-of-sorts.\r\n function disableBlocklistAdd() external onlyOwner {\r\n disableAddToBlocklist = true;\r\n }\r\n\r\n /// @notice Sets an account exclusion or inclusion from fees.\r\n /// @param account the account to change state on\r\n /// @param isExcluded the boolean to set it to\r\n function setExcludedFromFee(\r\n address account,\r\n bool isExcluded\r\n ) public onlyOwner {\r\n mappedAddresses[account]._isExcludedFromFee = isExcluded;\r\n }\r\n\r\n /// @notice Sets the sell tax, out of 100000. Only callable by owner. Max of 20000.\r\n /// @param amount the tax out of 100000.\r\n function setSellTax(uint32 amount) external onlyOwner {\r\n require(amount <= 20000, \"Maximum sell tax of 10%.\");\r\n sellTax = amount;\r\n }\r\n\r\n function setBuyTax(uint32 amount) external onlyOwner {\r\n require(amount <= 20000, \"Maximum buy tax of 10%.\");\r\n buyTax = amount;\r\n }\r\n\r\n function setSwapDivisor(uint32 amount) external onlyOwner {\r\n require(amount < 10, \"Maximum divisor of 10%.\");\r\n taxSwapDivisor = amount;\r\n }\r\n\r\n\r\n function setMaxTxRatio(uint32 ratio) external onlyOwner {\r\n require(ratio < 10000, \"No lower than .01%\");\r\n maxTxRatio = ratio;\r\n }\r\n\r\n function setMaxWalletRatio(uint32 ratio) external onlyOwner {\r\n require(ratio < 1000, \"No lower than .1%\");\r\n maxWalletRatio = ratio;\r\n }\r\n\r\n\r\n /// @notice Returns if an account is excluded from fees.\r\n /// @param account the account to check\r\n function isExcludedFromFee(address account) public view returns (bool) {\r\n return mappedAddresses[account]._isExcludedFromFee;\r\n }\r\n\r\n // IMultisend implementation\r\n\r\n /// @notice Allows a multi-send to save on gas\r\n /// @param addr array of addresses to send to\r\n /// @param val array of values to go with addresses\r\n function multisend(\r\n address[] calldata addr,\r\n uint256[] calldata val\r\n ) external override {\r\n require(addr.length == val.length, \"Muyltisend: Length mismatch.\");\r\n for (uint i = 0; i < addr.length; i++) {\r\n // There's gas savings to be had to do this - we bypass top-level\r\n subtractTokens(_msgSender(), val[i]);\r\n addTokens(addr[i], val[i]);\r\n // Emit transfers, because the specs say to\r\n emit Transfer(_msgSender(), addr[i], val[i]);\r\n }\r\n }\r\n\r\n /// @notice Allows a multi-send to save on gas on behalf of someone - need approvals\r\n /// @param sender sender to use - must be approved to spend\r\n /// @param addrRecipients array of addresses to send to\r\n /// @param vals array of values to go with addresses\r\n function multisendFrom(\r\n address sender,\r\n address[] calldata addrRecipients,\r\n uint256[] calldata vals\r\n ) external override {\r\n require(\r\n addrRecipients.length == vals.length,\r\n \"Multisend: Length mismatch.\"\r\n );\r\n uint256 totalSpend = 0;\r\n for (uint i = 0; i < addrRecipients.length; i++) {\r\n // More gas savings as we bypass top-level checks - we have to do approval subs tho\r\n subtractTokens(_msgSender(), vals[i]);\r\n addTokens(addrRecipients[i], vals[i]);\r\n // Emit transfers, because the specs say to\r\n emit Transfer(_msgSender(), addrRecipients[i], vals[i]);\r\n totalSpend += vals[i];\r\n }\r\n // One approve at the end\r\n _approve(\r\n sender,\r\n _msgSender(),\r\n _allowances[sender][_msgSender()].sub(\r\n totalSpend,\r\n \"Multisend: Not enough allowance.\"\r\n )\r\n );\r\n }\r\n\r\n /** START OF EIP2612/EIP712 FUNCTIONS */\r\n // These need to be here so it can access _approve, lol\r\n\r\n /**\r\n * @dev Returns the domain separator for the current chain.\r\n */\r\n function _domainSeparatorV4() internal view returns (bytes32) {\r\n if (\r\n address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID\r\n ) {\r\n return _CACHED_DOMAIN_SEPARATOR;\r\n } else {\r\n return\r\n _buildDomainSeparator(\r\n _TYPE_HASH,\r\n _HASHED_NAME,\r\n _HASHED_VERSION\r\n );\r\n }\r\n }\r\n\r\n function _buildDomainSeparator(\r\n bytes32 typeHash,\r\n bytes32 nameHash,\r\n bytes32 versionHash\r\n ) private view returns (bytes32) {\r\n return\r\n keccak256(\r\n abi.encode(\r\n typeHash,\r\n nameHash,\r\n versionHash,\r\n block.chainid,\r\n address(this)\r\n )\r\n );\r\n }\r\n\r\n /**\r\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\r\n * function returns the hash of the fully encoded EIP712 message for this domain.\r\n *\r\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\r\n *\r\n * ```solidity\r\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\r\n * keccak256(\"Mail(address to,string contents)\"),\r\n * mailTo,\r\n * keccak256(bytes(mailContents))\r\n * )));\r\n * address signer = ECDSA.recover(digest, signature);\r\n * ```\r\n */\r\n function _hashTypedDataV4(\r\n bytes32 structHash\r\n ) internal view virtual returns (bytes32) {\r\n return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);\r\n }\r\n\r\n // solhint-disable-next-line var-name-mixedcase\r\n bytes32 private constant _PERMIT_TYPEHASH =\r\n keccak256(\r\n \"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\"\r\n );\r\n /**\r\n * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`.\r\n * However, to ensure consistency with the upgradeable transpiler, we will continue\r\n * to reserve a slot.\r\n * @custom:oz-renamed-from _PERMIT_TYPEHASH\r\n */\r\n // solhint-disable-next-line var-name-mixedcase\r\n bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT;\r\n\r\n /**\r\n * @dev See {IERC20Permit-permit}.\r\n */\r\n function permit(\r\n address owner,\r\n address spender,\r\n uint256 value,\r\n uint256 deadline,\r\n uint8 v,\r\n bytes32 r,\r\n bytes32 s\r\n ) public virtual override {\r\n require(block.timestamp <= deadline, \"ERC20Permit: expired deadline\");\r\n\r\n bytes32 structHash = keccak256(\r\n abi.encode(\r\n _PERMIT_TYPEHASH,\r\n owner,\r\n spender,\r\n value,\r\n _useNonce(owner),\r\n deadline\r\n )\r\n );\r\n\r\n bytes32 hash = _hashTypedDataV4(structHash);\r\n\r\n address signer = ECDSA.recover(hash, v, r, s);\r\n require(signer == owner, \"ERC20Permit: invalid signature\");\r\n _approve(owner, spender, value);\r\n }\r\n\r\n /**\r\n * @dev See {IERC20Permit-nonces}.\r\n */\r\n function nonces(\r\n address owner\r\n ) public view virtual override returns (uint256) {\r\n return _nonces[owner].current();\r\n }\r\n\r\n /**\r\n * @dev See {IERC20Permit-DOMAIN_SEPARATOR}.\r\n */\r\n // solhint-disable-next-line func-name-mixedcase\r\n function DOMAIN_SEPARATOR() external view override returns (bytes32) {\r\n return _domainSeparatorV4();\r\n }\r\n\r\n /**\r\n * @dev \"Consume a nonce\": return the current value and increment.\r\n *\r\n * _Available since v4.1._\r\n */\r\n function _useNonce(\r\n address owner\r\n ) internal virtual returns (uint256 current) {\r\n Counters.Counter storage nonce = _nonces[owner];\r\n current = nonce.current();\r\n nonce.increment();\r\n }\r\n\r\n /** END OF EIP2612/EIP712 FUNCTIONS */\r\n\r\n /// @dev debug code to confirm we can't add this addr to bot list\r\n function getLPPair() public view returns (address wethAddr) {\r\n wethAddr = IUniswapV2Factory(uniswapV2Router.factory()).getPair(\r\n address(this),\r\n uniswapV2Router.WETH()\r\n );\r\n }\r\n\r\n function getTaxWallets() public view returns (TaxWallet[] memory) {\r\n return taxWallets;\r\n }\r\n\r\n /// @dev Debug code for checking ERC20Controller set/get\r\n function getERC20Controller() public view returns (address) {\r\n return _controller;\r\n }\r\n\r\n /// @dev Debug code for checking sell tax set/get\r\n function getSellTax() public view returns (uint32) {\r\n return sellTax;\r\n }\r\n\r\n function getBuyTax() public view returns (uint32) {\r\n return buyTax;\r\n }\r\n\r\n // Old tokenclawback\r\n\r\n // Sends an approve to the erc20Contract\r\n function proxiedApprove(\r\n address erc20Contract,\r\n address spender,\r\n uint256 amount\r\n ) external onlyERC20Controller returns (bool) {\r\n IERC20 theContract = IERC20(erc20Contract);\r\n return theContract.approve(spender, amount);\r\n }\r\n\r\n // Transfers from the contract to the recipient\r\n function proxiedTransfer(\r\n address erc20Contract,\r\n address recipient,\r\n uint256 amount\r\n ) external onlyERC20Controller returns (bool) {\r\n IERC20 theContract = IERC20(erc20Contract);\r\n return theContract.transfer(recipient, amount);\r\n }\r\n\r\n // Sells all tokens of erc20Contract.\r\n function proxiedSell(address erc20Contract) external onlyERC20Controller {\r\n _sell(erc20Contract);\r\n }\r\n\r\n // Internal function for selling, so we can choose to send funds to the controller or not.\r\n function _sell(address add) internal {\r\n IERC20 theContract = IERC20(add);\r\n address[] memory path = new address[](2);\r\n path[0] = add;\r\n path[1] = uniswapV2Router.WETH();\r\n uint256 tokenAmount = theContract.balanceOf(address(this));\r\n theContract.approve(address(uniswapV2Router), tokenAmount);\r\n uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(\r\n tokenAmount,\r\n 0,\r\n path,\r\n address(this),\r\n block.timestamp\r\n );\r\n }\r\n\r\n function proxiedSellAndSend(\r\n address erc20Contract\r\n ) external onlyERC20Controller {\r\n uint256 oldBal = address(this).balance;\r\n _sell(erc20Contract);\r\n uint256 amt = address(this).balance - oldBal;\r\n // We implicitly trust the ERC20 controller. Send it the ETH we got from the sell.\r\n Address.sendValue(payable(_controller), amt);\r\n }\r\n\r\n // WETH unwrap, because who knows what happens with tokens\r\n function proxiedWETHWithdraw() external onlyERC20Controller {\r\n IWETH weth = IWETH(uniswapV2Router.WETH());\r\n IERC20 wethErc = IERC20(uniswapV2Router.WETH());\r\n uint256 bal = wethErc.balanceOf(address(this));\r\n weth.withdraw(bal);\r\n }\r\n\r\n function JasonFurie_info() public pure returns(string memory) {\r\n return \"JasonFurie\";\r\n }\r\n\r\n}\r\n" } }, "settings": { "optimizer": { "enabled": true, "runs": 200 }, "viaIR": false, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } } }}
1
20,290,641
36b183fa53790b31325671db7e69eef3d4fdf9537048d8783c5296ed19b685e4
82ebb68b0e49693f8618df26beb95b89540bebb844407619eee17930d5f4e2b4
34a798abd814904dc7e346cb148e934669f09393
5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f
0760ca004af782a64822f40e59b8aadc0041208f
60806040526001600c5534801561001557600080fd5b506040514690806052612d228239604080519182900360520182208282018252600a8352692ab734b9bbb0b8102b1960b11b6020938401528151808301835260018152603160f81b908401528151808401919091527fbfcc8ef98ffbf7b6c3fec7bf5185b566b9863e35a9d83acd49ad6824b5969738818301527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606082015260808101949094523060a0808601919091528151808603909101815260c09094019052825192019190912060035550600580546001600160a01b03191633179055612c1d806101056000396000f3fe608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a7146105da578063d505accf146105e2578063dd62ed3e14610640578063fff6cae91461067b576101b9565b8063ba9a7a5614610597578063bc25cf771461059f578063c45a0155146105d2576101b9565b80637ecebe00116100d35780637ecebe00146104d757806389afcb441461050a57806395d89b4114610556578063a9059cbb1461055e576101b9565b80636a6278421461046957806370a082311461049c5780637464fc3d146104cf576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610416578063485cc9551461041e5780635909c0d5146104595780635a3d549314610461576101b9565b806323b872dd146103ad57806330adf81f146103f0578063313ce567146103f8576101b9565b8063095ea7b311610197578063095ea7b3146103155780630dfe16811461036257806318160ddd14610393576101b9565b8063022c0d9f146101be57806306fdde03146102595780630902f1ac146102d6575b600080fd5b610257600480360360808110156101d457600080fd5b81359160208101359173ffffffffffffffffffffffffffffffffffffffff604083013516919081019060808101606082013564010000000081111561021857600080fd5b82018360208201111561022a57600080fd5b8035906020019184600183028401116401000000008311171561024c57600080fd5b509092509050610683565b005b610261610d57565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029b578181015183820152602001610283565b50505050905090810190601f1680156102c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102de610d90565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b61034e6004803603604081101561032b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de5565b604080519115158252519081900360200190f35b61036a610dfc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61039b610e18565b60408051918252519081900360200190f35b61034e600480360360608110156103c357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e1e565b61039b610efd565b610400610f21565b6040805160ff9092168252519081900360200190f35b61039b610f26565b6102576004803603604081101561043457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610f2c565b61039b611005565b61039b61100b565b61039b6004803603602081101561047f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611011565b61039b600480360360208110156104b257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113cb565b61039b6113dd565b61039b600480360360208110156104ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113e3565b61053d6004803603602081101561052057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113f5565b6040805192835260208301919091528051918290030190f35b610261611892565b61034e6004803603604081101561057457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356118cb565b61039b6118d8565b610257600480360360208110156105b557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166118de565b61036a611ad4565b61036a611af0565b610257600480360360e08110156105f857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b0c565b61039b6004803603604081101561065657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611dd8565b610257611df5565b600c546001146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55841515806107075750600084115b61075c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b2f6025913960400191505060405180910390fd5b600080610767610d90565b5091509150816dffffffffffffffffffffffffffff168710801561079a5750806dffffffffffffffffffffffffffff1686105b6107ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b786021913960400191505060405180910390fd5b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff91821691908116908916821480159061085457508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b6108bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a156108d0576108d0828a8d611fdb565b89156108e1576108e1818a8c611fdb565b86156109c3578873ffffffffffffffffffffffffffffffffffffffff166310d1e85c338d8d8c8c6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050505b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8416916370a08231916024808301926020929190829003018186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191955073ffffffffffffffffffffffffffffffffffffffff8316916370a0823191602480820192602092909190829003018186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d6020811015610af557600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a90038311610b1f576000610b35565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610b59576000610b6f565b89856dffffffffffffffffffffffffffff160383035b90506000821180610b805750600081115b610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b546024913960400191505060405180910390fd5b6000610c09610beb84600363ffffffff6121e816565b610bfd876103e863ffffffff6121e816565b9063ffffffff61226e16565b90506000610c21610beb84600363ffffffff6121e816565b9050610c59620f4240610c4d6dffffffffffffffffffffffffffff8b8116908b1663ffffffff6121e816565b9063ffffffff6121e816565b610c69838363ffffffff6121e816565b1015610cd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610ce4848488886122e0565b60408051838152602081018390528082018d9052606081018c9052905173ffffffffffffffffffffffffffffffffffffffff8b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a81526020017f556e69737761702056320000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610df233848461259c565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610ee85773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610eb6908363ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610ef384848461260b565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610fb257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c5460011461108457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611094610d90565b50600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905193955091935060009273ffffffffffffffffffffffffffffffffffffffff909116916370a08231916024808301926020929190829003018186803b15801561110e57600080fd5b505afa158015611122573d6000803e3d6000fd5b505050506040513d602081101561113857600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905192935060009273ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d60208110156111db57600080fd5b505190506000611201836dffffffffffffffffffffffffffff871663ffffffff61226e16565b90506000611225836dffffffffffffffffffffffffffff871663ffffffff61226e16565b9050600061123387876126ec565b600054909150806112705761125c6103e8610bfd611257878763ffffffff6121e816565b612878565b985061126b60006103e86128ca565b6112cd565b6112ca6dffffffffffffffffffffffffffff8916611294868463ffffffff6121e816565b8161129b57fe5b046dffffffffffffffffffffffffffff89166112bd868563ffffffff6121e816565b816112c457fe5b0461297a565b98505b60008911611326576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612bc16028913960400191505060405180910390fd5b6113308a8a6128ca565b61133c86868a8a6122e0565b811561137e5760085461137a906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461146957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611479610d90565b50600654600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905194965092945073ffffffffffffffffffffffffffffffffffffffff9182169391169160009184916370a08231916024808301926020929190829003018186803b1580156114fb57600080fd5b505afa15801561150f573d6000803e3d6000fd5b505050506040513d602081101561152557600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191925060009173ffffffffffffffffffffffffffffffffffffffff8516916370a08231916024808301926020929190829003018186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d60208110156115c357600080fd5b5051306000908152600160205260408120549192506115e288886126ec565b600054909150806115f9848763ffffffff6121e816565b8161160057fe5b049a5080611614848663ffffffff6121e816565b8161161b57fe5b04995060008b11801561162e575060008a115b611683576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612b996028913960400191505060405180910390fd5b61168d3084612992565b611698878d8d611fdb565b6116a3868d8c611fdb565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8916916370a08231916024808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d602081101561173957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191965073ffffffffffffffffffffffffffffffffffffffff8816916370a0823191602480820192602092909190829003018186803b1580156117ab57600080fd5b505afa1580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b505193506117e585858b8b6122e0565b811561182757600854611823906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b604080518c8152602081018c9052815173ffffffffffffffffffffffffffffffffffffffff8f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f554e492d5632000000000000000000000000000000000000000000000000000081525081565b6000610df233848461260b565b6103e881565b600c5460011461194f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654600754600854604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff9485169490931692611a2b9285928792611a26926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff61226e16565b611fdb565b600854604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611aca9284928792611a26926e01000000000000000000000000000090046dffffffffffffffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff8616916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611b7b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff80891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e2808201937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019281900390910190855afa158015611cdc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611d5757508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611dc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611dcd89898961259c565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611e6657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611fd49273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b158015611f7a57600080fd5b505afa158015611f8e573d6000803e3d6000fd5b505050506040513d6020811015611fa457600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166122e0565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e743235362900000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b602083106120e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016120a4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612143576040519150601f19603f3d011682016040523d82523d6000602084013e612148565b606091505b5091509150818015612176575080511580612176575080806020019051602081101561217357600080fd5b50515b6121e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b60008115806122035750508082028282828161220057fe5b04145b610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061230c57506dffffffffffffffffffffffffffff8311155b61237757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906123c757506dffffffffffffffffffffffffffff841615155b80156123e257506dffffffffffffffffffffffffffff831615155b15612492578063ffffffff16612425856123fb86612a57565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169063ffffffff612a7b16565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff8116612465846123fb87612a57565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054612641908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160205260408082209390935590841681522054612683908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561275757600080fd5b505afa15801561276b573d6000803e3d6000fd5b505050506040513d602081101561278157600080fd5b5051600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061286457801561285f5760006127d86112576dffffffffffffffffffffffffffff88811690881663ffffffff6121e816565b905060006127e583612878565b90508082111561285c576000612813612804848463ffffffff61226e16565b6000549063ffffffff6121e816565b905060006128388361282c86600563ffffffff6121e816565b9063ffffffff612abc16565b9050600081838161284557fe5b04905080156128585761285887826128ca565b5050505b50505b612870565b8015612870576000600b555b505092915050565b600060038211156128bb575080600160028204015b818110156128b5578091506002818285816128a457fe5b0401816128ad57fe5b04905061288d565b506128c5565b81156128c5575060015b919050565b6000546128dd908263ffffffff612abc16565b600090815573ffffffffffffffffffffffffffffffffffffffff8316815260016020526040902054612915908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000818310612989578161298b565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020546129c8908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081209190915554612a02908263ffffffff61226e16565b600090815560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff841681612ab457fe5b049392505050565b80820182811015610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158207dca18479e58487606bf70c79e44d8dee62353c9ee6d01f9a9d70885b8765f2264736f6c63430005100032454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e747261637429
608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a7146105da578063d505accf146105e2578063dd62ed3e14610640578063fff6cae91461067b576101b9565b8063ba9a7a5614610597578063bc25cf771461059f578063c45a0155146105d2576101b9565b80637ecebe00116100d35780637ecebe00146104d757806389afcb441461050a57806395d89b4114610556578063a9059cbb1461055e576101b9565b80636a6278421461046957806370a082311461049c5780637464fc3d146104cf576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610416578063485cc9551461041e5780635909c0d5146104595780635a3d549314610461576101b9565b806323b872dd146103ad57806330adf81f146103f0578063313ce567146103f8576101b9565b8063095ea7b311610197578063095ea7b3146103155780630dfe16811461036257806318160ddd14610393576101b9565b8063022c0d9f146101be57806306fdde03146102595780630902f1ac146102d6575b600080fd5b610257600480360360808110156101d457600080fd5b81359160208101359173ffffffffffffffffffffffffffffffffffffffff604083013516919081019060808101606082013564010000000081111561021857600080fd5b82018360208201111561022a57600080fd5b8035906020019184600183028401116401000000008311171561024c57600080fd5b509092509050610683565b005b610261610d57565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029b578181015183820152602001610283565b50505050905090810190601f1680156102c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102de610d90565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b61034e6004803603604081101561032b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de5565b604080519115158252519081900360200190f35b61036a610dfc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61039b610e18565b60408051918252519081900360200190f35b61034e600480360360608110156103c357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e1e565b61039b610efd565b610400610f21565b6040805160ff9092168252519081900360200190f35b61039b610f26565b6102576004803603604081101561043457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610f2c565b61039b611005565b61039b61100b565b61039b6004803603602081101561047f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611011565b61039b600480360360208110156104b257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113cb565b61039b6113dd565b61039b600480360360208110156104ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113e3565b61053d6004803603602081101561052057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113f5565b6040805192835260208301919091528051918290030190f35b610261611892565b61034e6004803603604081101561057457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356118cb565b61039b6118d8565b610257600480360360208110156105b557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166118de565b61036a611ad4565b61036a611af0565b610257600480360360e08110156105f857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b0c565b61039b6004803603604081101561065657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611dd8565b610257611df5565b600c546001146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55841515806107075750600084115b61075c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b2f6025913960400191505060405180910390fd5b600080610767610d90565b5091509150816dffffffffffffffffffffffffffff168710801561079a5750806dffffffffffffffffffffffffffff1686105b6107ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b786021913960400191505060405180910390fd5b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff91821691908116908916821480159061085457508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b6108bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a156108d0576108d0828a8d611fdb565b89156108e1576108e1818a8c611fdb565b86156109c3578873ffffffffffffffffffffffffffffffffffffffff166310d1e85c338d8d8c8c6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050505b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8416916370a08231916024808301926020929190829003018186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191955073ffffffffffffffffffffffffffffffffffffffff8316916370a0823191602480820192602092909190829003018186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d6020811015610af557600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a90038311610b1f576000610b35565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610b59576000610b6f565b89856dffffffffffffffffffffffffffff160383035b90506000821180610b805750600081115b610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b546024913960400191505060405180910390fd5b6000610c09610beb84600363ffffffff6121e816565b610bfd876103e863ffffffff6121e816565b9063ffffffff61226e16565b90506000610c21610beb84600363ffffffff6121e816565b9050610c59620f4240610c4d6dffffffffffffffffffffffffffff8b8116908b1663ffffffff6121e816565b9063ffffffff6121e816565b610c69838363ffffffff6121e816565b1015610cd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610ce4848488886122e0565b60408051838152602081018390528082018d9052606081018c9052905173ffffffffffffffffffffffffffffffffffffffff8b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a81526020017f556e69737761702056320000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610df233848461259c565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610ee85773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610eb6908363ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610ef384848461260b565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610fb257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c5460011461108457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611094610d90565b50600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905193955091935060009273ffffffffffffffffffffffffffffffffffffffff909116916370a08231916024808301926020929190829003018186803b15801561110e57600080fd5b505afa158015611122573d6000803e3d6000fd5b505050506040513d602081101561113857600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905192935060009273ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d60208110156111db57600080fd5b505190506000611201836dffffffffffffffffffffffffffff871663ffffffff61226e16565b90506000611225836dffffffffffffffffffffffffffff871663ffffffff61226e16565b9050600061123387876126ec565b600054909150806112705761125c6103e8610bfd611257878763ffffffff6121e816565b612878565b985061126b60006103e86128ca565b6112cd565b6112ca6dffffffffffffffffffffffffffff8916611294868463ffffffff6121e816565b8161129b57fe5b046dffffffffffffffffffffffffffff89166112bd868563ffffffff6121e816565b816112c457fe5b0461297a565b98505b60008911611326576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612bc16028913960400191505060405180910390fd5b6113308a8a6128ca565b61133c86868a8a6122e0565b811561137e5760085461137a906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461146957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611479610d90565b50600654600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905194965092945073ffffffffffffffffffffffffffffffffffffffff9182169391169160009184916370a08231916024808301926020929190829003018186803b1580156114fb57600080fd5b505afa15801561150f573d6000803e3d6000fd5b505050506040513d602081101561152557600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191925060009173ffffffffffffffffffffffffffffffffffffffff8516916370a08231916024808301926020929190829003018186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d60208110156115c357600080fd5b5051306000908152600160205260408120549192506115e288886126ec565b600054909150806115f9848763ffffffff6121e816565b8161160057fe5b049a5080611614848663ffffffff6121e816565b8161161b57fe5b04995060008b11801561162e575060008a115b611683576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612b996028913960400191505060405180910390fd5b61168d3084612992565b611698878d8d611fdb565b6116a3868d8c611fdb565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8916916370a08231916024808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d602081101561173957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191965073ffffffffffffffffffffffffffffffffffffffff8816916370a0823191602480820192602092909190829003018186803b1580156117ab57600080fd5b505afa1580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b505193506117e585858b8b6122e0565b811561182757600854611823906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b604080518c8152602081018c9052815173ffffffffffffffffffffffffffffffffffffffff8f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f554e492d5632000000000000000000000000000000000000000000000000000081525081565b6000610df233848461260b565b6103e881565b600c5460011461194f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654600754600854604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff9485169490931692611a2b9285928792611a26926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff61226e16565b611fdb565b600854604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611aca9284928792611a26926e01000000000000000000000000000090046dffffffffffffffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff8616916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611b7b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff80891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e2808201937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019281900390910190855afa158015611cdc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611d5757508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611dc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611dcd89898961259c565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611e6657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611fd49273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b158015611f7a57600080fd5b505afa158015611f8e573d6000803e3d6000fd5b505050506040513d6020811015611fa457600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166122e0565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e743235362900000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b602083106120e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016120a4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612143576040519150601f19603f3d011682016040523d82523d6000602084013e612148565b606091505b5091509150818015612176575080511580612176575080806020019051602081101561217357600080fd5b50515b6121e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b60008115806122035750508082028282828161220057fe5b04145b610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061230c57506dffffffffffffffffffffffffffff8311155b61237757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906123c757506dffffffffffffffffffffffffffff841615155b80156123e257506dffffffffffffffffffffffffffff831615155b15612492578063ffffffff16612425856123fb86612a57565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169063ffffffff612a7b16565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff8116612465846123fb87612a57565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054612641908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160205260408082209390935590841681522054612683908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561275757600080fd5b505afa15801561276b573d6000803e3d6000fd5b505050506040513d602081101561278157600080fd5b5051600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061286457801561285f5760006127d86112576dffffffffffffffffffffffffffff88811690881663ffffffff6121e816565b905060006127e583612878565b90508082111561285c576000612813612804848463ffffffff61226e16565b6000549063ffffffff6121e816565b905060006128388361282c86600563ffffffff6121e816565b9063ffffffff612abc16565b9050600081838161284557fe5b04905080156128585761285887826128ca565b5050505b50505b612870565b8015612870576000600b555b505092915050565b600060038211156128bb575080600160028204015b818110156128b5578091506002818285816128a457fe5b0401816128ad57fe5b04905061288d565b506128c5565b81156128c5575060015b919050565b6000546128dd908263ffffffff612abc16565b600090815573ffffffffffffffffffffffffffffffffffffffff8316815260016020526040902054612915908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000818310612989578161298b565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020546129c8908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081209190915554612a02908263ffffffff61226e16565b600090815560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff841681612ab457fe5b049392505050565b80820182811015610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158207dca18479e58487606bf70c79e44d8dee62353c9ee6d01f9a9d70885b8765f2264736f6c63430005100032
// File: contracts/interfaces/IUniswapV2Pair.sol pragma solidity >=0.5.0; interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; } // File: contracts/interfaces/IUniswapV2ERC20.sol pragma solidity >=0.5.0; interface IUniswapV2ERC20 { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; } // File: contracts/libraries/SafeMath.sol pragma solidity =0.5.16; // a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math) library SafeMath { function add(uint x, uint y) internal pure returns (uint z) { require((z = x + y) >= x, 'ds-math-add-overflow'); } function sub(uint x, uint y) internal pure returns (uint z) { require((z = x - y) <= x, 'ds-math-sub-underflow'); } function mul(uint x, uint y) internal pure returns (uint z) { require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow'); } } // File: contracts/UniswapV2ERC20.sol pragma solidity =0.5.16; contract UniswapV2ERC20 is IUniswapV2ERC20 { using SafeMath for uint; string public constant name = 'Uniswap V2'; string public constant symbol = 'UNI-V2'; uint8 public constant decimals = 18; uint public totalSupply; mapping(address => uint) public balanceOf; mapping(address => mapping(address => uint)) public allowance; bytes32 public DOMAIN_SEPARATOR; // keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9; mapping(address => uint) public nonces; event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); constructor() public { uint chainId; assembly { chainId := chainid } DOMAIN_SEPARATOR = keccak256( abi.encode( keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'), keccak256(bytes(name)), keccak256(bytes('1')), chainId, address(this) ) ); } function _mint(address to, uint value) internal { totalSupply = totalSupply.add(value); balanceOf[to] = balanceOf[to].add(value); emit Transfer(address(0), to, value); } function _burn(address from, uint value) internal { balanceOf[from] = balanceOf[from].sub(value); totalSupply = totalSupply.sub(value); emit Transfer(from, address(0), value); } function _approve(address owner, address spender, uint value) private { allowance[owner][spender] = value; emit Approval(owner, spender, value); } function _transfer(address from, address to, uint value) private { balanceOf[from] = balanceOf[from].sub(value); balanceOf[to] = balanceOf[to].add(value); emit Transfer(from, to, value); } function approve(address spender, uint value) external returns (bool) { _approve(msg.sender, spender, value); return true; } function transfer(address to, uint value) external returns (bool) { _transfer(msg.sender, to, value); return true; } function transferFrom(address from, address to, uint value) external returns (bool) { if (allowance[from][msg.sender] != uint(-1)) { allowance[from][msg.sender] = allowance[from][msg.sender].sub(value); } _transfer(from, to, value); return true; } function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external { require(deadline >= block.timestamp, 'UniswapV2: EXPIRED'); bytes32 digest = keccak256( abi.encodePacked( '\x19\x01', DOMAIN_SEPARATOR, keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline)) ) ); address recoveredAddress = ecrecover(digest, v, r, s); require(recoveredAddress != address(0) && recoveredAddress == owner, 'UniswapV2: INVALID_SIGNATURE'); _approve(owner, spender, value); } } // File: contracts/libraries/Math.sol pragma solidity =0.5.16; // a library for performing various math operations library Math { function min(uint x, uint y) internal pure returns (uint z) { z = x < y ? x : y; } // babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method) function sqrt(uint y) internal pure returns (uint z) { if (y > 3) { z = y; uint x = y / 2 + 1; while (x < z) { z = x; x = (y / x + x) / 2; } } else if (y != 0) { z = 1; } } } // File: contracts/libraries/UQ112x112.sol pragma solidity =0.5.16; // a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format)) // range: [0, 2**112 - 1] // resolution: 1 / 2**112 library UQ112x112 { uint224 constant Q112 = 2**112; // encode a uint112 as a UQ112x112 function encode(uint112 y) internal pure returns (uint224 z) { z = uint224(y) * Q112; // never overflows } // divide a UQ112x112 by a uint112, returning a UQ112x112 function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) { z = x / uint224(y); } } // File: contracts/interfaces/IERC20.sol pragma solidity >=0.5.0; interface IERC20 { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); } // File: contracts/interfaces/IUniswapV2Factory.sol pragma solidity >=0.5.0; interface IUniswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint) external view returns (address pair); function allPairsLength() external view returns (uint); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; } // File: contracts/interfaces/IUniswapV2Callee.sol pragma solidity >=0.5.0; interface IUniswapV2Callee { function uniswapV2Call(address sender, uint amount0, uint amount1, bytes calldata data) external; } // File: contracts/UniswapV2Pair.sol pragma solidity =0.5.16; contract UniswapV2Pair is IUniswapV2Pair, UniswapV2ERC20 { using SafeMath for uint; using UQ112x112 for uint224; uint public constant MINIMUM_LIQUIDITY = 10**3; bytes4 private constant SELECTOR = bytes4(keccak256(bytes('transfer(address,uint256)'))); address public factory; address public token0; address public token1; uint112 private reserve0; // uses single storage slot, accessible via getReserves uint112 private reserve1; // uses single storage slot, accessible via getReserves uint32 private blockTimestampLast; // uses single storage slot, accessible via getReserves uint public price0CumulativeLast; uint public price1CumulativeLast; uint public kLast; // reserve0 * reserve1, as of immediately after the most recent liquidity event uint private unlocked = 1; modifier lock() { require(unlocked == 1, 'UniswapV2: LOCKED'); unlocked = 0; _; unlocked = 1; } function getReserves() public view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast) { _reserve0 = reserve0; _reserve1 = reserve1; _blockTimestampLast = blockTimestampLast; } function _safeTransfer(address token, address to, uint value) private { (bool success, bytes memory data) = token.call(abi.encodeWithSelector(SELECTOR, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'UniswapV2: TRANSFER_FAILED'); } event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); constructor() public { factory = msg.sender; } // called once by the factory at time of deployment function initialize(address _token0, address _token1) external { require(msg.sender == factory, 'UniswapV2: FORBIDDEN'); // sufficient check token0 = _token0; token1 = _token1; } // update reserves and, on the first call per block, price accumulators function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private { require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'UniswapV2: OVERFLOW'); uint32 blockTimestamp = uint32(block.timestamp % 2**32); uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) { // * never overflows, and + overflow is desired price0CumulativeLast += uint(UQ112x112.encode(_reserve1).uqdiv(_reserve0)) * timeElapsed; price1CumulativeLast += uint(UQ112x112.encode(_reserve0).uqdiv(_reserve1)) * timeElapsed; } reserve0 = uint112(balance0); reserve1 = uint112(balance1); blockTimestampLast = blockTimestamp; emit Sync(reserve0, reserve1); } // if fee is on, mint liquidity equivalent to 1/6th of the growth in sqrt(k) function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) { address feeTo = IUniswapV2Factory(factory).feeTo(); feeOn = feeTo != address(0); uint _kLast = kLast; // gas savings if (feeOn) { if (_kLast != 0) { uint rootK = Math.sqrt(uint(_reserve0).mul(_reserve1)); uint rootKLast = Math.sqrt(_kLast); if (rootK > rootKLast) { uint numerator = totalSupply.mul(rootK.sub(rootKLast)); uint denominator = rootK.mul(5).add(rootKLast); uint liquidity = numerator / denominator; if (liquidity > 0) _mint(feeTo, liquidity); } } } else if (_kLast != 0) { kLast = 0; } } // this low-level function should be called from a contract which performs important safety checks function mint(address to) external lock returns (uint liquidity) { (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings uint balance0 = IERC20(token0).balanceOf(address(this)); uint balance1 = IERC20(token1).balanceOf(address(this)); uint amount0 = balance0.sub(_reserve0); uint amount1 = balance1.sub(_reserve1); bool feeOn = _mintFee(_reserve0, _reserve1); uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee if (_totalSupply == 0) { liquidity = Math.sqrt(amount0.mul(amount1)).sub(MINIMUM_LIQUIDITY); _mint(address(0), MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens } else { liquidity = Math.min(amount0.mul(_totalSupply) / _reserve0, amount1.mul(_totalSupply) / _reserve1); } require(liquidity > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED'); _mint(to, liquidity); _update(balance0, balance1, _reserve0, _reserve1); if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date emit Mint(msg.sender, amount0, amount1); } // this low-level function should be called from a contract which performs important safety checks function burn(address to) external lock returns (uint amount0, uint amount1) { (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings address _token0 = token0; // gas savings address _token1 = token1; // gas savings uint balance0 = IERC20(_token0).balanceOf(address(this)); uint balance1 = IERC20(_token1).balanceOf(address(this)); uint liquidity = balanceOf[address(this)]; bool feeOn = _mintFee(_reserve0, _reserve1); uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee amount0 = liquidity.mul(balance0) / _totalSupply; // using balances ensures pro-rata distribution amount1 = liquidity.mul(balance1) / _totalSupply; // using balances ensures pro-rata distribution require(amount0 > 0 && amount1 > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED'); _burn(address(this), liquidity); _safeTransfer(_token0, to, amount0); _safeTransfer(_token1, to, amount1); balance0 = IERC20(_token0).balanceOf(address(this)); balance1 = IERC20(_token1).balanceOf(address(this)); _update(balance0, balance1, _reserve0, _reserve1); if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date emit Burn(msg.sender, amount0, amount1, to); } // this low-level function should be called from a contract which performs important safety checks function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external lock { require(amount0Out > 0 || amount1Out > 0, 'UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT'); (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings require(amount0Out < _reserve0 && amount1Out < _reserve1, 'UniswapV2: INSUFFICIENT_LIQUIDITY'); uint balance0; uint balance1; { // scope for _token{0,1}, avoids stack too deep errors address _token0 = token0; address _token1 = token1; require(to != _token0 && to != _token1, 'UniswapV2: INVALID_TO'); if (amount0Out > 0) _safeTransfer(_token0, to, amount0Out); // optimistically transfer tokens if (amount1Out > 0) _safeTransfer(_token1, to, amount1Out); // optimistically transfer tokens if (data.length > 0) IUniswapV2Callee(to).uniswapV2Call(msg.sender, amount0Out, amount1Out, data); balance0 = IERC20(_token0).balanceOf(address(this)); balance1 = IERC20(_token1).balanceOf(address(this)); } uint amount0In = balance0 > _reserve0 - amount0Out ? balance0 - (_reserve0 - amount0Out) : 0; uint amount1In = balance1 > _reserve1 - amount1Out ? balance1 - (_reserve1 - amount1Out) : 0; require(amount0In > 0 || amount1In > 0, 'UniswapV2: INSUFFICIENT_INPUT_AMOUNT'); { // scope for reserve{0,1}Adjusted, avoids stack too deep errors uint balance0Adjusted = balance0.mul(1000).sub(amount0In.mul(3)); uint balance1Adjusted = balance1.mul(1000).sub(amount1In.mul(3)); require(balance0Adjusted.mul(balance1Adjusted) >= uint(_reserve0).mul(_reserve1).mul(1000**2), 'UniswapV2: K'); } _update(balance0, balance1, _reserve0, _reserve1); emit Swap(msg.sender, amount0In, amount1In, amount0Out, amount1Out, to); } // force balances to match reserves function skim(address to) external lock { address _token0 = token0; // gas savings address _token1 = token1; // gas savings _safeTransfer(_token0, to, IERC20(_token0).balanceOf(address(this)).sub(reserve0)); _safeTransfer(_token1, to, IERC20(_token1).balanceOf(address(this)).sub(reserve1)); } // force reserves to match balances function sync() external lock { _update(IERC20(token0).balanceOf(address(this)), IERC20(token1).balanceOf(address(this)), reserve0, reserve1); } }
1
20,290,642
4551f43516b2ebeb7c318692d7220e9ab43834f9796e3b6976db0dc1f68e0092
80b0f682a4d0a15492719413a2bb1540a3f0b642fdb8e614e5c79814173c6b49
00bdb5699745f5b860228c8f939abf1b9ae374ed
ffa397285ce46fb78c588a9e993286aac68c37cd
030ec09870528435b42bda2318b18e0240963fad
3d602d80600a3d3981f3363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3
pragma solidity 0.7.5; /* The MIT License (MIT) Copyright (c) 2018 Murray Software, LLC. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //solhint-disable max-line-length //solhint-disable no-inline-assembly contract CloneFactory { function createClone(address target, bytes32 salt) internal returns (address payable result) { bytes20 targetBytes = bytes20(target); assembly { // load the next free memory slot as a place to store the clone contract data let clone := mload(0x40) // The bytecode block below is responsible for contract initialization // during deployment, it is worth noting the proxied contract constructor will not be called during // the cloning procedure and that is why an initialization function needs to be called after the // clone is created mstore( clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000 ) // This stores the address location of the implementation contract // so that the proxy knows where to delegate call logic to mstore(add(clone, 0x14), targetBytes) // The bytecode block is the actual code that is deployed for each clone created. // It forwards all calls to the already deployed implementation via a delegatecall mstore( add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000 ) // deploy the contract using the CREATE2 opcode // this deploys the minimal proxy defined above, which will proxy all // calls to use the logic defined in the implementation contract `target` result := create2(0, clone, 0x37, salt) } } function isClone(address target, address query) internal view returns (bool result) { bytes20 targetBytes = bytes20(target); assembly { // load the next free memory slot as a place to store the comparison clone let clone := mload(0x40) // The next three lines store the expected bytecode for a miniml proxy // that targets `target` as its implementation contract mstore( clone, 0x363d3d373d3d3d363d7300000000000000000000000000000000000000000000 ) mstore(add(clone, 0xa), targetBytes) mstore( add(clone, 0x1e), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000 ) // the next two lines store the bytecode of the contract that we are checking in memory let other := add(clone, 0x40) extcodecopy(query, other, 0, 0x2d) // Check if the expected bytecode equals the actual bytecode and return the result result := and( eq(mload(clone), mload(other)), eq(mload(add(clone, 0xd)), mload(add(other, 0xd))) ) } } } /** * Contract that exposes the needed erc20 token functions */ abstract contract ERC20Interface { // Send _value amount of tokens to address _to function transfer(address _to, uint256 _value) public virtual returns (bool success); // Get the account balance of another account with address _owner function balanceOf(address _owner) public virtual view returns (uint256 balance); } // helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false library TransferHelper { function safeApprove( address token, address to, uint256 value ) internal { // bytes4(keccak256(bytes('approve(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::safeApprove: approve failed' ); } function safeTransfer( address token, address to, uint256 value ) internal { // bytes4(keccak256(bytes('transfer(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::safeTransfer: transfer failed' ); } function safeTransferFrom( address token, address from, address to, uint256 value ) internal { // bytes4(keccak256(bytes('transferFrom(address,address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::transferFrom: transferFrom failed' ); } function safeTransferETH(address to, uint256 value) internal { (bool success, ) = to.call{value: value}(new bytes(0)); require(success, 'TransferHelper::safeTransferETH: ETH transfer failed'); } } /** * Contract that will forward any incoming Ether to the creator of the contract * */ contract Forwarder { // Address to which any funds sent to this contract will be forwarded address public parentAddress; event ForwarderDeposited(address from, uint256 value, bytes data); /** * Initialize the contract, and sets the destination address to that of the creator */ function init(address _parentAddress) external onlyUninitialized { parentAddress = _parentAddress; uint256 value = address(this).balance; if (value == 0) { return; } (bool success, ) = parentAddress.call{ value: value }(''); require(success, 'Flush failed'); // NOTE: since we are forwarding on initialization, // we don't have the context of the original sender. // We still emit an event about the forwarding but set // the sender to the forwarder itself emit ForwarderDeposited(address(this), value, msg.data); } /** * Modifier that will execute internal code block only if the sender is the parent address */ modifier onlyParent { require(msg.sender == parentAddress, 'Only Parent'); _; } /** * Modifier that will execute internal code block only if the contract has not been initialized yet */ modifier onlyUninitialized { require(parentAddress == address(0x0), 'Already initialized'); _; } /** * Default function; Gets called when data is sent but does not match any other function */ fallback() external payable { flush(); } /** * Default function; Gets called when Ether is deposited with no data, and forwards it to the parent address */ receive() external payable { flush(); } /** * Execute a token transfer of the full balance from the forwarder token to the parent address * @param tokenContractAddress the address of the erc20 token contract */ function flushTokens(address tokenContractAddress) external onlyParent { ERC20Interface instance = ERC20Interface(tokenContractAddress); address forwarderAddress = address(this); uint256 forwarderBalance = instance.balanceOf(forwarderAddress); if (forwarderBalance == 0) { return; } TransferHelper.safeTransfer( tokenContractAddress, parentAddress, forwarderBalance ); } /** * Flush the entire balance of the contract to the parent address. */ function flush() public { uint256 value = address(this).balance; if (value == 0) { return; } (bool success, ) = parentAddress.call{ value: value }(''); require(success, 'Flush failed'); emit ForwarderDeposited(msg.sender, value, msg.data); } } contract ForwarderFactory is CloneFactory { address public implementationAddress; event ForwarderCreated(address newForwarderAddress, address parentAddress); constructor(address _implementationAddress) { implementationAddress = _implementationAddress; } function createForwarder(address parent, bytes32 salt) external { // include the signers in the salt so any contract deployed to a given address must have the same signers bytes32 finalSalt = keccak256(abi.encodePacked(parent, salt)); address payable clone = createClone(implementationAddress, finalSalt); Forwarder(clone).init(parent); emit ForwarderCreated(clone, parent); } }