{"file_path":"contracts/Minter.sol","creation_status":"success","source_code":"// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts/utils/structs/EnumerableMap.sol\";\n\nimport \"./interfaces/ISTBT.sol\";\nimport \"./interfaces/IStbtTimelockController.sol\";\n\ncontract Minter is Ownable {\n\tusing SafeERC20 for IERC20;\n\n\tusing EnumerableMap for EnumerableMap.AddressToUintMap;\n\n\tstruct DepositConfig {\n\t\tbool   needDivAdjust;\n\t\tuint96 adjustUnit;\n\t\tuint96 minimumDepositAmount;\n\t}\n\t\n\tstruct RedeemConfig {\n\t\tbool   needDivAdjust;\n\t\tuint96 adjustUnit;\n\t\tuint96 minimumRedeemAmount;\n\t}\n\t\n\taddress public timeLockContract;\n\taddress public targetContract;\n\taddress public poolAccount;\n\tuint64 public nonceForRedeem;\n\tuint64 public virtualCountOfRedeemSettled;\n\tuint64 public nonceForMint;\n\tmapping(address => DepositConfig) public depositConfigMap;\n\tmapping(address => RedeemConfig) public redeemConfigMap;\n\tmapping(address => uint) public redeemFeeRateMap;\n\tmapping(uint => address) public redeemTargetMap;\n\tuint public depositPeriod;\n\tuint public redeemPeriod;\n\tEnumerableMap.AddressToUintMap private purchaseInfoMap;\n\t\n\tuint private constant UNIT = 10**18;\n\n\tevent Mint(address indexed requestor, address indexed token, uint indexed nonce,\n\t\t   uint depositAmount, uint proposeAmount, bytes32 salt, bytes data);\n\tevent Redeem(address indexed requestor, address indexed token, uint indexed nonce, uint amount,\n\t\t    bytes32 salt, bytes data);\n\tevent Settle(address indexed target,  address indexed token, uint indexed nonce, uint amount,\n\t\t     bytes32 redeemTxId, uint redeemServiceFeeRate, uint executionPrice);\n\n\tconstructor(address _timeLockContract, address _targetContract, address _poolAccount) Ownable() {\n\t\ttimeLockContract = _timeLockContract;\n\t\ttargetContract = _targetContract;\n\t\tpoolAccount = _poolAccount;\n\t\tuint64 _nonceStart = uint64(1000 * block.timestamp);\n\t\tnonceForMint = _nonceStart;\n\t\tnonceForRedeem = _nonceStart;\n\t\tvirtualCountOfRedeemSettled = _nonceStart;\n\t}\n\n\tfunction setCoinInfo(address token, uint receiverAndRate) onlyOwner external {\n\t\trequire(uint96(receiverAndRate) < UNIT, \"MINTER: FEE_RATE_TOO_LARGE\");\n\t\tpurchaseInfoMap.set(token, receiverAndRate);\n\t}\n\n\tfunction getCoinInfo(address coin) external view returns (uint) {\n\t\treturn purchaseInfoMap.get(coin);\n\t}\n\n\tfunction getCoinsInfo() external view returns (address[] memory coinList, uint[] memory receiverAndRateList) {\n\t\tcoinList = new address[](purchaseInfoMap.length());\n\t\treceiverAndRateList = new uint[](purchaseInfoMap.length());\n\t\tfor(uint i=0; i<coinList.length; i++) {\n\t\t\t(address coin, uint reveiverAndRate) = purchaseInfoMap.at(i);\n\t\t\tcoinList[i] = coin;\n\t\t\treceiverAndRateList[i] = reveiverAndRate;\n\t\t}\n\t}\n\n\tfunction setDepositConfig(address token, DepositConfig calldata config) onlyOwner external {\n\t\tdepositConfigMap[token] = config;\n\t}\n\n\tfunction setRedeemConfig(address token, RedeemConfig calldata config) onlyOwner external {\n\t\tredeemConfigMap[token] = config;\n\t}\n\n\tfunction setRedeemFeeRate(address token, uint r) onlyOwner external {\n\t\tredeemFeeRateMap[token] = r;\n\t}\n\n\tfunction setDepositPeriod(uint p) onlyOwner external {\n\t\tdepositPeriod = p;\n\t}\n\n\tfunction setRedeemPeriod(uint p) onlyOwner external {\n\t\tredeemPeriod = p;\n\t}\n\n\tfunction setTimeLockContract(address _timeLockContract) onlyOwner external {\n\t\ttimeLockContract = _timeLockContract;\n\t}\n\n\tfunction setTargetContract(address _targetContract) onlyOwner external {\n\t\ttargetContract = _targetContract;\n\t}\n\n\tfunction setPoolAccount(address _poolAccount) onlyOwner external {\n\t\tpoolAccount = _poolAccount;\n\t}\n\n\t// token: which token to deposit?\n\t// depositAmount: how much to deposit?\n\t// minProposedAmount: the sender use this value to protect against sudden rise of feeRate\n\t// salt: a random number that can affect TimelockController's input salt\n\t// extraData: will be used to call STBT's issue function\n\tfunction mint(address token, uint depositAmount, uint minProposedAmount, bytes32 salt,\n\t\t      bytes calldata extraData) external {\n\t\t{\n\t\t(, bool receiveAllowed, uint64 expiryTime) = ISTBT(targetContract).permissions(msg.sender);\n\t\trequire(receiveAllowed, 'MINTER: NO_RECEIVE_PERMISSION');\n\t\trequire(expiryTime == 0 || expiryTime > block.timestamp, 'MINTER: RECEIVE_PERMISSION_EXPIRED');\n\t\t}\n\n\t\tuint receiverAndRate = purchaseInfoMap.get(token);\n\t\trequire(receiverAndRate != 0, \"MINTER: TOKEN_NOT_SUPPORTED\");\n\t\taddress receiver = address(uint160(receiverAndRate>>96));\n\t\tuint feeRate = uint96(receiverAndRate);\n\t\tDepositConfig memory config = depositConfigMap[token];\n\t\trequire(config.minimumDepositAmount != 0 &&\n\t\t\tdepositAmount >= config.minimumDepositAmount, \"MINTER: DEPOSIT_AMOUNT_TOO_SMALL\");\n\t\tuint proposeAmount = depositAmount*(UNIT-feeRate)/UNIT;\n\t\tproposeAmount = config.needDivAdjust? proposeAmount / config.adjustUnit : proposeAmount * config.adjustUnit;\n\t\trequire(proposeAmount >= minProposedAmount, \"MINTER: PROPOSE_AMOUNT_TOO_SMALL\");\n\t\tIERC20(token).safeTransferFrom(msg.sender, receiver, depositAmount);\n\t\tbytes memory data = abi.encodeWithSignature(\"issue(address,uint256,bytes)\",\n\t\t\t\t\t\t\t    msg.sender, proposeAmount, extraData);\n\t\tuint64 _nonceForMint = nonceForMint;\n\t\tsalt = keccak256(abi.encodePacked(salt, _nonceForMint));\n\t\tnonceForMint = _nonceForMint + 1;\n\t\tIStbtTimelockController(timeLockContract).schedule(targetContract, 0, data, bytes32(\"\"), salt, 0);\n\t\temit Mint(msg.sender, token, _nonceForMint, depositAmount, proposeAmount, salt, data);\n\t}\n\n\t// token: which token to receive after redeem?\n\t// amount: how much STBT to deposit?\n\t// salt: a random number that can affect TimelockController's input salt\n\t// extraData: will be used to call STBT's redeemFrom function\n\tfunction redeem(uint amount, address token, bytes32 salt, bytes calldata extraData) external {\n\t\tRedeemConfig memory config = redeemConfigMap[token];\n\t\trequire(config.minimumRedeemAmount != 0 &&\n\t\t\tamount >= config.minimumRedeemAmount, \"MINTER: REDEEM_AMOUNT_TOO_SMALL\");\n\t\tIERC20(targetContract).safeTransferFrom(msg.sender, poolAccount, amount);\n\t\tbytes memory data = abi.encodeWithSignature(\"redeemFrom(address,uint256,bytes)\",\n\t\t\t\t\t\t\t    poolAccount, amount, extraData);\n\t\tuint adjusted = config.needDivAdjust? amount / config.adjustUnit : amount * config.adjustUnit;\n\t\tsalt = keccak256(abi.encodePacked(salt, nonceForRedeem));\n\t\tIStbtTimelockController(timeLockContract).schedule(targetContract, 0, data, bytes32(\"\"), salt, 0);\n\t\tredeemTargetMap[nonceForRedeem] = msg.sender;\n\t\temit Redeem(msg.sender, token, nonceForRedeem, adjusted, salt, data);\n\t\tnonceForRedeem = nonceForRedeem + 1;\n\t}\n\n\t// token: which token to refund the customer?\n\t// amount: how much to refund?\n\t// nonce: the nonce assigned to this redeem operation\n\t// redeemTxId: at which tx did the customer call 'redeem'?\n\t// redeemServiceFeeRate: some of the refunded tokens will be deducted as fee\n\t// executionPrice: the price of STBT measure by 'token'\n\tfunction redeemSettle(address token, uint amount, uint64 nonce, bytes32 redeemTxId,\n\t\t\t      uint redeemServiceFeeRate, uint executionPrice) onlyOwner external {\n\t\tvirtualCountOfRedeemSettled++;\n\t\taddress target = redeemTargetMap[nonce];\n\t\trequire(target != address(0), \"MINTER: NULL_TARGET\");\n\t\tdelete redeemTargetMap[nonce];\n\t\tIERC20(token).safeTransfer(target, amount);\n\t\temit Settle(target, token, nonce, amount, redeemTxId, redeemServiceFeeRate, executionPrice);\n\t}\n\n\t// the rescue ETH or ERC20 tokens which were accidentally sent to this contract\n\tfunction rescue(address token, address receiver, uint amount) onlyOwner external {\n\t\trequire(virtualCountOfRedeemSettled == nonceForRedeem, \"MINTER: PENDING_REDEEM\");\n\t\tIERC20(token).safeTransfer(receiver, amount);\n\t}\n}\n","deployed_bytecode":"0x608060405234801561001057600080fd5b50600436106101da5760003560e01c80638da5cb5b11610104578063dd3c3ef6116100a2578063ed82ae2c11610071578063ed82ae2c146104a9578063f0d82e84146104bc578063f2fde38b146104cf578063fd88fa3e146104e257600080fd5b8063dd3c3ef614610433578063e02339f214610446578063e630f4bc14610483578063e8dd46551461049657600080fd5b8063bd90df70116100de578063bd90df70146103df578063be79399c146103f2578063c4e138751461040d578063d047e2a01461042057600080fd5b80638da5cb5b146103a8578063945adc3c146103b95780639ec83b2b146103cc57600080fd5b80632f6603621161017c578063709c4c971161014b578063709c4c9714610364578063715018a614610377578063735f4ec11461037f57806387df2c161461039f57600080fd5b80632f6603621461031457806340a233a61461032757806347fc822f1461033e578063500ac9d71461035157600080fd5b80631dcce717116101b85780631dcce7171461027357806320ff430b14610289578063241ba0191461029c578063283413b0146102b057600080fd5b806301cf1e9a146101df578063042b8945146101f45780631a7c85fa1461023a575b600080fd5b6101f26101ed366004611911565b6104f5565b005b61021d61020236600461192c565b6008602052600090815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b60045461025a9068010000000000000000900467ffffffffffffffff1681565b60405167ffffffffffffffff9091168152602001610231565b61027b61051f565b604051610231929190611945565b6101f26102973660046119c9565b610648565b60045461025a9067ffffffffffffffff1681565b6102ed6102be366004611911565b60066020526000908152604090205460ff8116906001600160601b036101008204811691600160681b90041683565b6040805193151584526001600160601b039283166020850152911690820152606001610231565b60015461021d906001600160a01b031681565b610330600a5481565b604051908152602001610231565b6101f261034c366004611911565b6106d6565b6101f261035f366004611a05565b610700565b6101f2610372366004611a47565b610774565b6101f26107a6565b61033061038d366004611911565b60076020526000908152604090205481565b61033060095481565b6000546001600160a01b031661021d565b6101f26103c7366004611abd565b6107ba565b6101f26103da366004611b44565b610d25565b60025461021d906001600160a01b031681565b60035461025a90600160a01b900467ffffffffffffffff1681565b6101f261041b366004611911565b610e79565b6101f261042e366004611a05565b610ea3565b60035461021d906001600160a01b031681565b6102ed610454366004611911565b60056020526000908152604090205460ff8116906001600160601b036101008204811691600160681b90041683565b6101f261049136600461192c565b610ec7565b6103306104a4366004611911565b610ed4565b6101f26104b7366004611b9e565b610ee7565b6101f26104ca36600461192c565b61122d565b6101f26104dd366004611911565b61123a565b6101f26104f0366004611a47565b6112ca565b6104fd6112f6565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b60608061052c600b611350565b67ffffffffffffffff81111561054457610544611c06565b60405190808252806020026020018201604052801561056d578160200160208202803683370190505b50915061057a600b611350565b67ffffffffffffffff81111561059257610592611c06565b6040519080825280602002602001820160405280156105bb578160200160208202803683370190505b50905060005b8251811015610643576000806105d8600b8461135b565b91509150818584815181106105ef576105ef611c1c565b60200260200101906001600160a01b031690816001600160a01b0316815250508084848151811061062257610622611c1c565b6020026020010181815250505050808061063b90611c48565b9150506105c1565b509091565b6106506112f6565b60035460045467ffffffffffffffff908116600160a01b90920416146106bd5760405162461bcd60e51b815260206004820152601660248201527f4d494e5445523a2050454e44494e475f52454445454d0000000000000000000060448201526064015b60405180910390fd5b6106d16001600160a01b0384168383611379565b505050565b6106de6112f6565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6107086112f6565b670de0b6b3a7640000816001600160601b0316106107685760405162461bcd60e51b815260206004820152601a60248201527f4d494e5445523a204645455f524154455f544f4f5f4c4152474500000000000060448201526064016106b4565b6106d1600b838361140d565b61077c6112f6565b6001600160a01b038216600090815260066020526040902081906107a08282611d35565b50505050565b6107ae6112f6565b6107b8600061142b565b565b6002546040517f01e8820800000000000000000000000000000000000000000000000000000000815233600482015260009182916001600160a01b03909116906301e8820890602401606060405180830381865afa158015610820573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108449190611d3f565b9250925050816108965760405162461bcd60e51b815260206004820152601d60248201527f4d494e5445523a204e4f5f524543454956455f5045524d495353494f4e00000060448201526064016106b4565b67ffffffffffffffff811615806108b65750428167ffffffffffffffff16115b6109285760405162461bcd60e51b815260206004820152602260248201527f4d494e5445523a20524543454956455f5045524d495353494f4e5f455850495260448201527f454400000000000000000000000000000000000000000000000000000000000060648201526084016106b4565b5060009050610938600b8861147b565b90508060000361098a5760405162461bcd60e51b815260206004820152601b60248201527f4d494e5445523a20544f4b454e5f4e4f545f535550504f52544544000000000060448201526064016106b4565b6001600160a01b038716600090815260056020908152604091829020825160608082018552915460ff8116151582526001600160601b036101008204811694830194909452600160681b900483169381018490529084901c929184169115801590610a02575080604001516001600160601b03168910155b610a4e5760405162461bcd60e51b815260206004820181905260248201527f4d494e5445523a204445504f5349545f414d4f554e545f544f4f5f534d414c4c60448201526064016106b4565b6000670de0b6b3a7640000610a638482611d8c565b610a6d908c611d9f565b610a779190611db6565b8251909150610a9d576020820151610a98906001600160601b031682611d9f565b610ab5565b6020820151610ab5906001600160601b031682611db6565b905088811015610b075760405162461bcd60e51b815260206004820181905260248201527f4d494e5445523a2050524f504f53455f414d4f554e545f544f4f5f534d414c4c60448201526064016106b4565b610b1c6001600160a01b038c1633868d611497565b600033828989604051602401610b359493929190611dd8565b60408051601f19818403018152918152602080830180516001600160e01b03167fbb3acde900000000000000000000000000000000000000000000000000000000179052600454915192935067ffffffffffffffff680100000000000000009092049190911691610bd8918c9184910191825260c01b7fffffffffffffffff00000000000000000000000000000000000000000000000016602082015260280190565b604051602081830303815290604052805190602001209950806001610bfd9190611e1e565b600460086101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550600160009054906101000a90046001600160a01b03166001600160a01b03166301d5062a600260009054906101000a90046001600160a01b031660008560008f60006040518763ffffffff1660e01b8152600401610c8896959493929190611e96565b600060405180830381600087803b158015610ca257600080fd5b505af1158015610cb6573d6000803e3d6000fd5b505050508067ffffffffffffffff168d6001600160a01b0316336001600160a01b03167f2205f0f396c53967f6d82d59c867a9833f072ebbd75c3d977882997bfc65a5fa8f878f88604051610d0e9493929190611edc565b60405180910390a450505050505050505050505050565b610d2d6112f6565b6004805467ffffffffffffffff16906000610d4783611f0b565b82546101009290920a67ffffffffffffffff81810219909316918316021790915585166000908152600860205260409020546001600160a01b0316905080610dd15760405162461bcd60e51b815260206004820152601360248201527f4d494e5445523a204e554c4c5f5441524745540000000000000000000000000060448201526064016106b4565b67ffffffffffffffff8516600090815260086020526040902080546001600160a01b0319169055610e0c6001600160a01b0388168288611379565b60408051878152602081018690529081018490526060810183905267ffffffffffffffff8616906001600160a01b03808a1691908416907f30cc1b4a64a0bd6f58ae40a6575008f56436dbb9b09dea8e6aedc8297bfa14d59060800160405180910390a450505050505050565b610e816112f6565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b610eab6112f6565b6001600160a01b03909116600090815260076020526040902055565b610ecf6112f6565b600955565b6000610ee1600b8361147b565b92915050565b6001600160a01b0384166000908152600660209081526040918290208251606081018452905460ff8116151582526001600160601b036101008204811693830193909352600160681b90049091169181018290529015801590610f57575080604001516001600160601b03168610155b610fa35760405162461bcd60e51b815260206004820152601f60248201527f4d494e5445523a2052454445454d5f414d4f554e545f544f4f5f534d414c4c0060448201526064016106b4565b600354600254610fc2916001600160a01b039182169133911689611497565b600354604051600091610fe9916001600160a01b0390911690899087908790602401611dd8565b60408051601f198184030181529190526020810180516001600160e01b03167f9675193c000000000000000000000000000000000000000000000000000000001790528251909150600090611055576020830151611050906001600160601b031689611d9f565b61106d565b602083015161106d906001600160601b031689611db6565b60035460408051602081018a9052600160a01b90920460c01b7fffffffffffffffff000000000000000000000000000000000000000000000000169082015290915060480160408051601f198184030181529082905280516020909101206001546002547f01d5062a0000000000000000000000000000000000000000000000000000000084529198506001600160a01b03908116926301d5062a92611122921690600090879082908d908290600401611e96565b600060405180830381600087803b15801561113c57600080fd5b505af1158015611150573d6000803e3d6000fd5b50506003805467ffffffffffffffff600160a01b9182900481166000908152600860205260409081902080546001600160a01b03191633908117909155935490519290041693506001600160a01b038b1692507fc9083441fee7f34b32dac11477d44ed85f06ee49083338b11e9a0a3383dc1f82906111d49086908c908990611f32565b60405180910390a46003546111fb90600160a01b900467ffffffffffffffff166001611e1e565b600360146101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055505050505050505050565b6112356112f6565b600a55565b6112426112f6565b6001600160a01b0381166112be5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016106b4565b6112c78161142b565b50565b6112d26112f6565b6001600160a01b038216600090815260056020526040902081906107a08282611d35565b6000546001600160a01b031633146107b85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016106b4565b6000610ee1826114e8565b600080808061136a86866114f3565b909450925050505b9250929050565b6040516001600160a01b0383166024820152604481018290526106d19084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b60408051601f198184030181529190526020810180516001600160e01b03167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261151e565b6000611423846001600160a01b03851684611606565b949350505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000611490836001600160a01b038416611623565b9392505050565b6040516001600160a01b03808516602483015283166044820152606481018290526107a09085907f23b872dd00000000000000000000000000000000000000000000000000000000906084016113be565b6000610ee182611693565b60008080611501858561169d565b600081815260029690960160205260409095205494959350505050565b6000611573826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166116a99092919063ffffffff16565b90508051600014806115945750808060200190518101906115949190611f5a565b6106d15760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016106b4565b6000828152600284016020526040812082905561142384846116b8565b600081815260028301602052604081205480151580611647575061164784846116c4565b6114905760405162461bcd60e51b815260206004820152601e60248201527f456e756d657261626c654d61703a206e6f6e6578697374656e74206b6579000060448201526064016106b4565b6000610ee1825490565b600061149083836116d0565b606061142384846000856116fa565b600061149083836117ec565b6000611490838361183b565b60008260000182815481106116e7576116e7611c1c565b9060005260206000200154905092915050565b6060824710156117725760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016106b4565b600080866001600160a01b0316858760405161178e9190611f77565b60006040518083038185875af1925050503d80600081146117cb576040519150601f19603f3d011682016040523d82523d6000602084013e6117d0565b606091505b50915091506117e187838387611853565b979650505050505050565b600081815260018301602052604081205461183357508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610ee1565b506000610ee1565b60008181526001830160205260408120541515611490565b606083156118c25782516000036118bb576001600160a01b0385163b6118bb5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016106b4565b5081611423565b61142383838151156118d75781518083602001fd5b8060405162461bcd60e51b81526004016106b49190611f93565b5050565b80356001600160a01b038116811461190c57600080fd5b919050565b60006020828403121561192357600080fd5b611490826118f5565b60006020828403121561193e57600080fd5b5035919050565b604080825283519082018190526000906020906060840190828701845b828110156119875781516001600160a01b031684529284019290840190600101611962565b5050508381038285015284518082528583019183019060005b818110156119bc578351835292840192918401916001016119a0565b5090979650505050505050565b6000806000606084860312156119de57600080fd5b6119e7846118f5565b92506119f5602085016118f5565b9150604084013590509250925092565b60008060408385031215611a1857600080fd5b611a21836118f5565b946020939093013593505050565b600060608284031215611a4157600080fd5b50919050565b60008060808385031215611a5a57600080fd5b611a63836118f5565b9150611a728460208501611a2f565b90509250929050565b60008083601f840112611a8d57600080fd5b50813567ffffffffffffffff811115611aa557600080fd5b60208301915083602082850101111561137257600080fd5b60008060008060008060a08789031215611ad657600080fd5b611adf876118f5565b9550602087013594506040870135935060608701359250608087013567ffffffffffffffff811115611b1057600080fd5b611b1c89828a01611a7b565b979a9699509497509295939492505050565b67ffffffffffffffff811681146112c757600080fd5b60008060008060008060c08789031215611b5d57600080fd5b611b66876118f5565b9550602087013594506040870135611b7d81611b2e565b959894975094956060810135955060808101359460a0909101359350915050565b600080600080600060808688031215611bb657600080fd5b85359450611bc6602087016118f5565b935060408601359250606086013567ffffffffffffffff811115611be957600080fd5b611bf588828901611a7b565b969995985093965092949392505050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611c5a57611c5a611c32565b5060010190565b80151581146112c757600080fd5b600081356001600160601b0381168114610ee157600080fd5b8135611c9381611c61565b815460ff19811691151560ff1691821783556cffffffffffffffffffffffff00611cbf60208601611c6f565b60081b1680836cffffffffffffffffffffffffff1984161717845578ffffffffffffffffffffffff00000000000000000000000000611d0060408701611c6f565b60681b16837fffffffffffffff0000000000000000000000000000000000000000000000000084161782171784555050505050565b6118f18282611c88565b600080600060608486031215611d5457600080fd5b8351611d5f81611c61565b6020850151909350611d7081611c61565b6040850151909250611d8181611b2e565b809150509250925092565b81810381811115610ee157610ee1611c32565b8082028115828204841417610ee157610ee1611c32565b600082611dd357634e487b7160e01b600052601260045260246000fd5b500490565b6001600160a01b038516815283602082015260606040820152816060820152818360808301376000818301608090810191909152601f909201601f191601019392505050565b67ffffffffffffffff818116838216019080821115611e3f57611e3f611c32565b5092915050565b60005b83811015611e61578181015183820152602001611e49565b50506000910152565b60008151808452611e82816020860160208601611e46565b601f01601f19169290920160200192915050565b6001600160a01b038716815285602082015260c060408201526000611ebe60c0830187611e6a565b606083019590955250608081019290925260a0909101529392505050565b848152836020820152826040820152608060608201526000611f016080830184611e6a565b9695505050505050565b600067ffffffffffffffff808316818103611f2857611f28611c32565b6001019392505050565b838152826020820152606060408201526000611f516060830184611e6a565b95945050505050565b600060208284031215611f6c57600080fd5b815161149081611c61565b60008251611f89818460208701611e46565b9190910192915050565b6020815260006114906020830184611e6a56fea2646970667358221220ad35862e1f7de9e1e35384152dbb08f9738ae7462845eaacae641ad7adb9366664736f6c63430008110033","optimization_enabled":true,"verified_twin_address_hash":null,"is_verified":true,"compiler_settings":{"evmVersion":"london","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":true,"runs":1000},"remappings":[]},"optimization_runs":1000,"sourcify_repo_url":"https://repo.sourcify.dev/contracts/full_match/1/0xca241823d4Bfe8b29610709Db617407FbC9AE02b/","decoded_constructor_args":[["0x22276A1BD16bc3052b362C2e0f65aacE04ed6F99",{"internalType":"address","name":"_timeLockContract","type":"address"}],["0x530824DA86689C9C17CdC2871Ff29B058345b44a",{"internalType":"address","name":"_targetContract","type":"address"}],["0xDEE9Ed3B19d104ADBbE255B6bEFC680b4eaAAda3",{"internalType":"address","name":"_poolAccount","type":"address"}]],"compiler_version":"0.8.17+commit.8df45f5f","is_verified_via_verifier_alliance":false,"verified_at":"2024-02-21T15:30:08.350406Z","implementations":[],"proxy_type":null,"external_libraries":[],"creation_bytecode":"0x60806040523480156200001157600080fd5b50604051620021ba380380620021ba833981016040819052620000349162000158565b6200003f33620000eb565b600180546001600160a01b038086166001600160a01b03199283161790925560028054858416908316179055600380549284169290911691909117905560006200008c426103e8620001a2565b6004805460038054600160a01b600160e01b0319166001600160401b0394909416600160a01b81029490941790556001600160801b0319166801000000000000000083026001600160401b03191617909117905550620001ce92505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146200015357600080fd5b919050565b6000806000606084860312156200016e57600080fd5b62000179846200013b565b925062000189602085016200013b565b915062000199604085016200013b565b90509250925092565b8082028115828204841417620001c857634e487b7160e01b600052601160045260246000fd5b92915050565b611fdc80620001de6000396000f3fe608060405234801561001057600080fd5b50600436106101da5760003560e01c80638da5cb5b11610104578063dd3c3ef6116100a2578063ed82ae2c11610071578063ed82ae2c146104a9578063f0d82e84146104bc578063f2fde38b146104cf578063fd88fa3e146104e257600080fd5b8063dd3c3ef614610433578063e02339f214610446578063e630f4bc14610483578063e8dd46551461049657600080fd5b8063bd90df70116100de578063bd90df70146103df578063be79399c146103f2578063c4e138751461040d578063d047e2a01461042057600080fd5b80638da5cb5b146103a8578063945adc3c146103b95780639ec83b2b146103cc57600080fd5b80632f6603621161017c578063709c4c971161014b578063709c4c9714610364578063715018a614610377578063735f4ec11461037f57806387df2c161461039f57600080fd5b80632f6603621461031457806340a233a61461032757806347fc822f1461033e578063500ac9d71461035157600080fd5b80631dcce717116101b85780631dcce7171461027357806320ff430b14610289578063241ba0191461029c578063283413b0146102b057600080fd5b806301cf1e9a146101df578063042b8945146101f45780631a7c85fa1461023a575b600080fd5b6101f26101ed366004611911565b6104f5565b005b61021d61020236600461192c565b6008602052600090815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b60045461025a9068010000000000000000900467ffffffffffffffff1681565b60405167ffffffffffffffff9091168152602001610231565b61027b61051f565b604051610231929190611945565b6101f26102973660046119c9565b610648565b60045461025a9067ffffffffffffffff1681565b6102ed6102be366004611911565b60066020526000908152604090205460ff8116906001600160601b036101008204811691600160681b90041683565b6040805193151584526001600160601b039283166020850152911690820152606001610231565b60015461021d906001600160a01b031681565b610330600a5481565b604051908152602001610231565b6101f261034c366004611911565b6106d6565b6101f261035f366004611a05565b610700565b6101f2610372366004611a47565b610774565b6101f26107a6565b61033061038d366004611911565b60076020526000908152604090205481565b61033060095481565b6000546001600160a01b031661021d565b6101f26103c7366004611abd565b6107ba565b6101f26103da366004611b44565b610d25565b60025461021d906001600160a01b031681565b60035461025a90600160a01b900467ffffffffffffffff1681565b6101f261041b366004611911565b610e79565b6101f261042e366004611a05565b610ea3565b60035461021d906001600160a01b031681565b6102ed610454366004611911565b60056020526000908152604090205460ff8116906001600160601b036101008204811691600160681b90041683565b6101f261049136600461192c565b610ec7565b6103306104a4366004611911565b610ed4565b6101f26104b7366004611b9e565b610ee7565b6101f26104ca36600461192c565b61122d565b6101f26104dd366004611911565b61123a565b6101f26104f0366004611a47565b6112ca565b6104fd6112f6565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b60608061052c600b611350565b67ffffffffffffffff81111561054457610544611c06565b60405190808252806020026020018201604052801561056d578160200160208202803683370190505b50915061057a600b611350565b67ffffffffffffffff81111561059257610592611c06565b6040519080825280602002602001820160405280156105bb578160200160208202803683370190505b50905060005b8251811015610643576000806105d8600b8461135b565b91509150818584815181106105ef576105ef611c1c565b60200260200101906001600160a01b031690816001600160a01b0316815250508084848151811061062257610622611c1c565b6020026020010181815250505050808061063b90611c48565b9150506105c1565b509091565b6106506112f6565b60035460045467ffffffffffffffff908116600160a01b90920416146106bd5760405162461bcd60e51b815260206004820152601660248201527f4d494e5445523a2050454e44494e475f52454445454d0000000000000000000060448201526064015b60405180910390fd5b6106d16001600160a01b0384168383611379565b505050565b6106de6112f6565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6107086112f6565b670de0b6b3a7640000816001600160601b0316106107685760405162461bcd60e51b815260206004820152601a60248201527f4d494e5445523a204645455f524154455f544f4f5f4c4152474500000000000060448201526064016106b4565b6106d1600b838361140d565b61077c6112f6565b6001600160a01b038216600090815260066020526040902081906107a08282611d35565b50505050565b6107ae6112f6565b6107b8600061142b565b565b6002546040517f01e8820800000000000000000000000000000000000000000000000000000000815233600482015260009182916001600160a01b03909116906301e8820890602401606060405180830381865afa158015610820573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108449190611d3f565b9250925050816108965760405162461bcd60e51b815260206004820152601d60248201527f4d494e5445523a204e4f5f524543454956455f5045524d495353494f4e00000060448201526064016106b4565b67ffffffffffffffff811615806108b65750428167ffffffffffffffff16115b6109285760405162461bcd60e51b815260206004820152602260248201527f4d494e5445523a20524543454956455f5045524d495353494f4e5f455850495260448201527f454400000000000000000000000000000000000000000000000000000000000060648201526084016106b4565b5060009050610938600b8861147b565b90508060000361098a5760405162461bcd60e51b815260206004820152601b60248201527f4d494e5445523a20544f4b454e5f4e4f545f535550504f52544544000000000060448201526064016106b4565b6001600160a01b038716600090815260056020908152604091829020825160608082018552915460ff8116151582526001600160601b036101008204811694830194909452600160681b900483169381018490529084901c929184169115801590610a02575080604001516001600160601b03168910155b610a4e5760405162461bcd60e51b815260206004820181905260248201527f4d494e5445523a204445504f5349545f414d4f554e545f544f4f5f534d414c4c60448201526064016106b4565b6000670de0b6b3a7640000610a638482611d8c565b610a6d908c611d9f565b610a779190611db6565b8251909150610a9d576020820151610a98906001600160601b031682611d9f565b610ab5565b6020820151610ab5906001600160601b031682611db6565b905088811015610b075760405162461bcd60e51b815260206004820181905260248201527f4d494e5445523a2050524f504f53455f414d4f554e545f544f4f5f534d414c4c60448201526064016106b4565b610b1c6001600160a01b038c1633868d611497565b600033828989604051602401610b359493929190611dd8565b60408051601f19818403018152918152602080830180516001600160e01b03167fbb3acde900000000000000000000000000000000000000000000000000000000179052600454915192935067ffffffffffffffff680100000000000000009092049190911691610bd8918c9184910191825260c01b7fffffffffffffffff00000000000000000000000000000000000000000000000016602082015260280190565b604051602081830303815290604052805190602001209950806001610bfd9190611e1e565b600460086101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550600160009054906101000a90046001600160a01b03166001600160a01b03166301d5062a600260009054906101000a90046001600160a01b031660008560008f60006040518763ffffffff1660e01b8152600401610c8896959493929190611e96565b600060405180830381600087803b158015610ca257600080fd5b505af1158015610cb6573d6000803e3d6000fd5b505050508067ffffffffffffffff168d6001600160a01b0316336001600160a01b03167f2205f0f396c53967f6d82d59c867a9833f072ebbd75c3d977882997bfc65a5fa8f878f88604051610d0e9493929190611edc565b60405180910390a450505050505050505050505050565b610d2d6112f6565b6004805467ffffffffffffffff16906000610d4783611f0b565b82546101009290920a67ffffffffffffffff81810219909316918316021790915585166000908152600860205260409020546001600160a01b0316905080610dd15760405162461bcd60e51b815260206004820152601360248201527f4d494e5445523a204e554c4c5f5441524745540000000000000000000000000060448201526064016106b4565b67ffffffffffffffff8516600090815260086020526040902080546001600160a01b0319169055610e0c6001600160a01b0388168288611379565b60408051878152602081018690529081018490526060810183905267ffffffffffffffff8616906001600160a01b03808a1691908416907f30cc1b4a64a0bd6f58ae40a6575008f56436dbb9b09dea8e6aedc8297bfa14d59060800160405180910390a450505050505050565b610e816112f6565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b610eab6112f6565b6001600160a01b03909116600090815260076020526040902055565b610ecf6112f6565b600955565b6000610ee1600b8361147b565b92915050565b6001600160a01b0384166000908152600660209081526040918290208251606081018452905460ff8116151582526001600160601b036101008204811693830193909352600160681b90049091169181018290529015801590610f57575080604001516001600160601b03168610155b610fa35760405162461bcd60e51b815260206004820152601f60248201527f4d494e5445523a2052454445454d5f414d4f554e545f544f4f5f534d414c4c0060448201526064016106b4565b600354600254610fc2916001600160a01b039182169133911689611497565b600354604051600091610fe9916001600160a01b0390911690899087908790602401611dd8565b60408051601f198184030181529190526020810180516001600160e01b03167f9675193c000000000000000000000000000000000000000000000000000000001790528251909150600090611055576020830151611050906001600160601b031689611d9f565b61106d565b602083015161106d906001600160601b031689611db6565b60035460408051602081018a9052600160a01b90920460c01b7fffffffffffffffff000000000000000000000000000000000000000000000000169082015290915060480160408051601f198184030181529082905280516020909101206001546002547f01d5062a0000000000000000000000000000000000000000000000000000000084529198506001600160a01b03908116926301d5062a92611122921690600090879082908d908290600401611e96565b600060405180830381600087803b15801561113c57600080fd5b505af1158015611150573d6000803e3d6000fd5b50506003805467ffffffffffffffff600160a01b9182900481166000908152600860205260409081902080546001600160a01b03191633908117909155935490519290041693506001600160a01b038b1692507fc9083441fee7f34b32dac11477d44ed85f06ee49083338b11e9a0a3383dc1f82906111d49086908c908990611f32565b60405180910390a46003546111fb90600160a01b900467ffffffffffffffff166001611e1e565b600360146101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055505050505050505050565b6112356112f6565b600a55565b6112426112f6565b6001600160a01b0381166112be5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016106b4565b6112c78161142b565b50565b6112d26112f6565b6001600160a01b038216600090815260056020526040902081906107a08282611d35565b6000546001600160a01b031633146107b85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016106b4565b6000610ee1826114e8565b600080808061136a86866114f3565b909450925050505b9250929050565b6040516001600160a01b0383166024820152604481018290526106d19084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b60408051601f198184030181529190526020810180516001600160e01b03167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261151e565b6000611423846001600160a01b03851684611606565b949350505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000611490836001600160a01b038416611623565b9392505050565b6040516001600160a01b03808516602483015283166044820152606481018290526107a09085907f23b872dd00000000000000000000000000000000000000000000000000000000906084016113be565b6000610ee182611693565b60008080611501858561169d565b600081815260029690960160205260409095205494959350505050565b6000611573826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166116a99092919063ffffffff16565b90508051600014806115945750808060200190518101906115949190611f5a565b6106d15760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016106b4565b6000828152600284016020526040812082905561142384846116b8565b600081815260028301602052604081205480151580611647575061164784846116c4565b6114905760405162461bcd60e51b815260206004820152601e60248201527f456e756d657261626c654d61703a206e6f6e6578697374656e74206b6579000060448201526064016106b4565b6000610ee1825490565b600061149083836116d0565b606061142384846000856116fa565b600061149083836117ec565b6000611490838361183b565b60008260000182815481106116e7576116e7611c1c565b9060005260206000200154905092915050565b6060824710156117725760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016106b4565b600080866001600160a01b0316858760405161178e9190611f77565b60006040518083038185875af1925050503d80600081146117cb576040519150601f19603f3d011682016040523d82523d6000602084013e6117d0565b606091505b50915091506117e187838387611853565b979650505050505050565b600081815260018301602052604081205461183357508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610ee1565b506000610ee1565b60008181526001830160205260408120541515611490565b606083156118c25782516000036118bb576001600160a01b0385163b6118bb5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016106b4565b5081611423565b61142383838151156118d75781518083602001fd5b8060405162461bcd60e51b81526004016106b49190611f93565b5050565b80356001600160a01b038116811461190c57600080fd5b919050565b60006020828403121561192357600080fd5b611490826118f5565b60006020828403121561193e57600080fd5b5035919050565b604080825283519082018190526000906020906060840190828701845b828110156119875781516001600160a01b031684529284019290840190600101611962565b5050508381038285015284518082528583019183019060005b818110156119bc578351835292840192918401916001016119a0565b5090979650505050505050565b6000806000606084860312156119de57600080fd5b6119e7846118f5565b92506119f5602085016118f5565b9150604084013590509250925092565b60008060408385031215611a1857600080fd5b611a21836118f5565b946020939093013593505050565b600060608284031215611a4157600080fd5b50919050565b60008060808385031215611a5a57600080fd5b611a63836118f5565b9150611a728460208501611a2f565b90509250929050565b60008083601f840112611a8d57600080fd5b50813567ffffffffffffffff811115611aa557600080fd5b60208301915083602082850101111561137257600080fd5b60008060008060008060a08789031215611ad657600080fd5b611adf876118f5565b9550602087013594506040870135935060608701359250608087013567ffffffffffffffff811115611b1057600080fd5b611b1c89828a01611a7b565b979a9699509497509295939492505050565b67ffffffffffffffff811681146112c757600080fd5b60008060008060008060c08789031215611b5d57600080fd5b611b66876118f5565b9550602087013594506040870135611b7d81611b2e565b959894975094956060810135955060808101359460a0909101359350915050565b600080600080600060808688031215611bb657600080fd5b85359450611bc6602087016118f5565b935060408601359250606086013567ffffffffffffffff811115611be957600080fd5b611bf588828901611a7b565b969995985093965092949392505050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611c5a57611c5a611c32565b5060010190565b80151581146112c757600080fd5b600081356001600160601b0381168114610ee157600080fd5b8135611c9381611c61565b815460ff19811691151560ff1691821783556cffffffffffffffffffffffff00611cbf60208601611c6f565b60081b1680836cffffffffffffffffffffffffff1984161717845578ffffffffffffffffffffffff00000000000000000000000000611d0060408701611c6f565b60681b16837fffffffffffffff0000000000000000000000000000000000000000000000000084161782171784555050505050565b6118f18282611c88565b600080600060608486031215611d5457600080fd5b8351611d5f81611c61565b6020850151909350611d7081611c61565b6040850151909250611d8181611b2e565b809150509250925092565b81810381811115610ee157610ee1611c32565b8082028115828204841417610ee157610ee1611c32565b600082611dd357634e487b7160e01b600052601260045260246000fd5b500490565b6001600160a01b038516815283602082015260606040820152816060820152818360808301376000818301608090810191909152601f909201601f191601019392505050565b67ffffffffffffffff818116838216019080821115611e3f57611e3f611c32565b5092915050565b60005b83811015611e61578181015183820152602001611e49565b50506000910152565b60008151808452611e82816020860160208601611e46565b601f01601f19169290920160200192915050565b6001600160a01b038716815285602082015260c060408201526000611ebe60c0830187611e6a565b606083019590955250608081019290925260a0909101529392505050565b848152836020820152826040820152608060608201526000611f016080830184611e6a565b9695505050505050565b600067ffffffffffffffff808316818103611f2857611f28611c32565b6001019392505050565b838152826020820152606060408201526000611f516060830184611e6a565b95945050505050565b600060208284031215611f6c57600080fd5b815161149081611c61565b60008251611f89818460208701611e46565b9190910192915050565b6020815260006114906020830184611e6a56fea2646970667358221220ad35862e1f7de9e1e35384152dbb08f9738ae7462845eaacae641ad7adb9366664736f6c6343000811003300000000000000000000000022276a1bd16bc3052b362c2e0f65aace04ed6f99000000000000000000000000530824da86689c9c17cdc2871ff29b058345b44a000000000000000000000000dee9ed3b19d104adbbe255b6befc680b4eaaada3","name":"Minter","is_blueprint":false,"license_type":"none","is_fully_verified":true,"is_verified_via_eth_bytecode_db":true,"language":"solidity","evm_version":"london","can_be_visualized_via_sol2uml":true,"is_verified_via_sourcify":true,"additional_sources":[{"file_path":"@openzeppelin/contracts/access/Ownable.sol","source_code":"// 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"},{"file_path":"@openzeppelin/contracts/interfaces/IERC20Metadata.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC20/extensions/IERC20Metadata.sol\";\n"},{"file_path":"@openzeppelin/contracts/token/ERC20/IERC20.sol","source_code":"// 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"},{"file_path":"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol","source_code":"// 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"},{"file_path":"@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol","source_code":"// 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"},{"file_path":"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol","source_code":"// 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"},{"file_path":"@openzeppelin/contracts/utils/Address.sol","source_code":"// 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"},{"file_path":"@openzeppelin/contracts/utils/Context.sol","source_code":"// 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"},{"file_path":"@openzeppelin/contracts/utils/structs/EnumerableMap.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableMap.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableMap.js.\n\npragma solidity ^0.8.0;\n\nimport \"./EnumerableSet.sol\";\n\n/**\n * @dev Library for managing an enumerable variant of Solidity's\n * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`]\n * type.\n *\n * Maps have the following properties:\n *\n * - Entries are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Entries 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 EnumerableMap for EnumerableMap.UintToAddressMap;\n *\n *     // Declare a set state variable\n *     EnumerableMap.UintToAddressMap private myMap;\n * }\n * ```\n *\n * The following map types are supported:\n *\n * - `uint256 -> address` (`UintToAddressMap`) since v3.0.0\n * - `address -> uint256` (`AddressToUintMap`) since v4.6.0\n * - `bytes32 -> bytes32` (`Bytes32ToBytes32Map`) since v4.6.0\n * - `uint256 -> uint256` (`UintToUintMap`) since v4.7.0\n * - `bytes32 -> uint256` (`Bytes32ToUintMap`) since v4.7.0\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 EnumerableMap, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableMap.\n * ====\n */\nlibrary EnumerableMap {\n    using EnumerableSet for EnumerableSet.Bytes32Set;\n\n    // To implement this library for multiple types with as little code\n    // repetition as possible, we write it in terms of a generic Map type with\n    // bytes32 keys and values.\n    // The Map implementation uses private functions, and user-facing\n    // implementations (such as Uint256ToAddressMap) are just wrappers around\n    // the underlying Map.\n    // This means that we can only create new EnumerableMaps for types that fit\n    // in bytes32.\n\n    struct Bytes32ToBytes32Map {\n        // Storage of keys\n        EnumerableSet.Bytes32Set _keys;\n        mapping(bytes32 => bytes32) _values;\n    }\n\n    /**\n     * @dev Adds a key-value pair to a map, or updates the value for an existing\n     * key. O(1).\n     *\n     * Returns true if the key was added to the map, that is if it was not\n     * already present.\n     */\n    function set(Bytes32ToBytes32Map storage map, bytes32 key, bytes32 value) internal returns (bool) {\n        map._values[key] = value;\n        return map._keys.add(key);\n    }\n\n    /**\n     * @dev Removes a key-value pair from a map. O(1).\n     *\n     * Returns true if the key was removed from the map, that is if it was present.\n     */\n    function remove(Bytes32ToBytes32Map storage map, bytes32 key) internal returns (bool) {\n        delete map._values[key];\n        return map._keys.remove(key);\n    }\n\n    /**\n     * @dev Returns true if the key is in the map. O(1).\n     */\n    function contains(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool) {\n        return map._keys.contains(key);\n    }\n\n    /**\n     * @dev Returns the number of key-value pairs in the map. O(1).\n     */\n    function length(Bytes32ToBytes32Map storage map) internal view returns (uint256) {\n        return map._keys.length();\n    }\n\n    /**\n     * @dev Returns the key-value pair stored at position `index` in the map. O(1).\n     *\n     * Note that there are no guarantees on the ordering of entries inside the\n     * array, and it may change when more entries are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(Bytes32ToBytes32Map storage map, uint256 index) internal view returns (bytes32, bytes32) {\n        bytes32 key = map._keys.at(index);\n        return (key, map._values[key]);\n    }\n\n    /**\n     * @dev Tries to returns the value associated with `key`. O(1).\n     * Does not revert if `key` is not in the map.\n     */\n    function tryGet(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool, bytes32) {\n        bytes32 value = map._values[key];\n        if (value == bytes32(0)) {\n            return (contains(map, key), bytes32(0));\n        } else {\n            return (true, value);\n        }\n    }\n\n    /**\n     * @dev Returns the value associated with `key`. O(1).\n     *\n     * Requirements:\n     *\n     * - `key` must be in the map.\n     */\n    function get(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bytes32) {\n        bytes32 value = map._values[key];\n        require(value != 0 || contains(map, key), \"EnumerableMap: nonexistent key\");\n        return value;\n    }\n\n    /**\n     * @dev Same as {get}, with a custom error message when `key` is not in the map.\n     *\n     * CAUTION: This function is deprecated because it requires allocating memory for the error\n     * message unnecessarily. For custom revert reasons use {tryGet}.\n     */\n    function get(\n        Bytes32ToBytes32Map storage map,\n        bytes32 key,\n        string memory errorMessage\n    ) internal view returns (bytes32) {\n        bytes32 value = map._values[key];\n        require(value != 0 || contains(map, key), errorMessage);\n        return value;\n    }\n\n    /**\n     * @dev Return the an array containing all the keys\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 map grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function keys(Bytes32ToBytes32Map storage map) internal view returns (bytes32[] memory) {\n        return map._keys.values();\n    }\n\n    // UintToUintMap\n\n    struct UintToUintMap {\n        Bytes32ToBytes32Map _inner;\n    }\n\n    /**\n     * @dev Adds a key-value pair to a map, or updates the value for an existing\n     * key. O(1).\n     *\n     * Returns true if the key was added to the map, that is if it was not\n     * already present.\n     */\n    function set(UintToUintMap storage map, uint256 key, uint256 value) internal returns (bool) {\n        return set(map._inner, bytes32(key), bytes32(value));\n    }\n\n    /**\n     * @dev Removes a value from a map. O(1).\n     *\n     * Returns true if the key was removed from the map, that is if it was present.\n     */\n    function remove(UintToUintMap storage map, uint256 key) internal returns (bool) {\n        return remove(map._inner, bytes32(key));\n    }\n\n    /**\n     * @dev Returns true if the key is in the map. O(1).\n     */\n    function contains(UintToUintMap storage map, uint256 key) internal view returns (bool) {\n        return contains(map._inner, bytes32(key));\n    }\n\n    /**\n     * @dev Returns the number of elements in the map. O(1).\n     */\n    function length(UintToUintMap storage map) internal view returns (uint256) {\n        return length(map._inner);\n    }\n\n    /**\n     * @dev Returns the element stored at position `index` in the map. O(1).\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(UintToUintMap storage map, uint256 index) internal view returns (uint256, uint256) {\n        (bytes32 key, bytes32 value) = at(map._inner, index);\n        return (uint256(key), uint256(value));\n    }\n\n    /**\n     * @dev Tries to returns the value associated with `key`. O(1).\n     * Does not revert if `key` is not in the map.\n     */\n    function tryGet(UintToUintMap storage map, uint256 key) internal view returns (bool, uint256) {\n        (bool success, bytes32 value) = tryGet(map._inner, bytes32(key));\n        return (success, uint256(value));\n    }\n\n    /**\n     * @dev Returns the value associated with `key`. O(1).\n     *\n     * Requirements:\n     *\n     * - `key` must be in the map.\n     */\n    function get(UintToUintMap storage map, uint256 key) internal view returns (uint256) {\n        return uint256(get(map._inner, bytes32(key)));\n    }\n\n    /**\n     * @dev Same as {get}, with a custom error message when `key` is not in the map.\n     *\n     * CAUTION: This function is deprecated because it requires allocating memory for the error\n     * message unnecessarily. For custom revert reasons use {tryGet}.\n     */\n    function get(UintToUintMap storage map, uint256 key, string memory errorMessage) internal view returns (uint256) {\n        return uint256(get(map._inner, bytes32(key), errorMessage));\n    }\n\n    /**\n     * @dev Return the an array containing all the keys\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 map grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function keys(UintToUintMap storage map) internal view returns (uint256[] memory) {\n        bytes32[] memory store = keys(map._inner);\n        uint256[] memory result;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := store\n        }\n\n        return result;\n    }\n\n    // UintToAddressMap\n\n    struct UintToAddressMap {\n        Bytes32ToBytes32Map _inner;\n    }\n\n    /**\n     * @dev Adds a key-value pair to a map, or updates the value for an existing\n     * key. O(1).\n     *\n     * Returns true if the key was added to the map, that is if it was not\n     * already present.\n     */\n    function set(UintToAddressMap storage map, uint256 key, address value) internal returns (bool) {\n        return set(map._inner, bytes32(key), bytes32(uint256(uint160(value))));\n    }\n\n    /**\n     * @dev Removes a value from a map. O(1).\n     *\n     * Returns true if the key was removed from the map, that is if it was present.\n     */\n    function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) {\n        return remove(map._inner, bytes32(key));\n    }\n\n    /**\n     * @dev Returns true if the key is in the map. O(1).\n     */\n    function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) {\n        return contains(map._inner, bytes32(key));\n    }\n\n    /**\n     * @dev Returns the number of elements in the map. O(1).\n     */\n    function length(UintToAddressMap storage map) internal view returns (uint256) {\n        return length(map._inner);\n    }\n\n    /**\n     * @dev Returns the element stored at position `index` in the map. O(1).\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(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) {\n        (bytes32 key, bytes32 value) = at(map._inner, index);\n        return (uint256(key), address(uint160(uint256(value))));\n    }\n\n    /**\n     * @dev Tries to returns the value associated with `key`. O(1).\n     * Does not revert if `key` is not in the map.\n     */\n    function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) {\n        (bool success, bytes32 value) = tryGet(map._inner, bytes32(key));\n        return (success, address(uint160(uint256(value))));\n    }\n\n    /**\n     * @dev Returns the value associated with `key`. O(1).\n     *\n     * Requirements:\n     *\n     * - `key` must be in the map.\n     */\n    function get(UintToAddressMap storage map, uint256 key) internal view returns (address) {\n        return address(uint160(uint256(get(map._inner, bytes32(key)))));\n    }\n\n    /**\n     * @dev Same as {get}, with a custom error message when `key` is not in the map.\n     *\n     * CAUTION: This function is deprecated because it requires allocating memory for the error\n     * message unnecessarily. For custom revert reasons use {tryGet}.\n     */\n    function get(\n        UintToAddressMap storage map,\n        uint256 key,\n        string memory errorMessage\n    ) internal view returns (address) {\n        return address(uint160(uint256(get(map._inner, bytes32(key), errorMessage))));\n    }\n\n    /**\n     * @dev Return the an array containing all the keys\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 map grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function keys(UintToAddressMap storage map) internal view returns (uint256[] memory) {\n        bytes32[] memory store = keys(map._inner);\n        uint256[] memory result;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := store\n        }\n\n        return result;\n    }\n\n    // AddressToUintMap\n\n    struct AddressToUintMap {\n        Bytes32ToBytes32Map _inner;\n    }\n\n    /**\n     * @dev Adds a key-value pair to a map, or updates the value for an existing\n     * key. O(1).\n     *\n     * Returns true if the key was added to the map, that is if it was not\n     * already present.\n     */\n    function set(AddressToUintMap storage map, address key, uint256 value) internal returns (bool) {\n        return set(map._inner, bytes32(uint256(uint160(key))), bytes32(value));\n    }\n\n    /**\n     * @dev Removes a value from a map. O(1).\n     *\n     * Returns true if the key was removed from the map, that is if it was present.\n     */\n    function remove(AddressToUintMap storage map, address key) internal returns (bool) {\n        return remove(map._inner, bytes32(uint256(uint160(key))));\n    }\n\n    /**\n     * @dev Returns true if the key is in the map. O(1).\n     */\n    function contains(AddressToUintMap storage map, address key) internal view returns (bool) {\n        return contains(map._inner, bytes32(uint256(uint160(key))));\n    }\n\n    /**\n     * @dev Returns the number of elements in the map. O(1).\n     */\n    function length(AddressToUintMap storage map) internal view returns (uint256) {\n        return length(map._inner);\n    }\n\n    /**\n     * @dev Returns the element stored at position `index` in the map. O(1).\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(AddressToUintMap storage map, uint256 index) internal view returns (address, uint256) {\n        (bytes32 key, bytes32 value) = at(map._inner, index);\n        return (address(uint160(uint256(key))), uint256(value));\n    }\n\n    /**\n     * @dev Tries to returns the value associated with `key`. O(1).\n     * Does not revert if `key` is not in the map.\n     */\n    function tryGet(AddressToUintMap storage map, address key) internal view returns (bool, uint256) {\n        (bool success, bytes32 value) = tryGet(map._inner, bytes32(uint256(uint160(key))));\n        return (success, uint256(value));\n    }\n\n    /**\n     * @dev Returns the value associated with `key`. O(1).\n     *\n     * Requirements:\n     *\n     * - `key` must be in the map.\n     */\n    function get(AddressToUintMap storage map, address key) internal view returns (uint256) {\n        return uint256(get(map._inner, bytes32(uint256(uint160(key)))));\n    }\n\n    /**\n     * @dev Same as {get}, with a custom error message when `key` is not in the map.\n     *\n     * CAUTION: This function is deprecated because it requires allocating memory for the error\n     * message unnecessarily. For custom revert reasons use {tryGet}.\n     */\n    function get(\n        AddressToUintMap storage map,\n        address key,\n        string memory errorMessage\n    ) internal view returns (uint256) {\n        return uint256(get(map._inner, bytes32(uint256(uint160(key))), errorMessage));\n    }\n\n    /**\n     * @dev Return the an array containing all the keys\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 map grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function keys(AddressToUintMap storage map) internal view returns (address[] memory) {\n        bytes32[] memory store = keys(map._inner);\n        address[] memory result;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := store\n        }\n\n        return result;\n    }\n\n    // Bytes32ToUintMap\n\n    struct Bytes32ToUintMap {\n        Bytes32ToBytes32Map _inner;\n    }\n\n    /**\n     * @dev Adds a key-value pair to a map, or updates the value for an existing\n     * key. O(1).\n     *\n     * Returns true if the key was added to the map, that is if it was not\n     * already present.\n     */\n    function set(Bytes32ToUintMap storage map, bytes32 key, uint256 value) internal returns (bool) {\n        return set(map._inner, key, bytes32(value));\n    }\n\n    /**\n     * @dev Removes a value from a map. O(1).\n     *\n     * Returns true if the key was removed from the map, that is if it was present.\n     */\n    function remove(Bytes32ToUintMap storage map, bytes32 key) internal returns (bool) {\n        return remove(map._inner, key);\n    }\n\n    /**\n     * @dev Returns true if the key is in the map. O(1).\n     */\n    function contains(Bytes32ToUintMap storage map, bytes32 key) internal view returns (bool) {\n        return contains(map._inner, key);\n    }\n\n    /**\n     * @dev Returns the number of elements in the map. O(1).\n     */\n    function length(Bytes32ToUintMap storage map) internal view returns (uint256) {\n        return length(map._inner);\n    }\n\n    /**\n     * @dev Returns the element stored at position `index` in the map. O(1).\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(Bytes32ToUintMap storage map, uint256 index) internal view returns (bytes32, uint256) {\n        (bytes32 key, bytes32 value) = at(map._inner, index);\n        return (key, uint256(value));\n    }\n\n    /**\n     * @dev Tries to returns the value associated with `key`. O(1).\n     * Does not revert if `key` is not in the map.\n     */\n    function tryGet(Bytes32ToUintMap storage map, bytes32 key) internal view returns (bool, uint256) {\n        (bool success, bytes32 value) = tryGet(map._inner, key);\n        return (success, uint256(value));\n    }\n\n    /**\n     * @dev Returns the value associated with `key`. O(1).\n     *\n     * Requirements:\n     *\n     * - `key` must be in the map.\n     */\n    function get(Bytes32ToUintMap storage map, bytes32 key) internal view returns (uint256) {\n        return uint256(get(map._inner, key));\n    }\n\n    /**\n     * @dev Same as {get}, with a custom error message when `key` is not in the map.\n     *\n     * CAUTION: This function is deprecated because it requires allocating memory for the error\n     * message unnecessarily. For custom revert reasons use {tryGet}.\n     */\n    function get(\n        Bytes32ToUintMap storage map,\n        bytes32 key,\n        string memory errorMessage\n    ) internal view returns (uint256) {\n        return uint256(get(map._inner, key, errorMessage));\n    }\n\n    /**\n     * @dev Return the an array containing all the keys\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 map grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function keys(Bytes32ToUintMap storage map) internal view returns (bytes32[] memory) {\n        bytes32[] memory store = keys(map._inner);\n        bytes32[] memory result;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := store\n        }\n\n        return result;\n    }\n}\n"},{"file_path":"@openzeppelin/contracts/utils/structs/EnumerableSet.sol","source_code":"// 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"},{"file_path":"contracts/interfaces/ISTBT.sol","source_code":"// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/interfaces/IERC20Metadata.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ninterface IERC1644 is IERC20 {\n    // Controller Events\n    event ControllerTransfer(\n        address _controller,\n        address indexed _from,\n        address indexed _to,\n        uint256 _value,\n        bytes _data,\n        bytes _operatorData\n    );\n\n    event ControllerRedemption(\n        address _controller,\n        address indexed _tokenHolder,\n        uint256 _value,\n        bytes _data,\n        bytes _operatorData\n    );\n\n    // Controller Operation\n    function isControllable() external view returns (bool);\n    function controllerTransfer(address _from, address _to, uint256 _value, bytes calldata _data, bytes calldata _operatorData) external;\n    function controllerRedeem(address _tokenHolder, uint256 _value, bytes calldata _data, bytes calldata _operatorData) external;\n}\n\ninterface IERC1643 {\n    // Document Events\n    event DocumentRemoved(bytes32 indexed _name, string _uri, bytes32 _documentHash);\n    event DocumentUpdated(bytes32 indexed _name, string _uri, bytes32 _documentHash);\n\n    // Document Management\n    function getDocument(bytes32 _name) external view returns (string memory, bytes32, uint256);\n    function setDocument(bytes32 _name, string calldata _uri, bytes32 _documentHash) external;\n    function removeDocument(bytes32 _name) external;\n    function getAllDocuments() external view returns (bytes32[] memory);\n}\n\ninterface IERC1594 is IERC20 {\n    // Issuance / Redemption Events\n    event Issued(address indexed _operator, address indexed _to, uint256 _value, bytes _data);\n    event Redeemed(address indexed _operator, address indexed _from, uint256 _value, bytes _data);\n\n    // Transfers\n    function transferWithData(address _to, uint256 _value, bytes calldata _data) external;\n    function transferFromWithData(address _from, address _to, uint256 _value, bytes calldata _data) external;\n\n    // Token Issuance\n    function isIssuable() external view returns (bool);\n    function issue(address _tokenHolder, uint256 _value, bytes calldata _data) external;\n\n    // Token Redemption\n    function redeem(uint256 _value, bytes calldata _data) external;\n    function redeemFrom(address _tokenHolder, uint256 _value, bytes calldata _data) external;\n\n    // Transfer Validity\n    function canTransfer(address _to, uint256 _value, bytes calldata _data) external view returns (bool, uint8, bytes32);\n    function canTransferFrom(address _from, address _to, uint256 _value, bytes calldata _data) external view returns (bool, uint8, bytes32);\n}\n\nstruct Permission {\n    bool sendAllowed; // default: true\n    bool receiveAllowed;\n    // Address holder’s KYC will be validated till this time, after that the holder needs to re-KYC.\n    uint64 expiryTime; // default:0 validated forever\n}\n\ninterface ISTBT is IERC20, IERC20Metadata, IERC1594, IERC1643, IERC1644 {\n    event InterestsDistributed(int interest, uint newTotalSupply, uint interestFromTime, uint interestToTime);\n    event TransferShares(address indexed from, address indexed to, uint256 sharesValue);\n\n    function issuer() external view returns (address); \n    function controller() external view returns (address); \n    function moderator() external view returns (address); \n    function totalShares() external view returns (uint);\n    function allowance(address _owner, address _spender) external view returns (uint256);\n    function permissions(address addr) external view returns (bool sendAllowed,\n                                                              bool receiveAllowed,\n                                                              uint64 expiryTime);\n    function lastDistributeTime() external view returns (uint64);\n    function minDistributeInterval() external view returns (uint64);\n    function maxDistributeRatio() external view returns (uint64);\n\n    function setIssuer(address _issuer) external;\n    function setController(address _controller) external;\n    function setModerator(address _moderator) external;\n    function setMinDistributeInterval(uint64 interval) external;\n    function setMaxDistributeRatio(uint64 ratio) external;\n    function setPermission(address addr, Permission calldata permission) external;\n\n    function distributeInterests(int256 _distributedInterest, uint interestFromTime, uint interestToTime) external;\n\n    function increaseAllowance(address _spender, uint256 _addedValue) external returns (bool);\n    function decreaseAllowance(address _spender, uint256 _subtractedValue) external returns (bool);\n\n    function sharesOf(address _account) external view returns (uint256);\n    function getSharesByAmount(uint256 _amount) external view returns (uint256 result);\n    function getSharesByAmountRoundUp(uint256 _amount) external view returns (uint256 result);\n    function getAmountByShares(uint256 _shares) external view returns (uint256 result);\n}\n"},{"file_path":"contracts/interfaces/IStbtTimelockController.sol","source_code":"// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.0;\n\ninterface IStbtTimelockController {\n    function schedule(\n        address target,\n        uint256 value,\n        bytes calldata data,\n        bytes32 predecessor,\n        bytes32 salt,\n        uint256 /*delay*/\n    ) external;\n}\n"}],"certified":false,"conflicting_implementations":null,"abi":[{"inputs":[{"internalType":"address","name":"_timeLockContract","type":"address"},{"internalType":"address","name":"_targetContract","type":"address"},{"internalType":"address","name":"_poolAccount","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"requestor","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"uint256","name":"nonce","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"depositAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"proposeAmount","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"salt","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"requestor","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"uint256","name":"nonce","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"salt","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"target","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"uint256","name":"nonce","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"redeemTxId","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"redeemServiceFeeRate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"executionPrice","type":"uint256"}],"name":"Settle","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"depositConfigMap","outputs":[{"internalType":"bool","name":"needDivAdjust","type":"bool"},{"internalType":"uint96","name":"adjustUnit","type":"uint96"},{"internalType":"uint96","name":"minimumDepositAmount","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"depositPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"coin","type":"address"}],"name":"getCoinInfo","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCoinsInfo","outputs":[{"internalType":"address[]","name":"coinList","type":"address[]"},{"internalType":"uint256[]","name":"receiverAndRateList","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"depositAmount","type":"uint256"},{"internalType":"uint256","name":"minProposedAmount","type":"uint256"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"nonceForMint","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nonceForRedeem","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolAccount","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"token","type":"address"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"name":"redeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"redeemConfigMap","outputs":[{"internalType":"bool","name":"needDivAdjust","type":"bool"},{"internalType":"uint96","name":"adjustUnit","type":"uint96"},{"internalType":"uint96","name":"minimumRedeemAmount","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"redeemFeeRateMap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"redeemPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint64","name":"nonce","type":"uint64"},{"internalType":"bytes32","name":"redeemTxId","type":"bytes32"},{"internalType":"uint256","name":"redeemServiceFeeRate","type":"uint256"},{"internalType":"uint256","name":"executionPrice","type":"uint256"}],"name":"redeemSettle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"redeemTargetMap","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"rescue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"receiverAndRate","type":"uint256"}],"name":"setCoinInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"components":[{"internalType":"bool","name":"needDivAdjust","type":"bool"},{"internalType":"uint96","name":"adjustUnit","type":"uint96"},{"internalType":"uint96","name":"minimumDepositAmount","type":"uint96"}],"internalType":"struct Minter.DepositConfig","name":"config","type":"tuple"}],"name":"setDepositConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"p","type":"uint256"}],"name":"setDepositPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_poolAccount","type":"address"}],"name":"setPoolAccount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"components":[{"internalType":"bool","name":"needDivAdjust","type":"bool"},{"internalType":"uint96","name":"adjustUnit","type":"uint96"},{"internalType":"uint96","name":"minimumRedeemAmount","type":"uint96"}],"internalType":"struct Minter.RedeemConfig","name":"config","type":"tuple"}],"name":"setRedeemConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"r","type":"uint256"}],"name":"setRedeemFeeRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"p","type":"uint256"}],"name":"setRedeemPeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_targetContract","type":"address"}],"name":"setTargetContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_timeLockContract","type":"address"}],"name":"setTimeLockContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"targetContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"timeLockContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"virtualCountOfRedeemSettled","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"}],"is_changed_bytecode":false,"is_partially_verified":false,"constructor_args":"00000000000000000000000022276a1bd16bc3052b362c2e0f65aace04ed6f99000000000000000000000000530824da86689c9c17cdc2871ff29b058345b44a000000000000000000000000dee9ed3b19d104adbbe255b6befc680b4eaaada3"}