{"constructor_args":"0x000000000000000000000000094c0e36210634c3cfa25dc11b96b562e0b076240000000000000000000000001a44076050125825900e736c501f859c50fe728c000000000000000000000000c1364ad857462e1b60609d9e56b5e24c5c21a31200000000000000000000000000000000000000000000001b1ae4d6e2ef500000","is_partially_verified":true,"is_changed_bytecode":false,"abi":[{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_lzEndpoint","type":"address"},{"internalType":"address","name":"_delegate","type":"address"},{"internalType":"uint256","name":"_cap","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"ExceedCap","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"InvalidDelegate","type":"error"},{"inputs":[],"name":"InvalidEndpointCall","type":"error"},{"inputs":[],"name":"InvalidLocalDecimals","type":"error"},{"inputs":[{"internalType":"bytes","name":"options","type":"bytes"}],"name":"InvalidOptions","type":"error"},{"inputs":[],"name":"LzTokenUnavailable","type":"error"},{"inputs":[{"internalType":"uint32","name":"eid","type":"uint32"}],"name":"NoPeer","type":"error"},{"inputs":[{"internalType":"uint256","name":"msgValue","type":"uint256"}],"name":"NotEnoughNative","type":"error"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"OnlyEndpoint","type":"error"},{"inputs":[{"internalType":"uint32","name":"eid","type":"uint32"},{"internalType":"bytes32","name":"sender","type":"bytes32"}],"name":"OnlyPeer","type":"error"},{"inputs":[],"name":"OnlySelf","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[{"internalType":"bytes","name":"result","type":"bytes"}],"name":"SimulationResult","type":"error"},{"inputs":[{"internalType":"uint256","name":"amountLD","type":"uint256"},{"internalType":"uint256","name":"minAmountLD","type":"uint256"}],"name":"SlippageExceeded","type":"error"},{"anonymous":false,"inputs":[{"components":[{"internalType":"uint32","name":"eid","type":"uint32"},{"internalType":"uint16","name":"msgType","type":"uint16"},{"internalType":"bytes","name":"options","type":"bytes"}],"indexed":false,"internalType":"struct EnforcedOptionParam[]","name":"_enforcedOptions","type":"tuple[]"}],"name":"EnforcedOptionSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"inspector","type":"address"}],"name":"MsgInspectorSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"guid","type":"bytes32"},{"indexed":false,"internalType":"uint32","name":"srcEid","type":"uint32"},{"indexed":true,"internalType":"address","name":"toAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountReceivedLD","type":"uint256"}],"name":"OFTReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"guid","type":"bytes32"},{"indexed":false,"internalType":"uint32","name":"dstEid","type":"uint32"},{"indexed":true,"internalType":"address","name":"fromAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountSentLD","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountReceivedLD","type":"uint256"}],"name":"OFTSent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"eid","type":"uint32"},{"indexed":false,"internalType":"bytes32","name":"peer","type":"bytes32"}],"name":"PeerSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"preCrimeAddress","type":"address"}],"name":"PreCrimeSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"beforeCap","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"afterCap","type":"uint256"}],"name":"capSet","type":"event"},{"inputs":[],"name":"CAP_SETTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SEND","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SEND_AND_CALL","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"srcEid","type":"uint32"},{"internalType":"bytes32","name":"sender","type":"bytes32"},{"internalType":"uint64","name":"nonce","type":"uint64"}],"internalType":"struct Origin","name":"origin","type":"tuple"}],"name":"allowInitializePath","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"approvalRequired","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"cap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"_eid","type":"uint32"},{"internalType":"uint16","name":"_msgType","type":"uint16"},{"internalType":"bytes","name":"_extraOptions","type":"bytes"}],"name":"combineOptions","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"composeMsgSender","outputs":[{"internalType":"address","name":"sender","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimalConversionRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"endpoint","outputs":[{"internalType":"contract ILayerZeroEndpointV2","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"eid","type":"uint32"},{"internalType":"uint16","name":"msgType","type":"uint16"}],"name":"enforcedOptions","outputs":[{"internalType":"bytes","name":"enforcedOption","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getQuota","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"_eid","type":"uint32"},{"internalType":"bytes32","name":"_peer","type":"bytes32"}],"name":"isPeer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"srcEid","type":"uint32"},{"internalType":"bytes32","name":"sender","type":"bytes32"},{"internalType":"uint64","name":"nonce","type":"uint64"}],"internalType":"struct Origin","name":"_origin","type":"tuple"},{"internalType":"bytes32","name":"_guid","type":"bytes32"},{"internalType":"bytes","name":"_message","type":"bytes"},{"internalType":"address","name":"_executor","type":"address"},{"internalType":"bytes","name":"_extraData","type":"bytes"}],"name":"lzReceive","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"uint32","name":"srcEid","type":"uint32"},{"internalType":"bytes32","name":"sender","type":"bytes32"},{"internalType":"uint64","name":"nonce","type":"uint64"}],"internalType":"struct Origin","name":"origin","type":"tuple"},{"internalType":"uint32","name":"dstEid","type":"uint32"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"bytes32","name":"guid","type":"bytes32"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"address","name":"executor","type":"address"},{"internalType":"bytes","name":"message","type":"bytes"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"internalType":"struct InboundPacket[]","name":"_packets","type":"tuple[]"}],"name":"lzReceiveAndRevert","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"srcEid","type":"uint32"},{"internalType":"bytes32","name":"sender","type":"bytes32"},{"internalType":"uint64","name":"nonce","type":"uint64"}],"internalType":"struct Origin","name":"_origin","type":"tuple"},{"internalType":"bytes32","name":"_guid","type":"bytes32"},{"internalType":"bytes","name":"_message","type":"bytes"},{"internalType":"address","name":"_executor","type":"address"},{"internalType":"bytes","name":"_extraData","type":"bytes"}],"name":"lzReceiveSimulate","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"msgInspector","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"","type":"uint32"},{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"nextNonce","outputs":[{"internalType":"uint64","name":"nonce","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oApp","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oAppVersion","outputs":[{"internalType":"uint64","name":"senderVersion","type":"uint64"},{"internalType":"uint64","name":"receiverVersion","type":"uint64"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"oftVersion","outputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"},{"internalType":"uint64","name":"version","type":"uint64"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"eid","type":"uint32"}],"name":"peers","outputs":[{"internalType":"bytes32","name":"peer","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"preCrime","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"quota","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"dstEid","type":"uint32"},{"internalType":"bytes32","name":"to","type":"bytes32"},{"internalType":"uint256","name":"amountLD","type":"uint256"},{"internalType":"uint256","name":"minAmountLD","type":"uint256"},{"internalType":"bytes","name":"extraOptions","type":"bytes"},{"internalType":"bytes","name":"composeMsg","type":"bytes"},{"internalType":"bytes","name":"oftCmd","type":"bytes"}],"internalType":"struct SendParam","name":"_sendParam","type":"tuple"}],"name":"quoteOFT","outputs":[{"components":[{"internalType":"uint256","name":"minAmountLD","type":"uint256"},{"internalType":"uint256","name":"maxAmountLD","type":"uint256"}],"internalType":"struct OFTLimit","name":"oftLimit","type":"tuple"},{"components":[{"internalType":"int256","name":"feeAmountLD","type":"int256"},{"internalType":"string","name":"description","type":"string"}],"internalType":"struct OFTFeeDetail[]","name":"oftFeeDetails","type":"tuple[]"},{"components":[{"internalType":"uint256","name":"amountSentLD","type":"uint256"},{"internalType":"uint256","name":"amountReceivedLD","type":"uint256"}],"internalType":"struct OFTReceipt","name":"oftReceipt","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"dstEid","type":"uint32"},{"internalType":"bytes32","name":"to","type":"bytes32"},{"internalType":"uint256","name":"amountLD","type":"uint256"},{"internalType":"uint256","name":"minAmountLD","type":"uint256"},{"internalType":"bytes","name":"extraOptions","type":"bytes"},{"internalType":"bytes","name":"composeMsg","type":"bytes"},{"internalType":"bytes","name":"oftCmd","type":"bytes"}],"internalType":"struct SendParam","name":"_sendParam","type":"tuple"},{"internalType":"bool","name":"_payInLzToken","type":"bool"}],"name":"quoteSend","outputs":[{"components":[{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"uint256","name":"lzTokenFee","type":"uint256"}],"internalType":"struct MessagingFee","name":"msgFee","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"dstEid","type":"uint32"},{"internalType":"bytes32","name":"to","type":"bytes32"},{"internalType":"uint256","name":"amountLD","type":"uint256"},{"internalType":"uint256","name":"minAmountLD","type":"uint256"},{"internalType":"bytes","name":"extraOptions","type":"bytes"},{"internalType":"bytes","name":"composeMsg","type":"bytes"},{"internalType":"bytes","name":"oftCmd","type":"bytes"}],"internalType":"struct SendParam","name":"_sendParam","type":"tuple"},{"components":[{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"uint256","name":"lzTokenFee","type":"uint256"}],"internalType":"struct MessagingFee","name":"_fee","type":"tuple"},{"internalType":"address","name":"_refundAddress","type":"address"}],"name":"send","outputs":[{"components":[{"internalType":"bytes32","name":"guid","type":"bytes32"},{"internalType":"uint64","name":"nonce","type":"uint64"},{"components":[{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"uint256","name":"lzTokenFee","type":"uint256"}],"internalType":"struct MessagingFee","name":"fee","type":"tuple"}],"internalType":"struct MessagingReceipt","name":"msgReceipt","type":"tuple"},{"components":[{"internalType":"uint256","name":"amountSentLD","type":"uint256"},{"internalType":"uint256","name":"amountReceivedLD","type":"uint256"}],"internalType":"struct OFTReceipt","name":"oftReceipt","type":"tuple"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_cap","type":"uint256"}],"name":"setCap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_delegate","type":"address"}],"name":"setDelegate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"eid","type":"uint32"},{"internalType":"uint16","name":"msgType","type":"uint16"},{"internalType":"bytes","name":"options","type":"bytes"}],"internalType":"struct EnforcedOptionParam[]","name":"_enforcedOptions","type":"tuple[]"}],"name":"setEnforcedOptions","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_msgInspector","type":"address"}],"name":"setMsgInspector","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_eid","type":"uint32"},{"internalType":"bytes32","name":"_peer","type":"bytes32"}],"name":"setPeer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_preCrime","type":"address"}],"name":"setPreCrime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sharedDecimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}],"conflicting_implementations":null,"certified":false,"additional_sources":[],"is_verified_via_sourcify":true,"can_be_visualized_via_sol2uml":true,"evm_version":"paris","language":"solidity","is_verified_via_eth_bytecode_db":true,"is_fully_verified":false,"license_type":"none","is_blueprint":false,"name":"StoneBTCLayerZeroAdapter","creation_bytecode":"0x60e060405234801561001057600080fd5b506040516135be3803806135be83398101604081905261002f91610339565b838383826001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610070573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100949190610384565b8282818181818b6001600160a01b0381166100c957604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b6100d281610218565b506001600160a01b03808316608052811661010057604051632d618d8160e21b815260040160405180910390fd5b60805160405163ca5eb5e160e01b81526001600160a01b0383811660048301529091169063ca5eb5e190602401600060405180830381600087803b15801561014757600080fd5b505af115801561015b573d6000803e3d6000fd5b505050505050505061017161026860201b60201c565b60ff168360ff161015610197576040516301e9714b60e41b815260040160405180910390fd5b6101a26006846103c4565b6101ad90600a6104c4565b60a0525050506001600160a01b0390921660c052506101cf905060003361026d565b5060068190556040805160008152602081018390527ff27578bad49dfc71b9908e9ae657cc28bbffd97db256abd83599a35e4aa3bc87910160405180910390a1505050506104d3565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600690565b60008281526005602090815260408083206001600160a01b038516845290915281205460ff166103135760008381526005602090815260408083206001600160a01b03861684529091529020805460ff191660011790556102cb3390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4506001610317565b5060005b92915050565b80516001600160a01b038116811461033457600080fd5b919050565b6000806000806080858703121561034f57600080fd5b6103588561031d565b93506103666020860161031d565b92506103746040860161031d565b6060959095015193969295505050565b60006020828403121561039657600080fd5b815160ff811681146103a757600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b60ff8281168282160390811115610317576103176103ae565b6001815b6001841115610418578085048111156103fc576103fc6103ae565b600184161561040a57908102905b60019390931c9280026103e1565b935093915050565b60008261042f57506001610317565b8161043c57506000610317565b8160018114610452576002811461045c57610478565b6001915050610317565b60ff84111561046d5761046d6103ae565b50506001821b610317565b5060208310610133831016604e8410600b841016171561049b575081810a610317565b6104a860001984846103dd565b80600019048211156104bc576104bc6103ae565b029392505050565b60006103a760ff841683610420565b60805160a05160c0516130686105566000396000818161085901528181611acc0152611d1b01526000818161064a01528181611c4801528181611cc40152611e4201526000818161054c015281816109a70152818161130b0152818161159d015281816118e101528181611b6c01528181611f0d0152611fc401526130686000f3fe6080604052600436106102725760003560e01c80637d25a05e1161014f578063bb0b6a53116100c1578063d42438851161007a578063d4243885146107b6578063d547741f146107d6578063f2fde38b146107f6578063f58bfed314610816578063fc0c546a1461084a578063ff7bd03d1461087d57600080fd5b8063bb0b6a5314610702578063bc70b3541461072f578063bd815db01461074f578063c7c7f5b314610762578063ca5eb5e114610783578063d045a0dc146107a357600080fd5b80639f68b964116101135780639f68b9641461066c578063a162b0a214610680578063a217fddf146106ad578063b731ea0a146106c2578063b92d0eff146104c3578063b98bd070146106e257600080fd5b80637d25a05e146105a3578063857749b0146105de5780638da5cb5b146105fa57806391d1485414610618578063963efcaa1461063857600080fd5b80633400288b116101e857806352ae2879116101ac57806352ae2879146104c35780635535d461146104d65780635a0dfe4d146105035780635e280f111461053a5780636fc1b31e1461056e578063715018a61461058e57600080fd5b80633400288b14610420578063355274ea1461044057806336568abe146104565780633b6f743b1461047657806347786d37146104a357600080fd5b8063156a0d0f1161023a578063156a0d0f1461035057806317442b70146103775780631df8ba77146103985780631f5e1334146103bb578063248a9ca3146103d05780632f2ff15d1461040057600080fd5b806301ffc9a7146102775780630d35b415146102ac578063111ecdad146102db57806313137d6514610313578063134d4f2514610328575b600080fd5b34801561028357600080fd5b506102976102923660046121cf565b61089d565b60405190151581526020015b60405180910390f35b3480156102b857600080fd5b506102cc6102c7366004612211565b6108d4565b6040516102a393929190612295565b3480156102e757600080fd5b506004546102fb906001600160a01b031681565b6040516001600160a01b0390911681526020016102a3565b6103266103213660046123a1565b6109a5565b005b34801561033457600080fd5b5061033d600281565b60405161ffff90911681526020016102a3565b34801561035c57600080fd5b506040805162b9270b60e21b815260016020820152016102a3565b34801561038357600080fd5b506040805160018082526020820152016102a3565b3480156103a457600080fd5b506103ad610a65565b6040519081526020016102a3565b3480156103c757600080fd5b5061033d600181565b3480156103dc57600080fd5b506103ad6103eb366004612442565b60009081526005602052604090206001015490565b34801561040c57600080fd5b5061032661041b36600461245b565b610aaf565b34801561042c57600080fd5b5061032661043b3660046124a4565b610ada565b34801561044c57600080fd5b506103ad60065481565b34801561046257600080fd5b5061032661047136600461245b565b610b38565b34801561048257600080fd5b506104966104913660046124dc565b610b70565b6040516102a39190612522565b3480156104af57600080fd5b506103266104be366004612442565b610bd7565b3480156104cf57600080fd5b50306102fb565b3480156104e257600080fd5b506104f66104f136600461254b565b610c43565b6040516102a3919061257e565b34801561050f57600080fd5b5061029761051e3660046124a4565b63ffffffff919091166000908152600160205260409020541490565b34801561054657600080fd5b506102fb7f000000000000000000000000000000000000000000000000000000000000000081565b34801561057a57600080fd5b50610326610589366004612591565b610ce8565b34801561059a57600080fd5b50610326610d45565b3480156105af57600080fd5b506105c66105be3660046124a4565b600092915050565b6040516001600160401b0390911681526020016102a3565b3480156105ea57600080fd5b50604051600681526020016102a3565b34801561060657600080fd5b506000546001600160a01b03166102fb565b34801561062457600080fd5b5061029761063336600461245b565b610d59565b34801561064457600080fd5b506103ad7f000000000000000000000000000000000000000000000000000000000000000081565b34801561067857600080fd5b506000610297565b34801561068c57600080fd5b506103ad61069b366004612442565b60076020526000908152604090205481565b3480156106b957600080fd5b506103ad600081565b3480156106ce57600080fd5b506002546102fb906001600160a01b031681565b3480156106ee57600080fd5b506103266106fd3660046125f2565b610d84565b34801561070e57600080fd5b506103ad61071d366004612633565b60016020526000908152604090205481565b34801561073b57600080fd5b506104f661074a36600461264e565b610ee5565b61032661075d3660046125f2565b611060565b6107756107703660046126ae565b6111ea565b6040516102a392919061271b565b34801561078f57600080fd5b5061032661079e366004612591565b6112e4565b6103266107b13660046123a1565b61136a565b3480156107c257600080fd5b506103266107d1366004612591565b611399565b3480156107e257600080fd5b506103266107f136600461245b565b6113ef565b34801561080257600080fd5b50610326610811366004612591565b611414565b34801561082257600080fd5b506103ad7f1274f5ba296ef8f0b6bf00056f3691bb6d3053e061d99a0e9b0a263c419810e881565b34801561085657600080fd5b507f00000000000000000000000000000000000000000000000000000000000000006102fb565b34801561088957600080fd5b5061029761089836600461276d565b611452565b60006001600160e01b03198216637965db0b60e01b14806108ce57506301ffc9a760e01b6001600160e01b03198316145b92915050565b60408051808201909152600080825260208201526060610907604051806040016040528060008152602001600081525090565b60408051808201825260008082526001600160401b03602080840182905284518381529081019094529195509182610962565b60408051808201909152600081526060602082015281526020019060019003908161093a5790505b509350600080610987604089013560608a013561098260208c018c612633565b611488565b60408051808201909152918252602082015296989597505050505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031633146109f5576040516391ac5e4f60e01b81523360048201526024015b60405180910390fd5b60208701803590610a0f90610a0a908a612633565b6114cc565b14610a4d57610a216020880188612633565b60405163309afaf360e21b815263ffffffff9091166004820152602088013560248201526044016109ec565b610a5c87878787878787611508565b50505050505050565b600080600781610a7862015180426127b5565b8152602001908152602001600020549050806006541115610aa75780600654610aa191906127d7565b91505090565b600091505090565b600082815260056020526040902060010154610aca8161166f565b610ad48383611679565b50505050565b610ae261170d565b63ffffffff8216600081815260016020908152604091829020849055815192835282018390527f238399d427b947898edb290f5ff0f9109849b1c3ba196a42e35f00c50a54b98b91015b60405180910390a15050565b6001600160a01b0381163314610b615760405163334bd91960e11b815260040160405180910390fd5b610b6b828261173a565b505050565b60408051808201909152600080825260208201526000610ba0604085013560608601356109826020880188612633565b915050600080610bb086846117a7565b9092509050610bcd610bc56020880188612633565b8383886118cb565b9695505050505050565b7f1274f5ba296ef8f0b6bf00056f3691bb6d3053e061d99a0e9b0a263c419810e8610c018161166f565b60065460408051918252602082018490527ff27578bad49dfc71b9908e9ae657cc28bbffd97db256abd83599a35e4aa3bc87910160405180910390a150600655565b600360209081526000928352604080842090915290825290208054610c67906127ea565b80601f0160208091040260200160405190810160405280929190818152602001828054610c93906127ea565b8015610ce05780601f10610cb557610100808354040283529160200191610ce0565b820191906000526020600020905b815481529060010190602001808311610cc357829003601f168201915b505050505081565b610cf061170d565b600480546001600160a01b0319166001600160a01b0383169081179091556040519081527ff0be4f1e87349231d80c36b33f9e8639658eeaf474014dee15a3e6a4d4414197906020015b60405180910390a150565b610d4d61170d565b610d5760006119ac565b565b60009182526005602090815260408084206001600160a01b0393909316845291905290205460ff1690565b610d8c61170d565b60005b81811015610eb357610dd1838383818110610dac57610dac61281e565b9050602002810190610dbe9190612834565b610dcc906040810190612854565b6119fc565b828282818110610de357610de361281e565b9050602002810190610df59190612834565b610e03906040810190612854565b60036000868686818110610e1957610e1961281e565b9050602002810190610e2b9190612834565b610e39906020810190612633565b63ffffffff1663ffffffff1681526020019081526020016000206000868686818110610e6757610e6761281e565b9050602002810190610e799190612834565b610e8a90604081019060200161289a565b61ffff168152602081019190915260400160002091610eaa9190836128fc565b50600101610d8f565b507fbe4864a8e820971c0247f5992e2da559595f7bf076a21cb5928d443d2a13b6748282604051610b2c9291906129e4565b63ffffffff8416600090815260036020908152604080832061ffff87168452909152812080546060929190610f19906127ea565b80601f0160208091040260200160405190810160405280929190818152602001828054610f45906127ea565b8015610f925780601f10610f6757610100808354040283529160200191610f92565b820191906000526020600020905b815481529060010190602001808311610f7557829003601f168201915b505050505090508051600003610fe25783838080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509294506110589350505050565b6000839003610ff2579050611058565b6002831061103b5761100484846119fc565b806110128460028188612ace565b60405160200161102493929190612af8565b604051602081830303815290604052915050611058565b8383604051639a6d49cd60e01b81526004016109ec929190612b20565b949350505050565b60005b81811015611169573683838381811061107e5761107e61281e565b90506020028101906110909190612b34565b90506110c36110a26020830183612633565b602083013563ffffffff919091166000908152600160205260409020541490565b6110cd5750611161565b3063d045a0dc60c08301358360a08101356110ec610100830183612854565b6110fd610100890160e08a01612591565b61110b6101208a018a612854565b6040518963ffffffff1660e01b815260040161112d9796959493929190612b60565b6000604051808303818588803b15801561114657600080fd5b505af115801561115a573d6000803e3d6000fd5b5050505050505b600101611063565b50336001600160a01b0316638e9e70996040518163ffffffff1660e01b8152600401600060405180830381865afa1580156111a8573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526111d09190810190612c3e565b604051638351eea760e01b81526004016109ec919061257e565b6111f2612188565b60408051808201909152600080825260208201526000806112286040880135606089013561122360208b018b612633565b611a3e565b9150915060008061123989846117a7565b909250905061126561124e60208b018b612633565b838361125f368d90038d018d612cc9565b8b611b39565b60408051808201909152858152602080820186905282519298509096503391907f85496b760a4b7f8d66384b9df21b381f5d1b1e79f229a47aaf4c232edc2fe59a906112b3908d018d612633565b6040805163ffffffff909216825260208201899052810187905260600160405180910390a350505050935093915050565b6112ec61170d565b60405163ca5eb5e160e01b81526001600160a01b0382811660048301527f0000000000000000000000000000000000000000000000000000000000000000169063ca5eb5e190602401600060405180830381600087803b15801561134f57600080fd5b505af1158015611363573d6000803e3d6000fd5b5050505050565b33301461138a5760405163029a949d60e31b815260040160405180910390fd5b610a5c87878787878787610a4d565b6113a161170d565b600280546001600160a01b0319166001600160a01b0383169081179091556040519081527fd48d879cef83a1c0bdda516f27b13ddb1b3f8bbac1c9e1511bb2a659c242776090602001610d3a565b60008281526005602052604090206001015461140a8161166f565b610ad4838361173a565b61141c61170d565b6001600160a01b03811661144657604051631e4fbdf760e01b8152600060048201526024016109ec565b61144f816119ac565b50565b600060208201803590600190839061146a9086612633565b63ffffffff1681526020810191909152604001600020541492915050565b60008061149485611c44565b9150819050838110156114c4576040516371c4efed60e01b815260048101829052602481018590526044016109ec565b935093915050565b63ffffffff8116600090815260016020526040812054806108ce5760405163f6ff4fb760e01b815263ffffffff841660048201526024016109ec565b600061151a6115178787611c7b565b90565b905060006115468261153461152f8a8a611c9a565b611cbd565b61154160208d018d612633565b611cf2565b9050602886111561160d57600061158361156660608c0160408d01612cfc565b61157360208d018d612633565b8461157e8c8c611d81565b611dcc565b604051633e5ac80960e11b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690637cb59012906115d99086908d906000908790600401612d19565b600060405180830381600087803b1580156115f357600080fd5b505af1158015611607573d6000803e3d6000fd5b50505050505b6001600160a01b038216887fefed6d3500546b29533b128a29e3a94d70788727f0507505ac12eaf2e578fd9c61164660208d018d612633565b6040805163ffffffff9092168252602082018690520160405180910390a3505050505050505050565b61144f8133611dfe565b60006116858383610d59565b6117055760008381526005602090815260408083206001600160a01b03861684529091529020805460ff191660011790556116bd3390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45060016108ce565b5060006108ce565b6000546001600160a01b03163314610d575760405163118cdaa760e01b81523360048201526024016109ec565b60006117468383610d59565b156117055760008381526005602090815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45060016108ce565b606080600061180485602001356117bd86611e3b565b6117ca60a0890189612854565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611e6792505050565b909350905060008161181757600161181a565b60025b905061183a61182c6020880188612633565b8261074a60808a018a612854565b6004549093506001600160a01b0316156118c2576004805460405163043a78eb60e01b81526001600160a01b039091169163043a78eb9161187f918891889101612d4a565b602060405180830381865afa15801561189c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118c09190612d6f565b505b50509250929050565b60408051808201909152600080825260208201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663ddc28c586040518060a001604052808863ffffffff16815260200161192e896114cc565b8152602001878152602001868152602001851515815250306040518363ffffffff1660e01b8152600401611963929190612d8c565b6040805180830381865afa15801561197f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119a39190612e36565b95945050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000611a0b6002828486612ace565b611a1491612e52565b60f01c905060038114610b6b578282604051639a6d49cd60e01b81526004016109ec929190612b20565b600080611a4c858585611488565b90925090506000611a6062015180426127b5565b600081815260076020526040902054909150611a7d908490612e8a565b60008281526007602052604090208190556006541015611ab05760405163f57c52b760e01b815260040160405180910390fd5b604051632770a7eb60e21b8152336004820152602481018490527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690639dc29fac90604401600060405180830381600087803b158015611b1857600080fd5b505af1158015611b2c573d6000803e3d6000fd5b5050505050935093915050565b611b41612188565b6000611b508460000151611ee1565b602085015190915015611b6a57611b6a8460200151611f09565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316632637a450826040518060a001604052808b63ffffffff168152602001611bba8c6114cc565b81526020018a815260200189815260200160008960200151111515815250866040518463ffffffff1660e01b8152600401611bf6929190612d8c565b60806040518083038185885af1158015611c14573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190611c399190612e9d565b979650505050505050565b60007f0000000000000000000000000000000000000000000000000000000000000000611c7181846127b5565b6108ce9190612f06565b6000611c8a6020828486612ace565b611c9391612f1d565b9392505050565b6000611caa602860208486612ace565b611cb391612f3b565b60c01c9392505050565b60006108ce7f00000000000000000000000000000000000000000000000000000000000000006001600160401b038416612f06565b6040516340c10f1960e01b81526001600160a01b038481166004830152602482018490526000917f0000000000000000000000000000000000000000000000000000000000000000909116906340c10f1990604401600060405180830381600087803b158015611d6157600080fd5b505af1158015611d75573d6000803e3d6000fd5b50949695505050505050565b6060611d908260288186612ace565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929695505050505050565b606084848484604051602001611de59493929190612f71565b6040516020818303038152906040529050949350505050565b611e088282610d59565b611e375760405163e2517d3f60e01b81526001600160a01b0382166004820152602481018390526044016109ec565b5050565b60006108ce7f0000000000000000000000000000000000000000000000000000000000000000836127b5565b8051606090151580611eb0578484604051602001611e9c92919091825260c01b6001600160c01b031916602082015260280190565b604051602081830303815290604052611ed7565b84843385604051602001611ec79493929190612fc0565b6040516020818303038152906040525b9150935093915050565b6000813414611f05576040516304fb820960e51b81523460048201526024016109ec565b5090565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663e4fe1d946040518163ffffffff1660e01b8152600401602060405180830381865afa158015611f69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f8d9190613003565b90506001600160a01b038116611fb6576040516329b99a9560e11b815260040160405180910390fd5b6040805133602482018190527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03818116604485015260648085018890528551808603909101815260849094019094526020830180516001600160e01b03166323b872dd60e01b179052611e37938516928690610ad490859060006120428383612090565b905080516000141580156120675750808060200190518101906120659190612d6f565b155b15610b6b57604051635274afe760e01b81526001600160a01b03841660048201526024016109ec565b6060611c938383600084600080856001600160a01b031684866040516120b69190613020565b60006040518083038185875af1925050503d80600081146120f3576040519150601f19603f3d011682016040523d82523d6000602084013e6120f8565b606091505b5091509150610bcd868383606082612118576121138261215f565b611c93565b815115801561212f57506001600160a01b0384163b155b1561215857604051639996b31560e01b81526001600160a01b03851660048201526024016109ec565b5080611c93565b80511561216f5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b60405180606001604052806000801916815260200160006001600160401b031681526020016121ca604051806040016040528060008152602001600081525090565b905290565b6000602082840312156121e157600080fd5b81356001600160e01b031981168114611c9357600080fd5b600060e0828403121561220b57600080fd5b50919050565b60006020828403121561222357600080fd5b81356001600160401b0381111561223957600080fd5b611058848285016121f9565b60005b83811015612260578181015183820152602001612248565b50506000910152565b60008151808452612281816020860160208601612245565b601f01601f19169290920160200192915050565b8351815260208085015190820152600060a0820160a0604084015280855180835260c08501915060c08160051b86010192506020870160005b828110156123165760bf1987860301845281518051865260208101519050604060208701526123006040870182612269565b95505060209384019391909101906001016122ce565b5050855160608601525050602084015160808401529050611058565b60006060828403121561220b57600080fd5b60008083601f84011261235657600080fd5b5081356001600160401b0381111561236d57600080fd5b60208301915083602082850101111561238557600080fd5b9250929050565b6001600160a01b038116811461144f57600080fd5b600080600080600080600060e0888a0312156123bc57600080fd5b6123c68989612332565b96506060880135955060808801356001600160401b038111156123e857600080fd5b6123f48a828b01612344565b90965094505060a08801356124088161238c565b925060c08801356001600160401b0381111561242357600080fd5b61242f8a828b01612344565b989b979a50959850939692959293505050565b60006020828403121561245457600080fd5b5035919050565b6000806040838503121561246e57600080fd5b8235915060208301356124808161238c565b809150509250929050565b803563ffffffff8116811461249f57600080fd5b919050565b600080604083850312156124b757600080fd5b6124c08361248b565b946020939093013593505050565b801515811461144f57600080fd5b600080604083850312156124ef57600080fd5b82356001600160401b0381111561250557600080fd5b612511858286016121f9565b9250506020830135612480816124ce565b8151815260208083015190820152604081016108ce565b803561ffff8116811461249f57600080fd5b6000806040838503121561255e57600080fd5b6125678361248b565b915061257560208401612539565b90509250929050565b602081526000611c936020830184612269565b6000602082840312156125a357600080fd5b8135611c938161238c565b60008083601f8401126125c057600080fd5b5081356001600160401b038111156125d757600080fd5b6020830191508360208260051b850101111561238557600080fd5b6000806020838503121561260557600080fd5b82356001600160401b0381111561261b57600080fd5b612627858286016125ae565b90969095509350505050565b60006020828403121561264557600080fd5b611c938261248b565b6000806000806060858703121561266457600080fd5b61266d8561248b565b935061267b60208601612539565b925060408501356001600160401b0381111561269657600080fd5b6126a287828801612344565b95989497509550505050565b600080600083850360808112156126c457600080fd5b84356001600160401b038111156126da57600080fd5b6126e6878288016121f9565b9450506040601f19820112156126fb57600080fd5b5060208401915060608401356127108161238c565b809150509250925092565b600060c082019050835182526001600160401b0360208501511660208301526040840151612756604084018280518252602090810151910152565b5082516080830152602083015160a0830152611c93565b60006060828403121561277f57600080fd5b611c938383612332565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000826127d257634e487b7160e01b600052601260045260246000fd5b500490565b818103818111156108ce576108ce61279f565b600181811c908216806127fe57607f821691505b60208210810361220b57634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b60008235605e1983360301811261284a57600080fd5b9190910192915050565b6000808335601e1984360301811261286b57600080fd5b8301803591506001600160401b0382111561288557600080fd5b60200191503681900382131561238557600080fd5b6000602082840312156128ac57600080fd5b611c9382612539565b601f821115610b6b57806000526020600020601f840160051c810160208510156128dc5750805b601f840160051c820191505b8181101561136357600081556001016128e8565b6001600160401b0383111561291357612913612789565b6129278361292183546127ea565b836128b5565b6000601f84116001811461295b57600085156129435750838201355b600019600387901b1c1916600186901b178355611363565b600083815260209020601f19861690835b8281101561298c578685013582556020948501946001909201910161296c565b50868210156129a95760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6020808252810182905260006040600584901b830181019083018583605e1936839003015b87821015612ac157868503603f190184528235818112612a2857600080fd5b890163ffffffff612a388261248b565b16865261ffff612a4a60208301612539565b1660208701526040810135601e19823603018112612a6757600080fd5b016020810190356001600160401b03811115612a8257600080fd5b803603821315612a9157600080fd5b60606040880152612aa66060880182846129bb565b96505050602083019250602084019350600182019150612a09565b5092979650505050505050565b60008085851115612ade57600080fd5b83861115612aeb57600080fd5b5050820193919092039150565b60008451612b0a818460208901612245565b8201838582376000930192835250909392505050565b6020815260006110586020830184866129bb565b6000823561013e1983360301811261284a57600080fd5b6001600160401b038116811461144f57600080fd5b63ffffffff612b6e8961248b565b1681526020888101359082015260006040890135612b8b81612b4b565b6001600160401b03811660408401525087606083015260e06080830152612bb660e0830187896129bb565b6001600160a01b03861660a084015282810360c0840152612bd88185876129bb565b9a9950505050505050505050565b604080519081016001600160401b0381118282101715612c0857612c08612789565b60405290565b604051601f8201601f191681016001600160401b0381118282101715612c3657612c36612789565b604052919050565b600060208284031215612c5057600080fd5b81516001600160401b03811115612c6657600080fd5b8201601f81018413612c7757600080fd5b80516001600160401b03811115612c9057612c90612789565b612ca3601f8201601f1916602001612c0e565b818152856020838501011115612cb857600080fd5b6119a3826020830160208601612245565b60006040828403128015612cdc57600080fd5b50612ce5612be6565b823581526020928301359281019290925250919050565b600060208284031215612d0e57600080fd5b8135611c9381612b4b565b60018060a01b038516815283602082015261ffff83166040820152608060608201526000610bcd6080830184612269565b604081526000612d5d6040830185612269565b82810360208401526119a38185612269565b600060208284031215612d8157600080fd5b8151611c93816124ce565b6040815263ffffffff8351166040820152602083015160608201526000604084015160a06080840152612dc260e0840182612269565b90506060850151603f198483030160a0850152612ddf8282612269565b60809690960151151560c08501525050506001600160a01b039190911660209091015290565b600060408284031215612e1757600080fd5b612e1f612be6565b825181526020928301519281019290925250919050565b600060408284031215612e4857600080fd5b611c938383612e05565b80356001600160f01b03198116906002841015612e83576001600160f01b0319600285900360031b81901b82161691505b5092915050565b808201808211156108ce576108ce61279f565b60006080828403128015612eb057600080fd5b50604051606081016001600160401b0381118282101715612ed357612ed3612789565b604052825181526020830151612ee881612b4b565b6020820152612efa8460408501612e05565b60408201529392505050565b80820281158282048414176108ce576108ce61279f565b803560208310156108ce57600019602084900360031b1b1692915050565b80356001600160c01b03198116906008841015612e83576001600160c01b031960089490940360031b84901b1690921692915050565b6001600160401b0360c01b8560c01b16815263ffffffff60e01b8460e01b16600882015282600c82015260008251612fb081602c850160208701612245565b91909101602c0195945050505050565b8481526001600160401b0360c01b8460c01b16602082015282602882015260008251612ff3816048850160208701612245565b9190910160480195945050505050565b60006020828403121561301557600080fd5b8151611c938161238c565b6000825161284a81846020870161224556fea2646970667358221220d8948057d7a1ac7d4f7b61987c8dbd71ca4547a99daab35b64f92c870112a3a464736f6c634300081a0033000000000000000000000000094c0e36210634c3cfa25dc11b96b562e0b076240000000000000000000000001a44076050125825900e736c501f859c50fe728c000000000000000000000000c1364ad857462e1b60609d9e56b5e24c5c21a31200000000000000000000000000000000000000000000001b1ae4d6e2ef500000","external_libraries":[],"proxy_type":null,"implementations":[],"verified_at":"2024-10-16T10:36:38.903804Z","is_verified_via_verifier_alliance":false,"compiler_version":"0.8.26+commit.8a97fa7a","decoded_constructor_args":[["0x094c0e36210634c3CfA25DC11B96b562E0b07624",{"internalType":"address","name":"_token","type":"address"}],["0x1a44076050125825900e736c501f859c50fE728c",{"internalType":"address","name":"_lzEndpoint","type":"address"}],["0xc1364aD857462e1B60609D9e56b5E24C5c21a312",{"internalType":"address","name":"_delegate","type":"address"}],["500000000000000000000",{"internalType":"uint256","name":"_cap","type":"uint256"}]],"sourcify_repo_url":"https://repo.sourcify.dev/1/0x3f690f43a9fCA689829A22bf925c89B7a48ca57F","optimization_runs":200,"compiler_settings":{"evmVersion":"paris","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":true,"runs":200},"remappings":[]},"is_verified":true,"verified_twin_address_hash":null,"optimization_enabled":true,"deployed_bytecode":"0x6080604052600436106102725760003560e01c80637d25a05e1161014f578063bb0b6a53116100c1578063d42438851161007a578063d4243885146107b6578063d547741f146107d6578063f2fde38b146107f6578063f58bfed314610816578063fc0c546a1461084a578063ff7bd03d1461087d57600080fd5b8063bb0b6a5314610702578063bc70b3541461072f578063bd815db01461074f578063c7c7f5b314610762578063ca5eb5e114610783578063d045a0dc146107a357600080fd5b80639f68b964116101135780639f68b9641461066c578063a162b0a214610680578063a217fddf146106ad578063b731ea0a146106c2578063b92d0eff146104c3578063b98bd070146106e257600080fd5b80637d25a05e146105a3578063857749b0146105de5780638da5cb5b146105fa57806391d1485414610618578063963efcaa1461063857600080fd5b80633400288b116101e857806352ae2879116101ac57806352ae2879146104c35780635535d461146104d65780635a0dfe4d146105035780635e280f111461053a5780636fc1b31e1461056e578063715018a61461058e57600080fd5b80633400288b14610420578063355274ea1461044057806336568abe146104565780633b6f743b1461047657806347786d37146104a357600080fd5b8063156a0d0f1161023a578063156a0d0f1461035057806317442b70146103775780631df8ba77146103985780631f5e1334146103bb578063248a9ca3146103d05780632f2ff15d1461040057600080fd5b806301ffc9a7146102775780630d35b415146102ac578063111ecdad146102db57806313137d6514610313578063134d4f2514610328575b600080fd5b34801561028357600080fd5b506102976102923660046121cf565b61089d565b60405190151581526020015b60405180910390f35b3480156102b857600080fd5b506102cc6102c7366004612211565b6108d4565b6040516102a393929190612295565b3480156102e757600080fd5b506004546102fb906001600160a01b031681565b6040516001600160a01b0390911681526020016102a3565b6103266103213660046123a1565b6109a5565b005b34801561033457600080fd5b5061033d600281565b60405161ffff90911681526020016102a3565b34801561035c57600080fd5b506040805162b9270b60e21b815260016020820152016102a3565b34801561038357600080fd5b506040805160018082526020820152016102a3565b3480156103a457600080fd5b506103ad610a65565b6040519081526020016102a3565b3480156103c757600080fd5b5061033d600181565b3480156103dc57600080fd5b506103ad6103eb366004612442565b60009081526005602052604090206001015490565b34801561040c57600080fd5b5061032661041b36600461245b565b610aaf565b34801561042c57600080fd5b5061032661043b3660046124a4565b610ada565b34801561044c57600080fd5b506103ad60065481565b34801561046257600080fd5b5061032661047136600461245b565b610b38565b34801561048257600080fd5b506104966104913660046124dc565b610b70565b6040516102a39190612522565b3480156104af57600080fd5b506103266104be366004612442565b610bd7565b3480156104cf57600080fd5b50306102fb565b3480156104e257600080fd5b506104f66104f136600461254b565b610c43565b6040516102a3919061257e565b34801561050f57600080fd5b5061029761051e3660046124a4565b63ffffffff919091166000908152600160205260409020541490565b34801561054657600080fd5b506102fb7f0000000000000000000000001a44076050125825900e736c501f859c50fe728c81565b34801561057a57600080fd5b50610326610589366004612591565b610ce8565b34801561059a57600080fd5b50610326610d45565b3480156105af57600080fd5b506105c66105be3660046124a4565b600092915050565b6040516001600160401b0390911681526020016102a3565b3480156105ea57600080fd5b50604051600681526020016102a3565b34801561060657600080fd5b506000546001600160a01b03166102fb565b34801561062457600080fd5b5061029761063336600461245b565b610d59565b34801561064457600080fd5b506103ad7f000000000000000000000000000000000000000000000000000000e8d4a5100081565b34801561067857600080fd5b506000610297565b34801561068c57600080fd5b506103ad61069b366004612442565b60076020526000908152604090205481565b3480156106b957600080fd5b506103ad600081565b3480156106ce57600080fd5b506002546102fb906001600160a01b031681565b3480156106ee57600080fd5b506103266106fd3660046125f2565b610d84565b34801561070e57600080fd5b506103ad61071d366004612633565b60016020526000908152604090205481565b34801561073b57600080fd5b506104f661074a36600461264e565b610ee5565b61032661075d3660046125f2565b611060565b6107756107703660046126ae565b6111ea565b6040516102a392919061271b565b34801561078f57600080fd5b5061032661079e366004612591565b6112e4565b6103266107b13660046123a1565b61136a565b3480156107c257600080fd5b506103266107d1366004612591565b611399565b3480156107e257600080fd5b506103266107f136600461245b565b6113ef565b34801561080257600080fd5b50610326610811366004612591565b611414565b34801561082257600080fd5b506103ad7f1274f5ba296ef8f0b6bf00056f3691bb6d3053e061d99a0e9b0a263c419810e881565b34801561085657600080fd5b507f000000000000000000000000094c0e36210634c3cfa25dc11b96b562e0b076246102fb565b34801561088957600080fd5b5061029761089836600461276d565b611452565b60006001600160e01b03198216637965db0b60e01b14806108ce57506301ffc9a760e01b6001600160e01b03198316145b92915050565b60408051808201909152600080825260208201526060610907604051806040016040528060008152602001600081525090565b60408051808201825260008082526001600160401b03602080840182905284518381529081019094529195509182610962565b60408051808201909152600081526060602082015281526020019060019003908161093a5790505b509350600080610987604089013560608a013561098260208c018c612633565b611488565b60408051808201909152918252602082015296989597505050505050565b7f0000000000000000000000001a44076050125825900e736c501f859c50fe728c6001600160a01b031633146109f5576040516391ac5e4f60e01b81523360048201526024015b60405180910390fd5b60208701803590610a0f90610a0a908a612633565b6114cc565b14610a4d57610a216020880188612633565b60405163309afaf360e21b815263ffffffff9091166004820152602088013560248201526044016109ec565b610a5c87878787878787611508565b50505050505050565b600080600781610a7862015180426127b5565b8152602001908152602001600020549050806006541115610aa75780600654610aa191906127d7565b91505090565b600091505090565b600082815260056020526040902060010154610aca8161166f565b610ad48383611679565b50505050565b610ae261170d565b63ffffffff8216600081815260016020908152604091829020849055815192835282018390527f238399d427b947898edb290f5ff0f9109849b1c3ba196a42e35f00c50a54b98b91015b60405180910390a15050565b6001600160a01b0381163314610b615760405163334bd91960e11b815260040160405180910390fd5b610b6b828261173a565b505050565b60408051808201909152600080825260208201526000610ba0604085013560608601356109826020880188612633565b915050600080610bb086846117a7565b9092509050610bcd610bc56020880188612633565b8383886118cb565b9695505050505050565b7f1274f5ba296ef8f0b6bf00056f3691bb6d3053e061d99a0e9b0a263c419810e8610c018161166f565b60065460408051918252602082018490527ff27578bad49dfc71b9908e9ae657cc28bbffd97db256abd83599a35e4aa3bc87910160405180910390a150600655565b600360209081526000928352604080842090915290825290208054610c67906127ea565b80601f0160208091040260200160405190810160405280929190818152602001828054610c93906127ea565b8015610ce05780601f10610cb557610100808354040283529160200191610ce0565b820191906000526020600020905b815481529060010190602001808311610cc357829003601f168201915b505050505081565b610cf061170d565b600480546001600160a01b0319166001600160a01b0383169081179091556040519081527ff0be4f1e87349231d80c36b33f9e8639658eeaf474014dee15a3e6a4d4414197906020015b60405180910390a150565b610d4d61170d565b610d5760006119ac565b565b60009182526005602090815260408084206001600160a01b0393909316845291905290205460ff1690565b610d8c61170d565b60005b81811015610eb357610dd1838383818110610dac57610dac61281e565b9050602002810190610dbe9190612834565b610dcc906040810190612854565b6119fc565b828282818110610de357610de361281e565b9050602002810190610df59190612834565b610e03906040810190612854565b60036000868686818110610e1957610e1961281e565b9050602002810190610e2b9190612834565b610e39906020810190612633565b63ffffffff1663ffffffff1681526020019081526020016000206000868686818110610e6757610e6761281e565b9050602002810190610e799190612834565b610e8a90604081019060200161289a565b61ffff168152602081019190915260400160002091610eaa9190836128fc565b50600101610d8f565b507fbe4864a8e820971c0247f5992e2da559595f7bf076a21cb5928d443d2a13b6748282604051610b2c9291906129e4565b63ffffffff8416600090815260036020908152604080832061ffff87168452909152812080546060929190610f19906127ea565b80601f0160208091040260200160405190810160405280929190818152602001828054610f45906127ea565b8015610f925780601f10610f6757610100808354040283529160200191610f92565b820191906000526020600020905b815481529060010190602001808311610f7557829003601f168201915b505050505090508051600003610fe25783838080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509294506110589350505050565b6000839003610ff2579050611058565b6002831061103b5761100484846119fc565b806110128460028188612ace565b60405160200161102493929190612af8565b604051602081830303815290604052915050611058565b8383604051639a6d49cd60e01b81526004016109ec929190612b20565b949350505050565b60005b81811015611169573683838381811061107e5761107e61281e565b90506020028101906110909190612b34565b90506110c36110a26020830183612633565b602083013563ffffffff919091166000908152600160205260409020541490565b6110cd5750611161565b3063d045a0dc60c08301358360a08101356110ec610100830183612854565b6110fd610100890160e08a01612591565b61110b6101208a018a612854565b6040518963ffffffff1660e01b815260040161112d9796959493929190612b60565b6000604051808303818588803b15801561114657600080fd5b505af115801561115a573d6000803e3d6000fd5b5050505050505b600101611063565b50336001600160a01b0316638e9e70996040518163ffffffff1660e01b8152600401600060405180830381865afa1580156111a8573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526111d09190810190612c3e565b604051638351eea760e01b81526004016109ec919061257e565b6111f2612188565b60408051808201909152600080825260208201526000806112286040880135606089013561122360208b018b612633565b611a3e565b9150915060008061123989846117a7565b909250905061126561124e60208b018b612633565b838361125f368d90038d018d612cc9565b8b611b39565b60408051808201909152858152602080820186905282519298509096503391907f85496b760a4b7f8d66384b9df21b381f5d1b1e79f229a47aaf4c232edc2fe59a906112b3908d018d612633565b6040805163ffffffff909216825260208201899052810187905260600160405180910390a350505050935093915050565b6112ec61170d565b60405163ca5eb5e160e01b81526001600160a01b0382811660048301527f0000000000000000000000001a44076050125825900e736c501f859c50fe728c169063ca5eb5e190602401600060405180830381600087803b15801561134f57600080fd5b505af1158015611363573d6000803e3d6000fd5b5050505050565b33301461138a5760405163029a949d60e31b815260040160405180910390fd5b610a5c87878787878787610a4d565b6113a161170d565b600280546001600160a01b0319166001600160a01b0383169081179091556040519081527fd48d879cef83a1c0bdda516f27b13ddb1b3f8bbac1c9e1511bb2a659c242776090602001610d3a565b60008281526005602052604090206001015461140a8161166f565b610ad4838361173a565b61141c61170d565b6001600160a01b03811661144657604051631e4fbdf760e01b8152600060048201526024016109ec565b61144f816119ac565b50565b600060208201803590600190839061146a9086612633565b63ffffffff1681526020810191909152604001600020541492915050565b60008061149485611c44565b9150819050838110156114c4576040516371c4efed60e01b815260048101829052602481018590526044016109ec565b935093915050565b63ffffffff8116600090815260016020526040812054806108ce5760405163f6ff4fb760e01b815263ffffffff841660048201526024016109ec565b600061151a6115178787611c7b565b90565b905060006115468261153461152f8a8a611c9a565b611cbd565b61154160208d018d612633565b611cf2565b9050602886111561160d57600061158361156660608c0160408d01612cfc565b61157360208d018d612633565b8461157e8c8c611d81565b611dcc565b604051633e5ac80960e11b81529091506001600160a01b037f0000000000000000000000001a44076050125825900e736c501f859c50fe728c1690637cb59012906115d99086908d906000908790600401612d19565b600060405180830381600087803b1580156115f357600080fd5b505af1158015611607573d6000803e3d6000fd5b50505050505b6001600160a01b038216887fefed6d3500546b29533b128a29e3a94d70788727f0507505ac12eaf2e578fd9c61164660208d018d612633565b6040805163ffffffff9092168252602082018690520160405180910390a3505050505050505050565b61144f8133611dfe565b60006116858383610d59565b6117055760008381526005602090815260408083206001600160a01b03861684529091529020805460ff191660011790556116bd3390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45060016108ce565b5060006108ce565b6000546001600160a01b03163314610d575760405163118cdaa760e01b81523360048201526024016109ec565b60006117468383610d59565b156117055760008381526005602090815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45060016108ce565b606080600061180485602001356117bd86611e3b565b6117ca60a0890189612854565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611e6792505050565b909350905060008161181757600161181a565b60025b905061183a61182c6020880188612633565b8261074a60808a018a612854565b6004549093506001600160a01b0316156118c2576004805460405163043a78eb60e01b81526001600160a01b039091169163043a78eb9161187f918891889101612d4a565b602060405180830381865afa15801561189c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118c09190612d6f565b505b50509250929050565b60408051808201909152600080825260208201527f0000000000000000000000001a44076050125825900e736c501f859c50fe728c6001600160a01b031663ddc28c586040518060a001604052808863ffffffff16815260200161192e896114cc565b8152602001878152602001868152602001851515815250306040518363ffffffff1660e01b8152600401611963929190612d8c565b6040805180830381865afa15801561197f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119a39190612e36565b95945050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000611a0b6002828486612ace565b611a1491612e52565b60f01c905060038114610b6b578282604051639a6d49cd60e01b81526004016109ec929190612b20565b600080611a4c858585611488565b90925090506000611a6062015180426127b5565b600081815260076020526040902054909150611a7d908490612e8a565b60008281526007602052604090208190556006541015611ab05760405163f57c52b760e01b815260040160405180910390fd5b604051632770a7eb60e21b8152336004820152602481018490527f000000000000000000000000094c0e36210634c3cfa25dc11b96b562e0b076246001600160a01b031690639dc29fac90604401600060405180830381600087803b158015611b1857600080fd5b505af1158015611b2c573d6000803e3d6000fd5b5050505050935093915050565b611b41612188565b6000611b508460000151611ee1565b602085015190915015611b6a57611b6a8460200151611f09565b7f0000000000000000000000001a44076050125825900e736c501f859c50fe728c6001600160a01b0316632637a450826040518060a001604052808b63ffffffff168152602001611bba8c6114cc565b81526020018a815260200189815260200160008960200151111515815250866040518463ffffffff1660e01b8152600401611bf6929190612d8c565b60806040518083038185885af1158015611c14573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190611c399190612e9d565b979650505050505050565b60007f000000000000000000000000000000000000000000000000000000e8d4a51000611c7181846127b5565b6108ce9190612f06565b6000611c8a6020828486612ace565b611c9391612f1d565b9392505050565b6000611caa602860208486612ace565b611cb391612f3b565b60c01c9392505050565b60006108ce7f000000000000000000000000000000000000000000000000000000e8d4a510006001600160401b038416612f06565b6040516340c10f1960e01b81526001600160a01b038481166004830152602482018490526000917f000000000000000000000000094c0e36210634c3cfa25dc11b96b562e0b07624909116906340c10f1990604401600060405180830381600087803b158015611d6157600080fd5b505af1158015611d75573d6000803e3d6000fd5b50949695505050505050565b6060611d908260288186612ace565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929695505050505050565b606084848484604051602001611de59493929190612f71565b6040516020818303038152906040529050949350505050565b611e088282610d59565b611e375760405163e2517d3f60e01b81526001600160a01b0382166004820152602481018390526044016109ec565b5050565b60006108ce7f000000000000000000000000000000000000000000000000000000e8d4a51000836127b5565b8051606090151580611eb0578484604051602001611e9c92919091825260c01b6001600160c01b031916602082015260280190565b604051602081830303815290604052611ed7565b84843385604051602001611ec79493929190612fc0565b6040516020818303038152906040525b9150935093915050565b6000813414611f05576040516304fb820960e51b81523460048201526024016109ec565b5090565b60007f0000000000000000000000001a44076050125825900e736c501f859c50fe728c6001600160a01b031663e4fe1d946040518163ffffffff1660e01b8152600401602060405180830381865afa158015611f69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f8d9190613003565b90506001600160a01b038116611fb6576040516329b99a9560e11b815260040160405180910390fd5b6040805133602482018190527f0000000000000000000000001a44076050125825900e736c501f859c50fe728c6001600160a01b03818116604485015260648085018890528551808603909101815260849094019094526020830180516001600160e01b03166323b872dd60e01b179052611e37938516928690610ad490859060006120428383612090565b905080516000141580156120675750808060200190518101906120659190612d6f565b155b15610b6b57604051635274afe760e01b81526001600160a01b03841660048201526024016109ec565b6060611c938383600084600080856001600160a01b031684866040516120b69190613020565b60006040518083038185875af1925050503d80600081146120f3576040519150601f19603f3d011682016040523d82523d6000602084013e6120f8565b606091505b5091509150610bcd868383606082612118576121138261215f565b611c93565b815115801561212f57506001600160a01b0384163b155b1561215857604051639996b31560e01b81526001600160a01b03851660048201526024016109ec565b5080611c93565b80511561216f5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b60405180606001604052806000801916815260200160006001600160401b031681526020016121ca604051806040016040528060008152602001600081525090565b905290565b6000602082840312156121e157600080fd5b81356001600160e01b031981168114611c9357600080fd5b600060e0828403121561220b57600080fd5b50919050565b60006020828403121561222357600080fd5b81356001600160401b0381111561223957600080fd5b611058848285016121f9565b60005b83811015612260578181015183820152602001612248565b50506000910152565b60008151808452612281816020860160208601612245565b601f01601f19169290920160200192915050565b8351815260208085015190820152600060a0820160a0604084015280855180835260c08501915060c08160051b86010192506020870160005b828110156123165760bf1987860301845281518051865260208101519050604060208701526123006040870182612269565b95505060209384019391909101906001016122ce565b5050855160608601525050602084015160808401529050611058565b60006060828403121561220b57600080fd5b60008083601f84011261235657600080fd5b5081356001600160401b0381111561236d57600080fd5b60208301915083602082850101111561238557600080fd5b9250929050565b6001600160a01b038116811461144f57600080fd5b600080600080600080600060e0888a0312156123bc57600080fd5b6123c68989612332565b96506060880135955060808801356001600160401b038111156123e857600080fd5b6123f48a828b01612344565b90965094505060a08801356124088161238c565b925060c08801356001600160401b0381111561242357600080fd5b61242f8a828b01612344565b989b979a50959850939692959293505050565b60006020828403121561245457600080fd5b5035919050565b6000806040838503121561246e57600080fd5b8235915060208301356124808161238c565b809150509250929050565b803563ffffffff8116811461249f57600080fd5b919050565b600080604083850312156124b757600080fd5b6124c08361248b565b946020939093013593505050565b801515811461144f57600080fd5b600080604083850312156124ef57600080fd5b82356001600160401b0381111561250557600080fd5b612511858286016121f9565b9250506020830135612480816124ce565b8151815260208083015190820152604081016108ce565b803561ffff8116811461249f57600080fd5b6000806040838503121561255e57600080fd5b6125678361248b565b915061257560208401612539565b90509250929050565b602081526000611c936020830184612269565b6000602082840312156125a357600080fd5b8135611c938161238c565b60008083601f8401126125c057600080fd5b5081356001600160401b038111156125d757600080fd5b6020830191508360208260051b850101111561238557600080fd5b6000806020838503121561260557600080fd5b82356001600160401b0381111561261b57600080fd5b612627858286016125ae565b90969095509350505050565b60006020828403121561264557600080fd5b611c938261248b565b6000806000806060858703121561266457600080fd5b61266d8561248b565b935061267b60208601612539565b925060408501356001600160401b0381111561269657600080fd5b6126a287828801612344565b95989497509550505050565b600080600083850360808112156126c457600080fd5b84356001600160401b038111156126da57600080fd5b6126e6878288016121f9565b9450506040601f19820112156126fb57600080fd5b5060208401915060608401356127108161238c565b809150509250925092565b600060c082019050835182526001600160401b0360208501511660208301526040840151612756604084018280518252602090810151910152565b5082516080830152602083015160a0830152611c93565b60006060828403121561277f57600080fd5b611c938383612332565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000826127d257634e487b7160e01b600052601260045260246000fd5b500490565b818103818111156108ce576108ce61279f565b600181811c908216806127fe57607f821691505b60208210810361220b57634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b60008235605e1983360301811261284a57600080fd5b9190910192915050565b6000808335601e1984360301811261286b57600080fd5b8301803591506001600160401b0382111561288557600080fd5b60200191503681900382131561238557600080fd5b6000602082840312156128ac57600080fd5b611c9382612539565b601f821115610b6b57806000526020600020601f840160051c810160208510156128dc5750805b601f840160051c820191505b8181101561136357600081556001016128e8565b6001600160401b0383111561291357612913612789565b6129278361292183546127ea565b836128b5565b6000601f84116001811461295b57600085156129435750838201355b600019600387901b1c1916600186901b178355611363565b600083815260209020601f19861690835b8281101561298c578685013582556020948501946001909201910161296c565b50868210156129a95760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6020808252810182905260006040600584901b830181019083018583605e1936839003015b87821015612ac157868503603f190184528235818112612a2857600080fd5b890163ffffffff612a388261248b565b16865261ffff612a4a60208301612539565b1660208701526040810135601e19823603018112612a6757600080fd5b016020810190356001600160401b03811115612a8257600080fd5b803603821315612a9157600080fd5b60606040880152612aa66060880182846129bb565b96505050602083019250602084019350600182019150612a09565b5092979650505050505050565b60008085851115612ade57600080fd5b83861115612aeb57600080fd5b5050820193919092039150565b60008451612b0a818460208901612245565b8201838582376000930192835250909392505050565b6020815260006110586020830184866129bb565b6000823561013e1983360301811261284a57600080fd5b6001600160401b038116811461144f57600080fd5b63ffffffff612b6e8961248b565b1681526020888101359082015260006040890135612b8b81612b4b565b6001600160401b03811660408401525087606083015260e06080830152612bb660e0830187896129bb565b6001600160a01b03861660a084015282810360c0840152612bd88185876129bb565b9a9950505050505050505050565b604080519081016001600160401b0381118282101715612c0857612c08612789565b60405290565b604051601f8201601f191681016001600160401b0381118282101715612c3657612c36612789565b604052919050565b600060208284031215612c5057600080fd5b81516001600160401b03811115612c6657600080fd5b8201601f81018413612c7757600080fd5b80516001600160401b03811115612c9057612c90612789565b612ca3601f8201601f1916602001612c0e565b818152856020838501011115612cb857600080fd5b6119a3826020830160208601612245565b60006040828403128015612cdc57600080fd5b50612ce5612be6565b823581526020928301359281019290925250919050565b600060208284031215612d0e57600080fd5b8135611c9381612b4b565b60018060a01b038516815283602082015261ffff83166040820152608060608201526000610bcd6080830184612269565b604081526000612d5d6040830185612269565b82810360208401526119a38185612269565b600060208284031215612d8157600080fd5b8151611c93816124ce565b6040815263ffffffff8351166040820152602083015160608201526000604084015160a06080840152612dc260e0840182612269565b90506060850151603f198483030160a0850152612ddf8282612269565b60809690960151151560c08501525050506001600160a01b039190911660209091015290565b600060408284031215612e1757600080fd5b612e1f612be6565b825181526020928301519281019290925250919050565b600060408284031215612e4857600080fd5b611c938383612e05565b80356001600160f01b03198116906002841015612e83576001600160f01b0319600285900360031b81901b82161691505b5092915050565b808201808211156108ce576108ce61279f565b60006080828403128015612eb057600080fd5b50604051606081016001600160401b0381118282101715612ed357612ed3612789565b604052825181526020830151612ee881612b4b565b6020820152612efa8460408501612e05565b60408201529392505050565b80820281158282048414176108ce576108ce61279f565b803560208310156108ce57600019602084900360031b1b1692915050565b80356001600160c01b03198116906008841015612e83576001600160c01b031960089490940360031b84901b1690921692915050565b6001600160401b0360c01b8560c01b16815263ffffffff60e01b8460e01b16600882015282600c82015260008251612fb081602c850160208701612245565b91909101602c0195945050505050565b8481526001600160401b0360c01b8460c01b16602082015282602882015260008251612ff3816048850160208701612245565b9190910160480195945050505050565b60006020828403121561301557600080fd5b8151611c938161238c565b6000825161284a81846020870161224556fea2646970667358221220d8948057d7a1ac7d4f7b61987c8dbd71ca4547a99daab35b64f92c870112a3a464736f6c634300081a0033","source_code":"// SPDX-License-Identifier: BUSL-1.1\r\npragma solidity =0.8.26 >=0.8.0 ^0.8.20;\r\n\r\n// lib/LayerZero-v2/packages/layerzero-v2/evm/oapp/contracts/oapp/interfaces/IOAppMsgInspector.sol\r\n\r\n/**\r\n * @title IOAppMsgInspector\r\n * @dev Interface for the OApp Message Inspector, allowing examination of message and options contents.\r\n */\r\ninterface IOAppMsgInspector {\r\n    // Custom error message for inspection failure\r\n    error InspectionFailed(bytes message, bytes options);\r\n\r\n    /**\r\n     * @notice Allows the inspector to examine LayerZero message contents and optionally throw a revert if invalid.\r\n     * @param _message The message payload to be inspected.\r\n     * @param _options Additional options or parameters for inspection.\r\n     * @return valid A boolean indicating whether the inspection passed (true) or failed (false).\r\n     *\r\n     * @dev Optionally done as a revert, OR use the boolean provided to handle the failure.\r\n     */\r\n    function inspect(bytes calldata _message, bytes calldata _options) external view returns (bool valid);\r\n}\r\n\r\n// lib/LayerZero-v2/packages/layerzero-v2/evm/oapp/contracts/oapp/interfaces/IOAppOptionsType3.sol\r\n\r\n/**\r\n * @dev Struct representing enforced option parameters.\r\n */\r\nstruct EnforcedOptionParam {\r\n    uint32 eid; // Endpoint ID\r\n    uint16 msgType; // Message Type\r\n    bytes options; // Additional options\r\n}\r\n\r\n/**\r\n * @title IOAppOptionsType3\r\n * @dev Interface for the OApp with Type 3 Options, allowing the setting and combining of enforced options.\r\n */\r\ninterface IOAppOptionsType3 {\r\n    // Custom error message for invalid options\r\n    error InvalidOptions(bytes options);\r\n\r\n    // Event emitted when enforced options are set\r\n    event EnforcedOptionSet(EnforcedOptionParam[] _enforcedOptions);\r\n\r\n    /**\r\n     * @notice Sets enforced options for specific endpoint and message type combinations.\r\n     * @param _enforcedOptions An array of EnforcedOptionParam structures specifying enforced options.\r\n     */\r\n    function setEnforcedOptions(EnforcedOptionParam[] calldata _enforcedOptions) external;\r\n\r\n    /**\r\n     * @notice Combines options for a given endpoint and message type.\r\n     * @param _eid The endpoint ID.\r\n     * @param _msgType The OApp message type.\r\n     * @param _extraOptions Additional options passed by the caller.\r\n     * @return options The combination of caller specified options AND enforced options.\r\n     */\r\n    function combineOptions(\r\n        uint32 _eid,\r\n        uint16 _msgType,\r\n        bytes calldata _extraOptions\r\n    ) external view returns (bytes memory options);\r\n}\r\n\r\n// lib/LayerZero-v2/packages/layerzero-v2/evm/oapp/contracts/oft/libs/OFTComposeMsgCodec.sol\r\n\r\nlibrary OFTComposeMsgCodec {\r\n    // Offset constants for decoding composed messages\r\n    uint8 private constant NONCE_OFFSET = 8;\r\n    uint8 private constant SRC_EID_OFFSET = 12;\r\n    uint8 private constant AMOUNT_LD_OFFSET = 44;\r\n    uint8 private constant COMPOSE_FROM_OFFSET = 76;\r\n\r\n    /**\r\n     * @dev Encodes a OFT composed message.\r\n     * @param _nonce The nonce value.\r\n     * @param _srcEid The source endpoint ID.\r\n     * @param _amountLD The amount in local decimals.\r\n     * @param _composeMsg The composed message.\r\n     * @return _msg The encoded Composed message.\r\n     */\r\n    function encode(\r\n        uint64 _nonce,\r\n        uint32 _srcEid,\r\n        uint256 _amountLD,\r\n        bytes memory _composeMsg // 0x[composeFrom][composeMsg]\r\n    ) internal pure returns (bytes memory _msg) {\r\n        _msg = abi.encodePacked(_nonce, _srcEid, _amountLD, _composeMsg);\r\n    }\r\n\r\n    /**\r\n     * @dev Retrieves the nonce from the composed message.\r\n     * @param _msg The message.\r\n     * @return The nonce value.\r\n     */\r\n    function nonce(bytes calldata _msg) internal pure returns (uint64) {\r\n        return uint64(bytes8(_msg[:NONCE_OFFSET]));\r\n    }\r\n\r\n    /**\r\n     * @dev Retrieves the source endpoint ID from the composed message.\r\n     * @param _msg The message.\r\n     * @return The source endpoint ID.\r\n     */\r\n    function srcEid(bytes calldata _msg) internal pure returns (uint32) {\r\n        return uint32(bytes4(_msg[NONCE_OFFSET:SRC_EID_OFFSET]));\r\n    }\r\n\r\n    /**\r\n     * @dev Retrieves the amount in local decimals from the composed message.\r\n     * @param _msg The message.\r\n     * @return The amount in local decimals.\r\n     */\r\n    function amountLD(bytes calldata _msg) internal pure returns (uint256) {\r\n        return uint256(bytes32(_msg[SRC_EID_OFFSET:AMOUNT_LD_OFFSET]));\r\n    }\r\n\r\n    /**\r\n     * @dev Retrieves the composeFrom value from the composed message.\r\n     * @param _msg The message.\r\n     * @return The composeFrom value.\r\n     */\r\n    function composeFrom(bytes calldata _msg) internal pure returns (bytes32) {\r\n        return bytes32(_msg[AMOUNT_LD_OFFSET:COMPOSE_FROM_OFFSET]);\r\n    }\r\n\r\n    /**\r\n     * @dev Retrieves the composed message.\r\n     * @param _msg The message.\r\n     * @return The composed message.\r\n     */\r\n    function composeMsg(bytes calldata _msg) internal pure returns (bytes memory) {\r\n        return _msg[COMPOSE_FROM_OFFSET:];\r\n    }\r\n\r\n    /**\r\n     * @dev Converts an address to bytes32.\r\n     * @param _addr The address to convert.\r\n     * @return The bytes32 representation of the address.\r\n     */\r\n    function addressToBytes32(address _addr) internal pure returns (bytes32) {\r\n        return bytes32(uint256(uint160(_addr)));\r\n    }\r\n\r\n    /**\r\n     * @dev Converts bytes32 to an address.\r\n     * @param _b The bytes32 value to convert.\r\n     * @return The address representation of bytes32.\r\n     */\r\n    function bytes32ToAddress(bytes32 _b) internal pure returns (address) {\r\n        return address(uint160(uint256(_b)));\r\n    }\r\n}\r\n\r\n// lib/LayerZero-v2/packages/layerzero-v2/evm/oapp/contracts/oft/libs/OFTMsgCodec.sol\r\n\r\nlibrary OFTMsgCodec {\r\n    // Offset constants for encoding and decoding OFT messages\r\n    uint8 private constant SEND_TO_OFFSET = 32;\r\n    uint8 private constant SEND_AMOUNT_SD_OFFSET = 40;\r\n\r\n    /**\r\n     * @dev Encodes an OFT LayerZero message.\r\n     * @param _sendTo The recipient address.\r\n     * @param _amountShared The amount in shared decimals.\r\n     * @param _composeMsg The composed message.\r\n     * @return _msg The encoded message.\r\n     * @return hasCompose A boolean indicating whether the message has a composed payload.\r\n     */\r\n    function encode(\r\n        bytes32 _sendTo,\r\n        uint64 _amountShared,\r\n        bytes memory _composeMsg\r\n    ) internal view returns (bytes memory _msg, bool hasCompose) {\r\n        hasCompose = _composeMsg.length > 0;\r\n        // @dev Remote chains will want to know the composed function caller ie. msg.sender on the src.\r\n        _msg = hasCompose\r\n            ? abi.encodePacked(_sendTo, _amountShared, addressToBytes32(msg.sender), _composeMsg)\r\n            : abi.encodePacked(_sendTo, _amountShared);\r\n    }\r\n\r\n    /**\r\n     * @dev Checks if the OFT message is composed.\r\n     * @param _msg The OFT message.\r\n     * @return A boolean indicating whether the message is composed.\r\n     */\r\n    function isComposed(bytes calldata _msg) internal pure returns (bool) {\r\n        return _msg.length > SEND_AMOUNT_SD_OFFSET;\r\n    }\r\n\r\n    /**\r\n     * @dev Retrieves the recipient address from the OFT message.\r\n     * @param _msg The OFT message.\r\n     * @return The recipient address.\r\n     */\r\n    function sendTo(bytes calldata _msg) internal pure returns (bytes32) {\r\n        return bytes32(_msg[:SEND_TO_OFFSET]);\r\n    }\r\n\r\n    /**\r\n     * @dev Retrieves the amount in shared decimals from the OFT message.\r\n     * @param _msg The OFT message.\r\n     * @return The amount in shared decimals.\r\n     */\r\n    function amountSD(bytes calldata _msg) internal pure returns (uint64) {\r\n        return uint64(bytes8(_msg[SEND_TO_OFFSET:SEND_AMOUNT_SD_OFFSET]));\r\n    }\r\n\r\n    /**\r\n     * @dev Retrieves the composed message from the OFT message.\r\n     * @param _msg The OFT message.\r\n     * @return The composed message.\r\n     */\r\n    function composeMsg(bytes calldata _msg) internal pure returns (bytes memory) {\r\n        return _msg[SEND_AMOUNT_SD_OFFSET:];\r\n    }\r\n\r\n    /**\r\n     * @dev Converts an address to bytes32.\r\n     * @param _addr The address to convert.\r\n     * @return The bytes32 representation of the address.\r\n     */\r\n    function addressToBytes32(address _addr) internal pure returns (bytes32) {\r\n        return bytes32(uint256(uint160(_addr)));\r\n    }\r\n\r\n    /**\r\n     * @dev Converts bytes32 to an address.\r\n     * @param _b The bytes32 value to convert.\r\n     * @return The address representation of bytes32.\r\n     */\r\n    function bytes32ToAddress(bytes32 _b) internal pure returns (address) {\r\n        return address(uint160(uint256(_b)));\r\n    }\r\n}\r\n\r\n// lib/LayerZero-v2/packages/layerzero-v2/evm/oapp/contracts/precrime/interfaces/IPreCrime.sol\r\n\r\nstruct PreCrimePeer {\r\n    uint32 eid;\r\n    bytes32 preCrime;\r\n    bytes32 oApp;\r\n}\r\n\r\n// TODO not done yet\r\ninterface IPreCrime {\r\n    error OnlyOffChain();\r\n\r\n    // for simulate()\r\n    error PacketOversize(uint256 max, uint256 actual);\r\n    error PacketUnsorted();\r\n    error SimulationFailed(bytes reason);\r\n\r\n    // for preCrime()\r\n    error SimulationResultNotFound(uint32 eid);\r\n    error InvalidSimulationResult(uint32 eid, bytes reason);\r\n    error CrimeFound(bytes crime);\r\n\r\n    function getConfig(bytes[] calldata _packets, uint256[] calldata _packetMsgValues) external returns (bytes memory);\r\n\r\n    function simulate(\r\n        bytes[] calldata _packets,\r\n        uint256[] calldata _packetMsgValues\r\n    ) external payable returns (bytes memory);\r\n\r\n    function buildSimulationResult() external view returns (bytes memory);\r\n\r\n    function preCrime(\r\n        bytes[] calldata _packets,\r\n        uint256[] calldata _packetMsgValues,\r\n        bytes[] calldata _simulations\r\n    ) external;\r\n\r\n    function version() external view returns (uint64 major, uint8 minor);\r\n}\r\n\r\n// lib/LayerZero-v2/packages/layerzero-v2/evm/protocol/contracts/interfaces/IMessageLibManager.sol\r\n\r\nstruct SetConfigParam {\r\n    uint32 eid;\r\n    uint32 configType;\r\n    bytes config;\r\n}\r\n\r\ninterface IMessageLibManager {\r\n    struct Timeout {\r\n        address lib;\r\n        uint256 expiry;\r\n    }\r\n\r\n    event LibraryRegistered(address newLib);\r\n    event DefaultSendLibrarySet(uint32 eid, address newLib);\r\n    event DefaultReceiveLibrarySet(uint32 eid, address newLib);\r\n    event DefaultReceiveLibraryTimeoutSet(uint32 eid, address oldLib, uint256 expiry);\r\n    event SendLibrarySet(address sender, uint32 eid, address newLib);\r\n    event ReceiveLibrarySet(address receiver, uint32 eid, address newLib);\r\n    event ReceiveLibraryTimeoutSet(address receiver, uint32 eid, address oldLib, uint256 timeout);\r\n\r\n    function registerLibrary(address _lib) external;\r\n\r\n    function isRegisteredLibrary(address _lib) external view returns (bool);\r\n\r\n    function getRegisteredLibraries() external view returns (address[] memory);\r\n\r\n    function setDefaultSendLibrary(uint32 _eid, address _newLib) external;\r\n\r\n    function defaultSendLibrary(uint32 _eid) external view returns (address);\r\n\r\n    function setDefaultReceiveLibrary(uint32 _eid, address _newLib, uint256 _timeout) external;\r\n\r\n    function defaultReceiveLibrary(uint32 _eid) external view returns (address);\r\n\r\n    function setDefaultReceiveLibraryTimeout(uint32 _eid, address _lib, uint256 _expiry) external;\r\n\r\n    function defaultReceiveLibraryTimeout(uint32 _eid) external view returns (address lib, uint256 expiry);\r\n\r\n    function isSupportedEid(uint32 _eid) external view returns (bool);\r\n\r\n    function isValidReceiveLibrary(address _receiver, uint32 _eid, address _lib) external view returns (bool);\r\n\r\n    /// ------------------- OApp interfaces -------------------\r\n    function setSendLibrary(address _oapp, uint32 _eid, address _newLib) external;\r\n\r\n    function getSendLibrary(address _sender, uint32 _eid) external view returns (address lib);\r\n\r\n    function isDefaultSendLibrary(address _sender, uint32 _eid) external view returns (bool);\r\n\r\n    function setReceiveLibrary(address _oapp, uint32 _eid, address _newLib, uint256 _gracePeriod) external;\r\n\r\n    function getReceiveLibrary(address _receiver, uint32 _eid) external view returns (address lib, bool isDefault);\r\n\r\n    function setReceiveLibraryTimeout(address _oapp, uint32 _eid, address _lib, uint256 _gracePeriod) external;\r\n\r\n    function receiveLibraryTimeout(address _receiver, uint32 _eid) external view returns (address lib, uint256 expiry);\r\n\r\n    function setConfig(address _oapp, address _lib, SetConfigParam[] calldata _params) external;\r\n\r\n    function getConfig(\r\n        address _oapp,\r\n        address _lib,\r\n        uint32 _eid,\r\n        uint32 _configType\r\n    ) external view returns (bytes memory config);\r\n}\r\n\r\n// lib/LayerZero-v2/packages/layerzero-v2/evm/protocol/contracts/interfaces/IMessagingChannel.sol\r\n\r\ninterface IMessagingChannel {\r\n    event InboundNonceSkipped(uint32 srcEid, bytes32 sender, address receiver, uint64 nonce);\r\n    event PacketNilified(uint32 srcEid, bytes32 sender, address receiver, uint64 nonce, bytes32 payloadHash);\r\n    event PacketBurnt(uint32 srcEid, bytes32 sender, address receiver, uint64 nonce, bytes32 payloadHash);\r\n\r\n    function eid() external view returns (uint32);\r\n\r\n    // this is an emergency function if a message cannot be verified for some reasons\r\n    // required to provide _nextNonce to avoid race condition\r\n    function skip(address _oapp, uint32 _srcEid, bytes32 _sender, uint64 _nonce) external;\r\n\r\n    function nilify(address _oapp, uint32 _srcEid, bytes32 _sender, uint64 _nonce, bytes32 _payloadHash) external;\r\n\r\n    function burn(address _oapp, uint32 _srcEid, bytes32 _sender, uint64 _nonce, bytes32 _payloadHash) external;\r\n\r\n    function nextGuid(address _sender, uint32 _dstEid, bytes32 _receiver) external view returns (bytes32);\r\n\r\n    function inboundNonce(address _receiver, uint32 _srcEid, bytes32 _sender) external view returns (uint64);\r\n\r\n    function outboundNonce(address _sender, uint32 _dstEid, bytes32 _receiver) external view returns (uint64);\r\n\r\n    function inboundPayloadHash(\r\n        address _receiver,\r\n        uint32 _srcEid,\r\n        bytes32 _sender,\r\n        uint64 _nonce\r\n    ) external view returns (bytes32);\r\n\r\n    function lazyInboundNonce(address _receiver, uint32 _srcEid, bytes32 _sender) external view returns (uint64);\r\n}\r\n\r\n// lib/LayerZero-v2/packages/layerzero-v2/evm/protocol/contracts/interfaces/IMessagingComposer.sol\r\n\r\ninterface IMessagingComposer {\r\n    event ComposeSent(address from, address to, bytes32 guid, uint16 index, bytes message);\r\n    event ComposeDelivered(address from, address to, bytes32 guid, uint16 index);\r\n    event LzComposeAlert(\r\n        address indexed from,\r\n        address indexed to,\r\n        address indexed executor,\r\n        bytes32 guid,\r\n        uint16 index,\r\n        uint256 gas,\r\n        uint256 value,\r\n        bytes message,\r\n        bytes extraData,\r\n        bytes reason\r\n    );\r\n\r\n    function composeQueue(\r\n        address _from,\r\n        address _to,\r\n        bytes32 _guid,\r\n        uint16 _index\r\n    ) external view returns (bytes32 messageHash);\r\n\r\n    function sendCompose(address _to, bytes32 _guid, uint16 _index, bytes calldata _message) external;\r\n\r\n    function lzCompose(\r\n        address _from,\r\n        address _to,\r\n        bytes32 _guid,\r\n        uint16 _index,\r\n        bytes calldata _message,\r\n        bytes calldata _extraData\r\n    ) external payable;\r\n}\r\n\r\n// lib/LayerZero-v2/packages/layerzero-v2/evm/protocol/contracts/interfaces/IMessagingContext.sol\r\n\r\ninterface IMessagingContext {\r\n    function isSendingMessage() external view returns (bool);\r\n\r\n    function getSendContext() external view returns (uint32 dstEid, address sender);\r\n}\r\n\r\n// lib/LayerZero-v2/packages/layerzero-v2/evm/protocol/contracts/libs/AddressCast.sol\r\n\r\nlibrary AddressCast {\r\n    error AddressCast_InvalidSizeForAddress();\r\n    error AddressCast_InvalidAddress();\r\n\r\n    function toBytes32(bytes calldata _addressBytes) internal pure returns (bytes32 result) {\r\n        if (_addressBytes.length > 32) revert AddressCast_InvalidAddress();\r\n        result = bytes32(_addressBytes);\r\n        unchecked {\r\n            uint256 offset = 32 - _addressBytes.length;\r\n            result = result >> (offset * 8);\r\n        }\r\n    }\r\n\r\n    function toBytes32(address _address) internal pure returns (bytes32 result) {\r\n        result = bytes32(uint256(uint160(_address)));\r\n    }\r\n\r\n    function toBytes(bytes32 _addressBytes32, uint256 _size) internal pure returns (bytes memory result) {\r\n        if (_size == 0 || _size > 32) revert AddressCast_InvalidSizeForAddress();\r\n        result = new bytes(_size);\r\n        unchecked {\r\n            uint256 offset = 256 - _size * 8;\r\n            assembly {\r\n                mstore(add(result, 32), shl(offset, _addressBytes32))\r\n            }\r\n        }\r\n    }\r\n\r\n    function toAddress(bytes32 _addressBytes32) internal pure returns (address result) {\r\n        result = address(uint160(uint256(_addressBytes32)));\r\n    }\r\n\r\n    function toAddress(bytes calldata _addressBytes) internal pure returns (address result) {\r\n        if (_addressBytes.length != 20) revert AddressCast_InvalidAddress();\r\n        result = address(bytes20(_addressBytes));\r\n    }\r\n}\r\n\r\n// lib/openzeppelin-contracts/contracts/access/IAccessControl.sol\r\n\r\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\r\n\r\n/**\r\n * @dev External interface of AccessControl declared to support ERC165 detection.\r\n */\r\ninterface IAccessControl {\r\n    /**\r\n     * @dev The `account` is missing a role.\r\n     */\r\n    error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\r\n\r\n    /**\r\n     * @dev The caller of a function is not the expected one.\r\n     *\r\n     * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\r\n     */\r\n    error AccessControlBadConfirmation();\r\n\r\n    /**\r\n     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\r\n     *\r\n     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\r\n     * {RoleAdminChanged} not being emitted signaling this.\r\n     */\r\n    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\r\n\r\n    /**\r\n     * @dev Emitted when `account` is granted `role`.\r\n     *\r\n     * `sender` is the account that originated the contract call, an admin role\r\n     * bearer except when using {AccessControl-_setupRole}.\r\n     */\r\n    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\r\n\r\n    /**\r\n     * @dev Emitted when `account` is revoked `role`.\r\n     *\r\n     * `sender` is the account that originated the contract call:\r\n     *   - if using `revokeRole`, it is the admin role bearer\r\n     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)\r\n     */\r\n    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\r\n\r\n    /**\r\n     * @dev Returns `true` if `account` has been granted `role`.\r\n     */\r\n    function hasRole(bytes32 role, address account) external view returns (bool);\r\n\r\n    /**\r\n     * @dev Returns the admin role that controls `role`. See {grantRole} and\r\n     * {revokeRole}.\r\n     *\r\n     * To change a role's admin, use {AccessControl-_setRoleAdmin}.\r\n     */\r\n    function getRoleAdmin(bytes32 role) external view returns (bytes32);\r\n\r\n    /**\r\n     * @dev Grants `role` to `account`.\r\n     *\r\n     * If `account` had not been already granted `role`, emits a {RoleGranted}\r\n     * event.\r\n     *\r\n     * Requirements:\r\n     *\r\n     * - the caller must have ``role``'s admin role.\r\n     */\r\n    function grantRole(bytes32 role, address account) external;\r\n\r\n    /**\r\n     * @dev Revokes `role` from `account`.\r\n     *\r\n     * If `account` had been granted `role`, emits a {RoleRevoked} event.\r\n     *\r\n     * Requirements:\r\n     *\r\n     * - the caller must have ``role``'s admin role.\r\n     */\r\n    function revokeRole(bytes32 role, address account) external;\r\n\r\n    /**\r\n     * @dev Revokes `role` from the calling account.\r\n     *\r\n     * Roles are often managed via {grantRole} and {revokeRole}: this function's\r\n     * purpose is to provide a mechanism for accounts to lose their privileges\r\n     * if they are compromised (such as when a trusted device is misplaced).\r\n     *\r\n     * If the calling account had been granted `role`, emits a {RoleRevoked}\r\n     * event.\r\n     *\r\n     * Requirements:\r\n     *\r\n     * - the caller must be `callerConfirmation`.\r\n     */\r\n    function renounceRole(bytes32 role, address callerConfirmation) external;\r\n}\r\n\r\n// lib/openzeppelin-contracts/contracts/interfaces/draft-IERC6093.sol\r\n\r\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)\r\n\r\n/**\r\n * @dev Standard ERC20 Errors\r\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.\r\n */\r\ninterface IERC20Errors {\r\n    /**\r\n     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\r\n     * @param sender Address whose tokens are being transferred.\r\n     * @param balance Current balance for the interacting account.\r\n     * @param needed Minimum amount required to perform a transfer.\r\n     */\r\n    error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);\r\n\r\n    /**\r\n     * @dev Indicates a failure with the token `sender`. Used in transfers.\r\n     * @param sender Address whose tokens are being transferred.\r\n     */\r\n    error ERC20InvalidSender(address sender);\r\n\r\n    /**\r\n     * @dev Indicates a failure with the token `receiver`. Used in transfers.\r\n     * @param receiver Address to which tokens are being transferred.\r\n     */\r\n    error ERC20InvalidReceiver(address receiver);\r\n\r\n    /**\r\n     * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.\r\n     * @param spender Address that may be allowed to operate on tokens without being their owner.\r\n     * @param allowance Amount of tokens a `spender` is allowed to operate with.\r\n     * @param needed Minimum amount required to perform a transfer.\r\n     */\r\n    error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);\r\n\r\n    /**\r\n     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\r\n     * @param approver Address initiating an approval operation.\r\n     */\r\n    error ERC20InvalidApprover(address approver);\r\n\r\n    /**\r\n     * @dev Indicates a failure with the `spender` to be approved. Used in approvals.\r\n     * @param spender Address that may be allowed to operate on tokens without being their owner.\r\n     */\r\n    error ERC20InvalidSpender(address spender);\r\n}\r\n\r\n/**\r\n * @dev Standard ERC721 Errors\r\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.\r\n */\r\ninterface IERC721Errors {\r\n    /**\r\n     * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.\r\n     * Used in balance queries.\r\n     * @param owner Address of the current owner of a token.\r\n     */\r\n    error ERC721InvalidOwner(address owner);\r\n\r\n    /**\r\n     * @dev Indicates a `tokenId` whose `owner` is the zero address.\r\n     * @param tokenId Identifier number of a token.\r\n     */\r\n    error ERC721NonexistentToken(uint256 tokenId);\r\n\r\n    /**\r\n     * @dev Indicates an error related to the ownership over a particular token. Used in transfers.\r\n     * @param sender Address whose tokens are being transferred.\r\n     * @param tokenId Identifier number of a token.\r\n     * @param owner Address of the current owner of a token.\r\n     */\r\n    error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);\r\n\r\n    /**\r\n     * @dev Indicates a failure with the token `sender`. Used in transfers.\r\n     * @param sender Address whose tokens are being transferred.\r\n     */\r\n    error ERC721InvalidSender(address sender);\r\n\r\n    /**\r\n     * @dev Indicates a failure with the token `receiver`. Used in transfers.\r\n     * @param receiver Address to which tokens are being transferred.\r\n     */\r\n    error ERC721InvalidReceiver(address receiver);\r\n\r\n    /**\r\n     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\r\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\r\n     * @param tokenId Identifier number of a token.\r\n     */\r\n    error ERC721InsufficientApproval(address operator, uint256 tokenId);\r\n\r\n    /**\r\n     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\r\n     * @param approver Address initiating an approval operation.\r\n     */\r\n    error ERC721InvalidApprover(address approver);\r\n\r\n    /**\r\n     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\r\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\r\n     */\r\n    error ERC721InvalidOperator(address operator);\r\n}\r\n\r\n/**\r\n * @dev Standard ERC1155 Errors\r\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.\r\n */\r\ninterface IERC1155Errors {\r\n    /**\r\n     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\r\n     * @param sender Address whose tokens are being transferred.\r\n     * @param balance Current balance for the interacting account.\r\n     * @param needed Minimum amount required to perform a transfer.\r\n     * @param tokenId Identifier number of a token.\r\n     */\r\n    error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);\r\n\r\n    /**\r\n     * @dev Indicates a failure with the token `sender`. Used in transfers.\r\n     * @param sender Address whose tokens are being transferred.\r\n     */\r\n    error ERC1155InvalidSender(address sender);\r\n\r\n    /**\r\n     * @dev Indicates a failure with the token `receiver`. Used in transfers.\r\n     * @param receiver Address to which tokens are being transferred.\r\n     */\r\n    error ERC1155InvalidReceiver(address receiver);\r\n\r\n    /**\r\n     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\r\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\r\n     * @param owner Address of the current owner of a token.\r\n     */\r\n    error ERC1155MissingApprovalForAll(address operator, address owner);\r\n\r\n    /**\r\n     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\r\n     * @param approver Address initiating an approval operation.\r\n     */\r\n    error ERC1155InvalidApprover(address approver);\r\n\r\n    /**\r\n     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\r\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\r\n     */\r\n    error ERC1155InvalidOperator(address operator);\r\n\r\n    /**\r\n     * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.\r\n     * Used in batch transfers.\r\n     * @param idsLength Length of the array of token identifiers\r\n     * @param valuesLength Length of the array of token amounts\r\n     */\r\n    error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);\r\n}\r\n\r\n// lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol\r\n\r\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\r\n\r\n/**\r\n * @dev Interface of the ERC20 standard as defined in the EIP.\r\n */\r\ninterface IERC20 {\r\n    /**\r\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\r\n     * another (`to`).\r\n     *\r\n     * Note that `value` may be zero.\r\n     */\r\n    event Transfer(address indexed from, address indexed to, uint256 value);\r\n\r\n    /**\r\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\r\n     * a call to {approve}. `value` is the new allowance.\r\n     */\r\n    event Approval(address indexed owner, address indexed spender, uint256 value);\r\n\r\n    /**\r\n     * @dev Returns the value of tokens in existence.\r\n     */\r\n    function totalSupply() external view returns (uint256);\r\n\r\n    /**\r\n     * @dev Returns the value of tokens owned by `account`.\r\n     */\r\n    function balanceOf(address account) external view returns (uint256);\r\n\r\n    /**\r\n     * @dev Moves a `value` amount of tokens from the caller's account to `to`.\r\n     *\r\n     * Returns a boolean value indicating whether the operation succeeded.\r\n     *\r\n     * Emits a {Transfer} event.\r\n     */\r\n    function transfer(address to, uint256 value) external returns (bool);\r\n\r\n    /**\r\n     * @dev Returns the remaining number of tokens that `spender` will be\r\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\r\n     * zero by default.\r\n     *\r\n     * This value changes when {approve} or {transferFrom} are called.\r\n     */\r\n    function allowance(address owner, address spender) external view returns (uint256);\r\n\r\n    /**\r\n     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\r\n     * caller's tokens.\r\n     *\r\n     * Returns a boolean value indicating whether the operation succeeded.\r\n     *\r\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\r\n     * that someone may use both the old and the new allowance by unfortunate\r\n     * transaction ordering. One possible solution to mitigate this race\r\n     * condition is to first reduce the spender's allowance to 0 and set the\r\n     * desired value afterwards:\r\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\r\n     *\r\n     * Emits an {Approval} event.\r\n     */\r\n    function approve(address spender, uint256 value) external returns (bool);\r\n\r\n    /**\r\n     * @dev Moves a `value` amount of tokens from `from` to `to` using the\r\n     * allowance mechanism. `value` is then deducted from the caller's\r\n     * allowance.\r\n     *\r\n     * Returns a boolean value indicating whether the operation succeeded.\r\n     *\r\n     * Emits a {Transfer} event.\r\n     */\r\n    function transferFrom(address from, address to, uint256 value) external returns (bool);\r\n}\r\n\r\n// lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Permit.sol\r\n\r\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)\r\n\r\n/**\r\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\r\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\r\n *\r\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\r\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\r\n * need to send a transaction, and thus is not required to hold Ether at all.\r\n *\r\n * ==== Security Considerations\r\n *\r\n * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature\r\n * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be\r\n * considered as an intention to spend the allowance in any specific way. The second is that because permits have\r\n * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should\r\n * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be\r\n * generally recommended is:\r\n *\r\n * ```solidity\r\n * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {\r\n *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}\r\n *     doThing(..., value);\r\n * }\r\n *\r\n * function doThing(..., uint256 value) public {\r\n *     token.safeTransferFrom(msg.sender, address(this), value);\r\n *     ...\r\n * }\r\n * ```\r\n *\r\n * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of\r\n * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also\r\n * {SafeERC20-safeTransferFrom}).\r\n *\r\n * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so\r\n * contracts should have entry points that don't rely on permit.\r\n */\r\ninterface IERC20Permit {\r\n    /**\r\n     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\r\n     * given ``owner``'s signed approval.\r\n     *\r\n     * IMPORTANT: The same issues {IERC20-approve} has related to transaction\r\n     * ordering also apply here.\r\n     *\r\n     * Emits an {Approval} event.\r\n     *\r\n     * Requirements:\r\n     *\r\n     * - `spender` cannot be the zero address.\r\n     * - `deadline` must be a timestamp in the future.\r\n     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\r\n     * over the EIP712-formatted function arguments.\r\n     * - the signature must use ``owner``'s current nonce (see {nonces}).\r\n     *\r\n     * For more information on the signature format, see the\r\n     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\r\n     * section].\r\n     *\r\n     * CAUTION: See Security Considerations above.\r\n     */\r\n    function permit(\r\n        address owner,\r\n        address spender,\r\n        uint256 value,\r\n        uint256 deadline,\r\n        uint8 v,\r\n        bytes32 r,\r\n        bytes32 s\r\n    ) external;\r\n\r\n    /**\r\n     * @dev Returns the current nonce for `owner`. This value must be\r\n     * included whenever a signature is generated for {permit}.\r\n     *\r\n     * Every successful call to {permit} increases ``owner``'s nonce by one. This\r\n     * prevents a signature from being used multiple times.\r\n     */\r\n    function nonces(address owner) external view returns (uint256);\r\n\r\n    /**\r\n     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\r\n     */\r\n    // solhint-disable-next-line func-name-mixedcase\r\n    function DOMAIN_SEPARATOR() external view returns (bytes32);\r\n}\r\n\r\n// lib/openzeppelin-contracts/contracts/utils/Address.sol\r\n\r\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)\r\n\r\n/**\r\n * @dev Collection of functions related to the address type\r\n */\r\nlibrary Address {\r\n    /**\r\n     * @dev The ETH balance of the account is not enough to perform the operation.\r\n     */\r\n    error AddressInsufficientBalance(address account);\r\n\r\n    /**\r\n     * @dev There's no code at `target` (it is not a contract).\r\n     */\r\n    error AddressEmptyCode(address target);\r\n\r\n    /**\r\n     * @dev A call to an address target failed. The target may have reverted.\r\n     */\r\n    error FailedInnerCall();\r\n\r\n    /**\r\n     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\r\n     * `recipient`, forwarding all available gas and reverting on errors.\r\n     *\r\n     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\r\n     * of certain opcodes, possibly making contracts go over the 2300 gas limit\r\n     * imposed by `transfer`, making them unable to receive funds via\r\n     * `transfer`. {sendValue} removes this limitation.\r\n     *\r\n     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\r\n     *\r\n     * IMPORTANT: because control is transferred to `recipient`, care must be\r\n     * taken to not create reentrancy vulnerabilities. Consider using\r\n     * {ReentrancyGuard} or the\r\n     * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\r\n     */\r\n    function sendValue(address payable recipient, uint256 amount) internal {\r\n        if (address(this).balance < amount) {\r\n            revert AddressInsufficientBalance(address(this));\r\n        }\r\n\r\n        (bool success, ) = recipient.call{value: amount}(\"\");\r\n        if (!success) {\r\n            revert FailedInnerCall();\r\n        }\r\n    }\r\n\r\n    /**\r\n     * @dev Performs a Solidity function call using a low level `call`. A\r\n     * plain `call` is an unsafe replacement for a function call: use this\r\n     * function instead.\r\n     *\r\n     * If `target` reverts with a revert reason or custom error, it is bubbled\r\n     * up by this function (like regular Solidity function calls). However, if\r\n     * the call reverted with no returned reason, this function reverts with a\r\n     * {FailedInnerCall} error.\r\n     *\r\n     * Returns the raw returned data. To convert to the expected return value,\r\n     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\r\n     *\r\n     * Requirements:\r\n     *\r\n     * - `target` must be a contract.\r\n     * - calling `target` with `data` must not revert.\r\n     */\r\n    function functionCall(address target, bytes memory data) internal returns (bytes memory) {\r\n        return functionCallWithValue(target, data, 0);\r\n    }\r\n\r\n    /**\r\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\r\n     * but also transferring `value` wei to `target`.\r\n     *\r\n     * Requirements:\r\n     *\r\n     * - the calling contract must have an ETH balance of at least `value`.\r\n     * - the called Solidity function must be `payable`.\r\n     */\r\n    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\r\n        if (address(this).balance < value) {\r\n            revert AddressInsufficientBalance(address(this));\r\n        }\r\n        (bool success, bytes memory returndata) = target.call{value: value}(data);\r\n        return verifyCallResultFromTarget(target, success, returndata);\r\n    }\r\n\r\n    /**\r\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\r\n     * but performing a static call.\r\n     */\r\n    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\r\n        (bool success, bytes memory returndata) = target.staticcall(data);\r\n        return verifyCallResultFromTarget(target, success, returndata);\r\n    }\r\n\r\n    /**\r\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\r\n     * but performing a delegate call.\r\n     */\r\n    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\r\n        (bool success, bytes memory returndata) = target.delegatecall(data);\r\n        return verifyCallResultFromTarget(target, success, returndata);\r\n    }\r\n\r\n    /**\r\n     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target\r\n     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an\r\n     * unsuccessful call.\r\n     */\r\n    function verifyCallResultFromTarget(\r\n        address target,\r\n        bool success,\r\n        bytes memory returndata\r\n    ) internal view returns (bytes memory) {\r\n        if (!success) {\r\n            _revert(returndata);\r\n        } else {\r\n            // only check if target is a contract if the call was successful and the return data is empty\r\n            // otherwise we already know that it was a contract\r\n            if (returndata.length == 0 && target.code.length == 0) {\r\n                revert AddressEmptyCode(target);\r\n            }\r\n            return returndata;\r\n        }\r\n    }\r\n\r\n    /**\r\n     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the\r\n     * revert reason or with a default {FailedInnerCall} error.\r\n     */\r\n    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {\r\n        if (!success) {\r\n            _revert(returndata);\r\n        } else {\r\n            return returndata;\r\n        }\r\n    }\r\n\r\n    /**\r\n     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.\r\n     */\r\n    function _revert(bytes memory returndata) private pure {\r\n        // Look for revert reason and bubble it up if present\r\n        if (returndata.length > 0) {\r\n            // The easiest way to bubble the revert reason is using memory via assembly\r\n            /// @solidity memory-safe-assembly\r\n            assembly {\r\n                let returndata_size := mload(returndata)\r\n                revert(add(32, returndata), returndata_size)\r\n            }\r\n        } else {\r\n            revert FailedInnerCall();\r\n        }\r\n    }\r\n}\r\n\r\n// lib/openzeppelin-contracts/contracts/utils/Context.sol\r\n\r\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\r\n\r\n/**\r\n * @dev Provides information about the current execution context, including the\r\n * sender of the transaction and its data. While these are generally available\r\n * via msg.sender and msg.data, they should not be accessed in such a direct\r\n * manner, since when dealing with meta-transactions the account sending and\r\n * paying for execution may not be the actual sender (as far as an application\r\n * is concerned).\r\n *\r\n * This contract is only required for intermediate, library-like contracts.\r\n */\r\nabstract contract Context {\r\n    function _msgSender() internal view virtual returns (address) {\r\n        return msg.sender;\r\n    }\r\n\r\n    function _msgData() internal view virtual returns (bytes calldata) {\r\n        return msg.data;\r\n    }\r\n\r\n    function _contextSuffixLength() internal view virtual returns (uint256) {\r\n        return 0;\r\n    }\r\n}\r\n\r\n// lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol\r\n\r\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\r\n\r\n/**\r\n * @dev Interface of the ERC165 standard, as defined in the\r\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\r\n *\r\n * Implementers can declare support of contract interfaces, which can then be\r\n * queried by others ({ERC165Checker}).\r\n *\r\n * For an implementation, see {ERC165}.\r\n */\r\ninterface IERC165 {\r\n    /**\r\n     * @dev Returns true if this contract implements the interface defined by\r\n     * `interfaceId`. See the corresponding\r\n     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\r\n     * to learn more about how these ids are created.\r\n     *\r\n     * This function call must use less than 30 000 gas.\r\n     */\r\n    function supportsInterface(bytes4 interfaceId) external view returns (bool);\r\n}\r\n\r\n// src/Errors/Errors.sol\r\n\r\n/// @dev Error for unsupported token\r\nerror UnsupportedToken();\r\n\r\n/// @dev Error for invalid parameter\r\nerror InvalidParameter();\r\n\r\n/// @dev Error for trying to remove valuable supported token\r\nerror NonEmptySupportedToken();\r\n\r\n/// @dev Error for deposit function paused\r\nerror DepositPaused();\r\n\r\n/// @dev Error for withdraw function paused\r\nerror WithdrawPaused();\r\n\r\n/// @dev Error for Bridge Capacity exceeds\r\nerror ExceedCap();\r\n\r\n/// @dev Error for fee too high\r\nerror TooHighFee();\r\n\r\n/// @dev Error for no fee recipient\r\nerror NoFeeRecipient();\r\n\r\n/// @dev Error for maximum deposit capacity reached\r\nerror CapacityReached();\r\n\r\n/// @dev Error for user not in whitelist\r\nerror NotWhitelisted();\r\n\r\n// lib/openzeppelin-contracts/contracts/access/Ownable.sol\r\n\r\n// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)\r\n\r\n/**\r\n * @dev Contract module which provides a basic access control mechanism, where\r\n * there is an account (an owner) that can be granted exclusive access to\r\n * specific functions.\r\n *\r\n * The initial owner is set to the address provided by the deployer. This can\r\n * later be changed with {transferOwnership}.\r\n *\r\n * This module is used through inheritance. It will make available the modifier\r\n * `onlyOwner`, which can be applied to your functions to restrict their use to\r\n * the owner.\r\n */\r\nabstract contract Ownable is Context {\r\n    address private _owner;\r\n\r\n    /**\r\n     * @dev The caller account is not authorized to perform an operation.\r\n     */\r\n    error OwnableUnauthorizedAccount(address account);\r\n\r\n    /**\r\n     * @dev The owner is not a valid owner account. (eg. `address(0)`)\r\n     */\r\n    error OwnableInvalidOwner(address owner);\r\n\r\n    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\r\n\r\n    /**\r\n     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.\r\n     */\r\n    constructor(address initialOwner) {\r\n        if (initialOwner == address(0)) {\r\n            revert OwnableInvalidOwner(address(0));\r\n        }\r\n        _transferOwnership(initialOwner);\r\n    }\r\n\r\n    /**\r\n     * @dev Throws if called by any account other than the owner.\r\n     */\r\n    modifier onlyOwner() {\r\n        _checkOwner();\r\n        _;\r\n    }\r\n\r\n    /**\r\n     * @dev Returns the address of the current owner.\r\n     */\r\n    function owner() public view virtual returns (address) {\r\n        return _owner;\r\n    }\r\n\r\n    /**\r\n     * @dev Throws if the sender is not the owner.\r\n     */\r\n    function _checkOwner() internal view virtual {\r\n        if (owner() != _msgSender()) {\r\n            revert OwnableUnauthorizedAccount(_msgSender());\r\n        }\r\n    }\r\n\r\n    /**\r\n     * @dev Leaves the contract without owner. It will not be possible to call\r\n     * `onlyOwner` functions. Can only be called by the current owner.\r\n     *\r\n     * NOTE: Renouncing ownership will leave the contract without an owner,\r\n     * thereby disabling any functionality that is only available to the owner.\r\n     */\r\n    function renounceOwnership() public virtual onlyOwner {\r\n        _transferOwnership(address(0));\r\n    }\r\n\r\n    /**\r\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\r\n     * Can only be called by the current owner.\r\n     */\r\n    function transferOwnership(address newOwner) public virtual onlyOwner {\r\n        if (newOwner == address(0)) {\r\n            revert OwnableInvalidOwner(address(0));\r\n        }\r\n        _transferOwnership(newOwner);\r\n    }\r\n\r\n    /**\r\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\r\n     * Internal function without access restriction.\r\n     */\r\n    function _transferOwnership(address newOwner) internal virtual {\r\n        address oldOwner = _owner;\r\n        _owner = newOwner;\r\n        emit OwnershipTransferred(oldOwner, newOwner);\r\n    }\r\n}\r\n\r\n// lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol\r\n\r\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)\r\n\r\n/**\r\n * @dev Interface for the optional metadata functions from the ERC20 standard.\r\n */\r\ninterface IERC20Metadata is IERC20 {\r\n    /**\r\n     * @dev Returns the name of the token.\r\n     */\r\n    function name() external view returns (string memory);\r\n\r\n    /**\r\n     * @dev Returns the symbol of the token.\r\n     */\r\n    function symbol() external view returns (string memory);\r\n\r\n    /**\r\n     * @dev Returns the decimals places of the token.\r\n     */\r\n    function decimals() external view returns (uint8);\r\n}\r\n\r\n// lib/openzeppelin-contracts/contracts/utils/introspection/ERC165.sol\r\n\r\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\r\n\r\n/**\r\n * @dev Implementation of the {IERC165} interface.\r\n *\r\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\r\n * for the additional interface id that will be supported. For example:\r\n *\r\n * ```solidity\r\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\r\n *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\r\n * }\r\n * ```\r\n */\r\nabstract contract ERC165 is IERC165 {\r\n    /**\r\n     * @dev See {IERC165-supportsInterface}.\r\n     */\r\n    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\r\n        return interfaceId == type(IERC165).interfaceId;\r\n    }\r\n}\r\n\r\n// lib/LayerZero-v2/packages/layerzero-v2/evm/protocol/contracts/interfaces/IMessageLib.sol\r\n\r\nenum MessageLibType {\r\n    Send,\r\n    Receive,\r\n    SendAndReceive\r\n}\r\n\r\ninterface IMessageLib is IERC165 {\r\n    function setConfig(address _oapp, SetConfigParam[] calldata _config) external;\r\n\r\n    function getConfig(uint32 _eid, address _oapp, uint32 _configType) external view returns (bytes memory config);\r\n\r\n    function isSupportedEid(uint32 _eid) external view returns (bool);\r\n\r\n    // message libs of same major version are compatible\r\n    function version() external view returns (uint64 major, uint8 minor, uint8 endpointVersion);\r\n\r\n    function messageLibType() external view returns (MessageLibType);\r\n}\r\n\r\n// src/Interfaces/IStoneBTC.sol\r\n\r\ninterface IStoneBTC is IERC20Metadata {\r\n    function mint(address _to, uint256 _amount) external;\r\n    function burn(address _from, uint256 _amount) external;\r\n}\r\n\r\n// lib/LayerZero-v2/packages/layerzero-v2/evm/oapp/contracts/oapp/libs/OAppOptionsType3.sol\r\n\r\n/**\r\n * @title OAppOptionsType3\r\n * @dev Abstract contract implementing the IOAppOptionsType3 interface with type 3 options.\r\n */\r\nabstract contract OAppOptionsType3 is IOAppOptionsType3, Ownable {\r\n    uint16 internal constant OPTION_TYPE_3 = 3;\r\n\r\n    // @dev The \"msgType\" should be defined in the child contract.\r\n    mapping(uint32 eid => mapping(uint16 msgType => bytes enforcedOption)) public enforcedOptions;\r\n\r\n    /**\r\n     * @dev Sets the enforced options for specific endpoint and message type combinations.\r\n     * @param _enforcedOptions An array of EnforcedOptionParam structures specifying enforced options.\r\n     *\r\n     * @dev Only the owner/admin of the OApp can call this function.\r\n     * @dev Provides a way for the OApp to enforce things like paying for PreCrime, AND/OR minimum dst lzReceive gas amounts etc.\r\n     * @dev These enforced options can vary as the potential options/execution on the remote may differ as per the msgType.\r\n     * eg. Amount of lzReceive() gas necessary to deliver a lzCompose() message adds overhead you dont want to pay\r\n     * if you are only making a standard LayerZero message ie. lzReceive() WITHOUT sendCompose().\r\n     */\r\n    function setEnforcedOptions(EnforcedOptionParam[] calldata _enforcedOptions) public virtual onlyOwner {\r\n        for (uint256 i = 0; i < _enforcedOptions.length; i++) {\r\n            // @dev Enforced options are only available for optionType 3, as type 1 and 2 dont support combining.\r\n            _assertOptionsType3(_enforcedOptions[i].options);\r\n            enforcedOptions[_enforcedOptions[i].eid][_enforcedOptions[i].msgType] = _enforcedOptions[i].options;\r\n        }\r\n\r\n        emit EnforcedOptionSet(_enforcedOptions);\r\n    }\r\n\r\n    /**\r\n     * @notice Combines options for a given endpoint and message type.\r\n     * @param _eid The endpoint ID.\r\n     * @param _msgType The OAPP message type.\r\n     * @param _extraOptions Additional options passed by the caller.\r\n     * @return options The combination of caller specified options AND enforced options.\r\n     *\r\n     * @dev If there is an enforced lzReceive option:\r\n     * - {gasLimit: 200k, msg.value: 1 ether} AND a caller supplies a lzReceive option: {gasLimit: 100k, msg.value: 0.5 ether}\r\n     * - The resulting options will be {gasLimit: 300k, msg.value: 1.5 ether} when the message is executed on the remote lzReceive() function.\r\n     * @dev This presence of duplicated options is handled off-chain in the verifier/executor.\r\n     */\r\n    function combineOptions(\r\n        uint32 _eid,\r\n        uint16 _msgType,\r\n        bytes calldata _extraOptions\r\n    ) public view virtual returns (bytes memory) {\r\n        bytes memory enforced = enforcedOptions[_eid][_msgType];\r\n\r\n        // No enforced options, pass whatever the caller supplied, even if it's empty or legacy type 1/2 options.\r\n        if (enforced.length == 0) return _extraOptions;\r\n\r\n        // No caller options, return enforced\r\n        if (_extraOptions.length == 0) return enforced;\r\n\r\n        // @dev If caller provided _extraOptions, must be type 3 as its the ONLY type that can be combined.\r\n        if (_extraOptions.length >= 2) {\r\n            _assertOptionsType3(_extraOptions);\r\n            // @dev Remove the first 2 bytes containing the type from the _extraOptions and combine with enforced.\r\n            return bytes.concat(enforced, _extraOptions[2:]);\r\n        }\r\n\r\n        // No valid set of options was found.\r\n        revert InvalidOptions(_extraOptions);\r\n    }\r\n\r\n    /**\r\n     * @dev Internal function to assert that options are of type 3.\r\n     * @param _options The options to be checked.\r\n     */\r\n    function _assertOptionsType3(bytes calldata _options) internal pure virtual {\r\n        uint16 optionsType = uint16(bytes2(_options[0:2]));\r\n        if (optionsType != OPTION_TYPE_3) revert InvalidOptions(_options);\r\n    }\r\n}\r\n\r\n// lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol\r\n\r\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)\r\n\r\n/**\r\n * @title SafeERC20\r\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\r\n * contract returns false). Tokens that return no value (and instead revert or\r\n * throw on failure) are also supported, non-reverting calls are assumed to be\r\n * successful.\r\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\r\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\r\n */\r\nlibrary SafeERC20 {\r\n    using Address for address;\r\n\r\n    /**\r\n     * @dev An operation with an ERC20 token failed.\r\n     */\r\n    error SafeERC20FailedOperation(address token);\r\n\r\n    /**\r\n     * @dev Indicates a failed `decreaseAllowance` request.\r\n     */\r\n    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);\r\n\r\n    /**\r\n     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,\r\n     * non-reverting calls are assumed to be successful.\r\n     */\r\n    function safeTransfer(IERC20 token, address to, uint256 value) internal {\r\n        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));\r\n    }\r\n\r\n    /**\r\n     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the\r\n     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.\r\n     */\r\n    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\r\n        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));\r\n    }\r\n\r\n    /**\r\n     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,\r\n     * non-reverting calls are assumed to be successful.\r\n     */\r\n    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\r\n        uint256 oldAllowance = token.allowance(address(this), spender);\r\n        forceApprove(token, spender, oldAllowance + value);\r\n    }\r\n\r\n    /**\r\n     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no\r\n     * value, non-reverting calls are assumed to be successful.\r\n     */\r\n    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {\r\n        unchecked {\r\n            uint256 currentAllowance = token.allowance(address(this), spender);\r\n            if (currentAllowance < requestedDecrease) {\r\n                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);\r\n            }\r\n            forceApprove(token, spender, currentAllowance - requestedDecrease);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,\r\n     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval\r\n     * to be set to zero before setting it to a non-zero value, such as USDT.\r\n     */\r\n    function forceApprove(IERC20 token, address spender, uint256 value) internal {\r\n        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));\r\n\r\n        if (!_callOptionalReturnBool(token, approvalCall)) {\r\n            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));\r\n            _callOptionalReturn(token, approvalCall);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\r\n     * on the return value: the return value is optional (but if data is returned, it must not be false).\r\n     * @param token The token targeted by the call.\r\n     * @param data The call data (encoded using abi.encode or one of its variants).\r\n     */\r\n    function _callOptionalReturn(IERC20 token, bytes memory data) private {\r\n        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\r\n        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\r\n        // the target address contains contract code and also asserts for success in the low-level call.\r\n\r\n        bytes memory returndata = address(token).functionCall(data);\r\n        if (returndata.length != 0 && !abi.decode(returndata, (bool))) {\r\n            revert SafeERC20FailedOperation(address(token));\r\n        }\r\n    }\r\n\r\n    /**\r\n     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\r\n     * on the return value: the return value is optional (but if data is returned, it must not be false).\r\n     * @param token The token targeted by the call.\r\n     * @param data The call data (encoded using abi.encode or one of its variants).\r\n     *\r\n     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.\r\n     */\r\n    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {\r\n        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\r\n        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false\r\n        // and not revert is the subcall reverts.\r\n\r\n        (bool success, bytes memory returndata) = address(token).call(data);\r\n        return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;\r\n    }\r\n}\r\n\r\n// lib/LayerZero-v2/packages/layerzero-v2/evm/protocol/contracts/interfaces/ILayerZeroEndpointV2.sol\r\n\r\nstruct MessagingParams {\r\n    uint32 dstEid;\r\n    bytes32 receiver;\r\n    bytes message;\r\n    bytes options;\r\n    bool payInLzToken;\r\n}\r\n\r\nstruct MessagingReceipt {\r\n    bytes32 guid;\r\n    uint64 nonce;\r\n    MessagingFee fee;\r\n}\r\n\r\nstruct MessagingFee {\r\n    uint256 nativeFee;\r\n    uint256 lzTokenFee;\r\n}\r\n\r\nstruct Origin {\r\n    uint32 srcEid;\r\n    bytes32 sender;\r\n    uint64 nonce;\r\n}\r\n\r\ninterface ILayerZeroEndpointV2 is IMessageLibManager, IMessagingComposer, IMessagingChannel, IMessagingContext {\r\n    event PacketSent(bytes encodedPayload, bytes options, address sendLibrary);\r\n\r\n    event PacketVerified(Origin origin, address receiver, bytes32 payloadHash);\r\n\r\n    event PacketDelivered(Origin origin, address receiver);\r\n\r\n    event LzReceiveAlert(\r\n        address indexed receiver,\r\n        address indexed executor,\r\n        Origin origin,\r\n        bytes32 guid,\r\n        uint256 gas,\r\n        uint256 value,\r\n        bytes message,\r\n        bytes extraData,\r\n        bytes reason\r\n    );\r\n\r\n    event LzTokenSet(address token);\r\n\r\n    event DelegateSet(address sender, address delegate);\r\n\r\n    function quote(MessagingParams calldata _params, address _sender) external view returns (MessagingFee memory);\r\n\r\n    function send(\r\n        MessagingParams calldata _params,\r\n        address _refundAddress\r\n    ) external payable returns (MessagingReceipt memory);\r\n\r\n    function verify(Origin calldata _origin, address _receiver, bytes32 _payloadHash) external;\r\n\r\n    function verifiable(Origin calldata _origin, address _receiver) external view returns (bool);\r\n\r\n    function initializable(Origin calldata _origin, address _receiver) external view returns (bool);\r\n\r\n    function lzReceive(\r\n        Origin calldata _origin,\r\n        address _receiver,\r\n        bytes32 _guid,\r\n        bytes calldata _message,\r\n        bytes calldata _extraData\r\n    ) external payable;\r\n\r\n    // oapp can burn messages partially by calling this function with its own business logic if messages are verified in order\r\n    function clear(address _oapp, Origin calldata _origin, bytes32 _guid, bytes calldata _message) external;\r\n\r\n    function setLzToken(address _lzToken) external;\r\n\r\n    function lzToken() external view returns (address);\r\n\r\n    function nativeToken() external view returns (address);\r\n\r\n    function setDelegate(address _delegate) external;\r\n}\r\n\r\n// lib/openzeppelin-contracts/contracts/access/AccessControl.sol\r\n\r\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\r\n\r\n/**\r\n * @dev Contract module that allows children to implement role-based access\r\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\r\n * members except through off-chain means by accessing the contract event logs. Some\r\n * applications may benefit from on-chain enumerability, for those cases see\r\n * {AccessControlEnumerable}.\r\n *\r\n * Roles are referred to by their `bytes32` identifier. These should be exposed\r\n * in the external API and be unique. The best way to achieve this is by\r\n * using `public constant` hash digests:\r\n *\r\n * ```solidity\r\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\r\n * ```\r\n *\r\n * Roles can be used to represent a set of permissions. To restrict access to a\r\n * function call, use {hasRole}:\r\n *\r\n * ```solidity\r\n * function foo() public {\r\n *     require(hasRole(MY_ROLE, msg.sender));\r\n *     ...\r\n * }\r\n * ```\r\n *\r\n * Roles can be granted and revoked dynamically via the {grantRole} and\r\n * {revokeRole} functions. Each role has an associated admin role, and only\r\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\r\n *\r\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\r\n * that only accounts with this role will be able to grant or revoke other\r\n * roles. More complex role relationships can be created by using\r\n * {_setRoleAdmin}.\r\n *\r\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\r\n * grant and revoke this role. Extra precautions should be taken to secure\r\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\r\n * to enforce additional security measures for this role.\r\n */\r\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\r\n    struct RoleData {\r\n        mapping(address account => bool) hasRole;\r\n        bytes32 adminRole;\r\n    }\r\n\r\n    mapping(bytes32 role => RoleData) private _roles;\r\n\r\n    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\r\n\r\n    /**\r\n     * @dev Modifier that checks that an account has a specific role. Reverts\r\n     * with an {AccessControlUnauthorizedAccount} error including the required role.\r\n     */\r\n    modifier onlyRole(bytes32 role) {\r\n        _checkRole(role);\r\n        _;\r\n    }\r\n\r\n    /**\r\n     * @dev See {IERC165-supportsInterface}.\r\n     */\r\n    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\r\n        return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\r\n    }\r\n\r\n    /**\r\n     * @dev Returns `true` if `account` has been granted `role`.\r\n     */\r\n    function hasRole(bytes32 role, address account) public view virtual returns (bool) {\r\n        return _roles[role].hasRole[account];\r\n    }\r\n\r\n    /**\r\n     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\r\n     * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\r\n     */\r\n    function _checkRole(bytes32 role) internal view virtual {\r\n        _checkRole(role, _msgSender());\r\n    }\r\n\r\n    /**\r\n     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\r\n     * is missing `role`.\r\n     */\r\n    function _checkRole(bytes32 role, address account) internal view virtual {\r\n        if (!hasRole(role, account)) {\r\n            revert AccessControlUnauthorizedAccount(account, role);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * @dev Returns the admin role that controls `role`. See {grantRole} and\r\n     * {revokeRole}.\r\n     *\r\n     * To change a role's admin, use {_setRoleAdmin}.\r\n     */\r\n    function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\r\n        return _roles[role].adminRole;\r\n    }\r\n\r\n    /**\r\n     * @dev Grants `role` to `account`.\r\n     *\r\n     * If `account` had not been already granted `role`, emits a {RoleGranted}\r\n     * event.\r\n     *\r\n     * Requirements:\r\n     *\r\n     * - the caller must have ``role``'s admin role.\r\n     *\r\n     * May emit a {RoleGranted} event.\r\n     */\r\n    function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\r\n        _grantRole(role, account);\r\n    }\r\n\r\n    /**\r\n     * @dev Revokes `role` from `account`.\r\n     *\r\n     * If `account` had been granted `role`, emits a {RoleRevoked} event.\r\n     *\r\n     * Requirements:\r\n     *\r\n     * - the caller must have ``role``'s admin role.\r\n     *\r\n     * May emit a {RoleRevoked} event.\r\n     */\r\n    function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\r\n        _revokeRole(role, account);\r\n    }\r\n\r\n    /**\r\n     * @dev Revokes `role` from the calling account.\r\n     *\r\n     * Roles are often managed via {grantRole} and {revokeRole}: this function's\r\n     * purpose is to provide a mechanism for accounts to lose their privileges\r\n     * if they are compromised (such as when a trusted device is misplaced).\r\n     *\r\n     * If the calling account had been revoked `role`, emits a {RoleRevoked}\r\n     * event.\r\n     *\r\n     * Requirements:\r\n     *\r\n     * - the caller must be `callerConfirmation`.\r\n     *\r\n     * May emit a {RoleRevoked} event.\r\n     */\r\n    function renounceRole(bytes32 role, address callerConfirmation) public virtual {\r\n        if (callerConfirmation != _msgSender()) {\r\n            revert AccessControlBadConfirmation();\r\n        }\r\n\r\n        _revokeRole(role, callerConfirmation);\r\n    }\r\n\r\n    /**\r\n     * @dev Sets `adminRole` as ``role``'s admin role.\r\n     *\r\n     * Emits a {RoleAdminChanged} event.\r\n     */\r\n    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\r\n        bytes32 previousAdminRole = getRoleAdmin(role);\r\n        _roles[role].adminRole = adminRole;\r\n        emit RoleAdminChanged(role, previousAdminRole, adminRole);\r\n    }\r\n\r\n    /**\r\n     * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\r\n     *\r\n     * Internal function without access restriction.\r\n     *\r\n     * May emit a {RoleGranted} event.\r\n     */\r\n    function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\r\n        if (!hasRole(role, account)) {\r\n            _roles[role].hasRole[account] = true;\r\n            emit RoleGranted(role, account, _msgSender());\r\n            return true;\r\n        } else {\r\n            return false;\r\n        }\r\n    }\r\n\r\n    /**\r\n     * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\r\n     *\r\n     * Internal function without access restriction.\r\n     *\r\n     * May emit a {RoleRevoked} event.\r\n     */\r\n    function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\r\n        if (hasRole(role, account)) {\r\n            _roles[role].hasRole[account] = false;\r\n            emit RoleRevoked(role, account, _msgSender());\r\n            return true;\r\n        } else {\r\n            return false;\r\n        }\r\n    }\r\n}\r\n\r\n// lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol\r\n\r\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)\r\n\r\n/**\r\n * @dev Implementation of the {IERC20} interface.\r\n *\r\n * This implementation is agnostic to the way tokens are created. This means\r\n * that a supply mechanism has to be added in a derived contract using {_mint}.\r\n *\r\n * TIP: For a detailed writeup see our guide\r\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\r\n * to implement supply mechanisms].\r\n *\r\n * The default value of {decimals} is 18. To change this, you should override\r\n * this function so it returns a different value.\r\n *\r\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\r\n * instead returning `false` on failure. This behavior is nonetheless\r\n * conventional and does not conflict with the expectations of ERC20\r\n * applications.\r\n *\r\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\r\n * This allows applications to reconstruct the allowance for all accounts just\r\n * by listening to said events. Other implementations of the EIP may not emit\r\n * these events, as it isn't required by the specification.\r\n */\r\nabstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {\r\n    mapping(address account => uint256) private _balances;\r\n\r\n    mapping(address account => mapping(address spender => uint256)) private _allowances;\r\n\r\n    uint256 private _totalSupply;\r\n\r\n    string private _name;\r\n    string private _symbol;\r\n\r\n    /**\r\n     * @dev Sets the values for {name} and {symbol}.\r\n     *\r\n     * All two of these values are immutable: they can only be set once during\r\n     * construction.\r\n     */\r\n    constructor(string memory name_, string memory symbol_) {\r\n        _name = name_;\r\n        _symbol = symbol_;\r\n    }\r\n\r\n    /**\r\n     * @dev Returns the name of the token.\r\n     */\r\n    function name() public view virtual returns (string memory) {\r\n        return _name;\r\n    }\r\n\r\n    /**\r\n     * @dev Returns the symbol of the token, usually a shorter version of the\r\n     * name.\r\n     */\r\n    function symbol() public view virtual returns (string memory) {\r\n        return _symbol;\r\n    }\r\n\r\n    /**\r\n     * @dev Returns the number of decimals used to get its user representation.\r\n     * For example, if `decimals` equals `2`, a balance of `505` tokens should\r\n     * be displayed to a user as `5.05` (`505 / 10 ** 2`).\r\n     *\r\n     * Tokens usually opt for a value of 18, imitating the relationship between\r\n     * Ether and Wei. This is the default value returned by this function, unless\r\n     * it's overridden.\r\n     *\r\n     * NOTE: This information is only used for _display_ purposes: it in\r\n     * no way affects any of the arithmetic of the contract, including\r\n     * {IERC20-balanceOf} and {IERC20-transfer}.\r\n     */\r\n    function decimals() public view virtual returns (uint8) {\r\n        return 18;\r\n    }\r\n\r\n    /**\r\n     * @dev See {IERC20-totalSupply}.\r\n     */\r\n    function totalSupply() public view virtual returns (uint256) {\r\n        return _totalSupply;\r\n    }\r\n\r\n    /**\r\n     * @dev See {IERC20-balanceOf}.\r\n     */\r\n    function balanceOf(address account) public view virtual returns (uint256) {\r\n        return _balances[account];\r\n    }\r\n\r\n    /**\r\n     * @dev See {IERC20-transfer}.\r\n     *\r\n     * Requirements:\r\n     *\r\n     * - `to` cannot be the zero address.\r\n     * - the caller must have a balance of at least `value`.\r\n     */\r\n    function transfer(address to, uint256 value) public virtual returns (bool) {\r\n        address owner = _msgSender();\r\n        _transfer(owner, to, value);\r\n        return true;\r\n    }\r\n\r\n    /**\r\n     * @dev See {IERC20-allowance}.\r\n     */\r\n    function allowance(address owner, address spender) public view virtual returns (uint256) {\r\n        return _allowances[owner][spender];\r\n    }\r\n\r\n    /**\r\n     * @dev See {IERC20-approve}.\r\n     *\r\n     * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on\r\n     * `transferFrom`. This is semantically equivalent to an infinite approval.\r\n     *\r\n     * Requirements:\r\n     *\r\n     * - `spender` cannot be the zero address.\r\n     */\r\n    function approve(address spender, uint256 value) public virtual returns (bool) {\r\n        address owner = _msgSender();\r\n        _approve(owner, spender, value);\r\n        return true;\r\n    }\r\n\r\n    /**\r\n     * @dev See {IERC20-transferFrom}.\r\n     *\r\n     * Emits an {Approval} event indicating the updated allowance. This is not\r\n     * required by the EIP. See the note at the beginning of {ERC20}.\r\n     *\r\n     * NOTE: Does not update the allowance if the current allowance\r\n     * is the maximum `uint256`.\r\n     *\r\n     * Requirements:\r\n     *\r\n     * - `from` and `to` cannot be the zero address.\r\n     * - `from` must have a balance of at least `value`.\r\n     * - the caller must have allowance for ``from``'s tokens of at least\r\n     * `value`.\r\n     */\r\n    function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {\r\n        address spender = _msgSender();\r\n        _spendAllowance(from, spender, value);\r\n        _transfer(from, to, value);\r\n        return true;\r\n    }\r\n\r\n    /**\r\n     * @dev Moves a `value` amount of tokens from `from` to `to`.\r\n     *\r\n     * This internal function is equivalent to {transfer}, and can be used to\r\n     * e.g. implement automatic token fees, slashing mechanisms, etc.\r\n     *\r\n     * Emits a {Transfer} event.\r\n     *\r\n     * NOTE: This function is not virtual, {_update} should be overridden instead.\r\n     */\r\n    function _transfer(address from, address to, uint256 value) internal {\r\n        if (from == address(0)) {\r\n            revert ERC20InvalidSender(address(0));\r\n        }\r\n        if (to == address(0)) {\r\n            revert ERC20InvalidReceiver(address(0));\r\n        }\r\n        _update(from, to, value);\r\n    }\r\n\r\n    /**\r\n     * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`\r\n     * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding\r\n     * this function.\r\n     *\r\n     * Emits a {Transfer} event.\r\n     */\r\n    function _update(address from, address to, uint256 value) internal virtual {\r\n        if (from == address(0)) {\r\n            // Overflow check required: The rest of the code assumes that totalSupply never overflows\r\n            _totalSupply += value;\r\n        } else {\r\n            uint256 fromBalance = _balances[from];\r\n            if (fromBalance < value) {\r\n                revert ERC20InsufficientBalance(from, fromBalance, value);\r\n            }\r\n            unchecked {\r\n                // Overflow not possible: value <= fromBalance <= totalSupply.\r\n                _balances[from] = fromBalance - value;\r\n            }\r\n        }\r\n\r\n        if (to == address(0)) {\r\n            unchecked {\r\n                // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.\r\n                _totalSupply -= value;\r\n            }\r\n        } else {\r\n            unchecked {\r\n                // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.\r\n                _balances[to] += value;\r\n            }\r\n        }\r\n\r\n        emit Transfer(from, to, value);\r\n    }\r\n\r\n    /**\r\n     * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).\r\n     * Relies on the `_update` mechanism\r\n     *\r\n     * Emits a {Transfer} event with `from` set to the zero address.\r\n     *\r\n     * NOTE: This function is not virtual, {_update} should be overridden instead.\r\n     */\r\n    function _mint(address account, uint256 value) internal {\r\n        if (account == address(0)) {\r\n            revert ERC20InvalidReceiver(address(0));\r\n        }\r\n        _update(address(0), account, value);\r\n    }\r\n\r\n    /**\r\n     * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.\r\n     * Relies on the `_update` mechanism.\r\n     *\r\n     * Emits a {Transfer} event with `to` set to the zero address.\r\n     *\r\n     * NOTE: This function is not virtual, {_update} should be overridden instead\r\n     */\r\n    function _burn(address account, uint256 value) internal {\r\n        if (account == address(0)) {\r\n            revert ERC20InvalidSender(address(0));\r\n        }\r\n        _update(account, address(0), value);\r\n    }\r\n\r\n    /**\r\n     * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.\r\n     *\r\n     * This internal function is equivalent to `approve`, and can be used to\r\n     * e.g. set automatic allowances for certain subsystems, etc.\r\n     *\r\n     * Emits an {Approval} event.\r\n     *\r\n     * Requirements:\r\n     *\r\n     * - `owner` cannot be the zero address.\r\n     * - `spender` cannot be the zero address.\r\n     *\r\n     * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.\r\n     */\r\n    function _approve(address owner, address spender, uint256 value) internal {\r\n        _approve(owner, spender, value, true);\r\n    }\r\n\r\n    /**\r\n     * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.\r\n     *\r\n     * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by\r\n     * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any\r\n     * `Approval` event during `transferFrom` operations.\r\n     *\r\n     * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to\r\n     * true using the following override:\r\n     * ```\r\n     * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {\r\n     *     super._approve(owner, spender, value, true);\r\n     * }\r\n     * ```\r\n     *\r\n     * Requirements are the same as {_approve}.\r\n     */\r\n    function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {\r\n        if (owner == address(0)) {\r\n            revert ERC20InvalidApprover(address(0));\r\n        }\r\n        if (spender == address(0)) {\r\n            revert ERC20InvalidSpender(address(0));\r\n        }\r\n        _allowances[owner][spender] = value;\r\n        if (emitEvent) {\r\n            emit Approval(owner, spender, value);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * @dev Updates `owner` s allowance for `spender` based on spent `value`.\r\n     *\r\n     * Does not update the allowance value in case of infinite allowance.\r\n     * Revert if not enough allowance is available.\r\n     *\r\n     * Does not emit an {Approval} event.\r\n     */\r\n    function _spendAllowance(address owner, address spender, uint256 value) internal virtual {\r\n        uint256 currentAllowance = allowance(owner, spender);\r\n        if (currentAllowance != type(uint256).max) {\r\n            if (currentAllowance < value) {\r\n                revert ERC20InsufficientAllowance(spender, currentAllowance, value);\r\n            }\r\n            unchecked {\r\n                _approve(owner, spender, currentAllowance - value, false);\r\n            }\r\n        }\r\n    }\r\n}\r\n\r\n// lib/LayerZero-v2/packages/layerzero-v2/evm/oapp/contracts/oapp/interfaces/IOAppCore.sol\r\n\r\n/**\r\n * @title IOAppCore\r\n */\r\ninterface IOAppCore {\r\n    // Custom error messages\r\n    error OnlyPeer(uint32 eid, bytes32 sender);\r\n    error NoPeer(uint32 eid);\r\n    error InvalidEndpointCall();\r\n    error InvalidDelegate();\r\n\r\n    // Event emitted when a peer (OApp) is set for a corresponding endpoint\r\n    event PeerSet(uint32 eid, bytes32 peer);\r\n\r\n    /**\r\n     * @notice Retrieves the OApp version information.\r\n     * @return senderVersion The version of the OAppSender.sol contract.\r\n     * @return receiverVersion The version of the OAppReceiver.sol contract.\r\n     */\r\n    function oAppVersion() external view returns (uint64 senderVersion, uint64 receiverVersion);\r\n\r\n    /**\r\n     * @notice Retrieves the LayerZero endpoint associated with the OApp.\r\n     * @return iEndpoint The LayerZero endpoint as an interface.\r\n     */\r\n    function endpoint() external view returns (ILayerZeroEndpointV2 iEndpoint);\r\n\r\n    /**\r\n     * @notice Retrieves the peer (OApp) associated with a corresponding endpoint.\r\n     * @param _eid The endpoint ID.\r\n     * @return peer The peer address (OApp instance) associated with the corresponding endpoint.\r\n     */\r\n    function peers(uint32 _eid) external view returns (bytes32 peer);\r\n\r\n    /**\r\n     * @notice Sets the peer address (OApp instance) for a corresponding endpoint.\r\n     * @param _eid The endpoint ID.\r\n     * @param _peer The address of the peer to be associated with the corresponding endpoint.\r\n     */\r\n    function setPeer(uint32 _eid, bytes32 _peer) external;\r\n\r\n    /**\r\n     * @notice Sets the delegate address for the OApp Core.\r\n     * @param _delegate The address of the delegate to be set.\r\n     */\r\n    function setDelegate(address _delegate) external;\r\n}\r\n\r\n// lib/LayerZero-v2/packages/layerzero-v2/evm/protocol/contracts/interfaces/ILayerZeroReceiver.sol\r\n\r\ninterface ILayerZeroReceiver {\r\n    function allowInitializePath(Origin calldata _origin) external view returns (bool);\r\n\r\n    function nextNonce(uint32 _eid, bytes32 _sender) external view returns (uint64);\r\n\r\n    function lzReceive(\r\n        Origin calldata _origin,\r\n        bytes32 _guid,\r\n        bytes calldata _message,\r\n        address _executor,\r\n        bytes calldata _extraData\r\n    ) external payable;\r\n}\r\n\r\n// lib/LayerZero-v2/packages/layerzero-v2/evm/oapp/contracts/oapp/interfaces/IOAppReceiver.sol\r\n\r\ninterface IOAppReceiver is ILayerZeroReceiver {\r\n    /**\r\n     * @notice Retrieves the address responsible for 'sending' composeMsg's to the Endpoint.\r\n     * @return sender The address responsible for 'sending' composeMsg's to the Endpoint.\r\n     *\r\n     * @dev Applications can optionally choose to implement a separate composeMsg sender that is NOT the bridging layer.\r\n     * @dev The default sender IS the OApp implementer.\r\n     */\r\n    function composeMsgSender() external view returns (address sender);\r\n}\r\n\r\n// lib/LayerZero-v2/packages/layerzero-v2/evm/protocol/contracts/interfaces/ISendLib.sol\r\n\r\nstruct Packet {\r\n    uint64 nonce;\r\n    uint32 srcEid;\r\n    address sender;\r\n    uint32 dstEid;\r\n    bytes32 receiver;\r\n    bytes32 guid;\r\n    bytes message;\r\n}\r\n\r\ninterface ISendLib is IMessageLib {\r\n    function send(\r\n        Packet calldata _packet,\r\n        bytes calldata _options,\r\n        bool _payInLzToken\r\n    ) external returns (MessagingFee memory, bytes memory encodedPacket);\r\n\r\n    function quote(\r\n        Packet calldata _packet,\r\n        bytes calldata _options,\r\n        bool _payInLzToken\r\n    ) external view returns (MessagingFee memory);\r\n\r\n    function setTreasury(address _treasury) external;\r\n\r\n    function withdrawFee(address _to, uint256 _amount) external;\r\n\r\n    function withdrawLzTokenFee(address _lzToken, address _to, uint256 _amount) external;\r\n}\r\n\r\n// lib/LayerZero-v2/packages/layerzero-v2/evm/oapp/contracts/oapp/OAppCore.sol\r\n\r\n/**\r\n * @title OAppCore\r\n * @dev Abstract contract implementing the IOAppCore interface with basic OApp configurations.\r\n */\r\nabstract contract OAppCore is IOAppCore, Ownable {\r\n    // The LayerZero endpoint associated with the given OApp\r\n    ILayerZeroEndpointV2 public immutable endpoint;\r\n\r\n    // Mapping to store peers associated with corresponding endpoints\r\n    mapping(uint32 eid => bytes32 peer) public peers;\r\n\r\n    /**\r\n     * @dev Constructor to initialize the OAppCore with the provided endpoint and delegate.\r\n     * @param _endpoint The address of the LOCAL Layer Zero endpoint.\r\n     * @param _delegate The delegate capable of making OApp configurations inside of the endpoint.\r\n     *\r\n     * @dev The delegate typically should be set as the owner of the contract.\r\n     */\r\n    constructor(address _endpoint, address _delegate) {\r\n        endpoint = ILayerZeroEndpointV2(_endpoint);\r\n\r\n        if (_delegate == address(0)) revert InvalidDelegate();\r\n        endpoint.setDelegate(_delegate);\r\n    }\r\n\r\n    /**\r\n     * @notice Sets the peer address (OApp instance) for a corresponding endpoint.\r\n     * @param _eid The endpoint ID.\r\n     * @param _peer The address of the peer to be associated with the corresponding endpoint.\r\n     *\r\n     * @dev Only the owner/admin of the OApp can call this function.\r\n     * @dev Indicates that the peer is trusted to send LayerZero messages to this OApp.\r\n     * @dev Set this to bytes32(0) to remove the peer address.\r\n     * @dev Peer is a bytes32 to accommodate non-evm chains.\r\n     */\r\n    function setPeer(uint32 _eid, bytes32 _peer) public virtual onlyOwner {\r\n        peers[_eid] = _peer;\r\n        emit PeerSet(_eid, _peer);\r\n    }\r\n\r\n    /**\r\n     * @notice Internal function to get the peer address associated with a specific endpoint; reverts if NOT set.\r\n     * ie. the peer is set to bytes32(0).\r\n     * @param _eid The endpoint ID.\r\n     * @return peer The address of the peer associated with the specified endpoint.\r\n     */\r\n    function _getPeerOrRevert(uint32 _eid) internal view virtual returns (bytes32) {\r\n        bytes32 peer = peers[_eid];\r\n        if (peer == bytes32(0)) revert NoPeer(_eid);\r\n        return peer;\r\n    }\r\n\r\n    /**\r\n     * @notice Sets the delegate address for the OApp.\r\n     * @param _delegate The address of the delegate to be set.\r\n     *\r\n     * @dev Only the owner/admin of the OApp can call this function.\r\n     * @dev Provides the ability for a delegate to set configs, on behalf of the OApp, directly on the Endpoint contract.\r\n     */\r\n    function setDelegate(address _delegate) public onlyOwner {\r\n        endpoint.setDelegate(_delegate);\r\n    }\r\n}\r\n\r\n// lib/LayerZero-v2/packages/layerzero-v2/evm/protocol/contracts/messagelib/libs/PacketV1Codec.sol\r\n\r\nlibrary PacketV1Codec {\r\n    using AddressCast for address;\r\n    using AddressCast for bytes32;\r\n\r\n    uint8 internal constant PACKET_VERSION = 1;\r\n\r\n    // header (version + nonce + path)\r\n    // version\r\n    uint256 private constant PACKET_VERSION_OFFSET = 0;\r\n    //    nonce\r\n    uint256 private constant NONCE_OFFSET = 1;\r\n    //    path\r\n    uint256 private constant SRC_EID_OFFSET = 9;\r\n    uint256 private constant SENDER_OFFSET = 13;\r\n    uint256 private constant DST_EID_OFFSET = 45;\r\n    uint256 private constant RECEIVER_OFFSET = 49;\r\n    // payload (guid + message)\r\n    uint256 private constant GUID_OFFSET = 81; // keccak256(nonce + path)\r\n    uint256 private constant MESSAGE_OFFSET = 113;\r\n\r\n    function encode(Packet memory _packet) internal pure returns (bytes memory encodedPacket) {\r\n        encodedPacket = abi.encodePacked(\r\n            PACKET_VERSION,\r\n            _packet.nonce,\r\n            _packet.srcEid,\r\n            _packet.sender.toBytes32(),\r\n            _packet.dstEid,\r\n            _packet.receiver,\r\n            _packet.guid,\r\n            _packet.message\r\n        );\r\n    }\r\n\r\n    function encodePacketHeader(Packet memory _packet) internal pure returns (bytes memory) {\r\n        return\r\n            abi.encodePacked(\r\n                PACKET_VERSION,\r\n                _packet.nonce,\r\n                _packet.srcEid,\r\n                _packet.sender.toBytes32(),\r\n                _packet.dstEid,\r\n                _packet.receiver\r\n            );\r\n    }\r\n\r\n    function encodePayload(Packet memory _packet) internal pure returns (bytes memory) {\r\n        return abi.encodePacked(_packet.guid, _packet.message);\r\n    }\r\n\r\n    function header(bytes calldata _packet) internal pure returns (bytes calldata) {\r\n        return _packet[0:GUID_OFFSET];\r\n    }\r\n\r\n    function version(bytes calldata _packet) internal pure returns (uint8) {\r\n        return uint8(bytes1(_packet[PACKET_VERSION_OFFSET:NONCE_OFFSET]));\r\n    }\r\n\r\n    function nonce(bytes calldata _packet) internal pure returns (uint64) {\r\n        return uint64(bytes8(_packet[NONCE_OFFSET:SRC_EID_OFFSET]));\r\n    }\r\n\r\n    function srcEid(bytes calldata _packet) internal pure returns (uint32) {\r\n        return uint32(bytes4(_packet[SRC_EID_OFFSET:SENDER_OFFSET]));\r\n    }\r\n\r\n    function sender(bytes calldata _packet) internal pure returns (bytes32) {\r\n        return bytes32(_packet[SENDER_OFFSET:DST_EID_OFFSET]);\r\n    }\r\n\r\n    function senderAddressB20(bytes calldata _packet) internal pure returns (address) {\r\n        return sender(_packet).toAddress();\r\n    }\r\n\r\n    function dstEid(bytes calldata _packet) internal pure returns (uint32) {\r\n        return uint32(bytes4(_packet[DST_EID_OFFSET:RECEIVER_OFFSET]));\r\n    }\r\n\r\n    function receiver(bytes calldata _packet) internal pure returns (bytes32) {\r\n        return bytes32(_packet[RECEIVER_OFFSET:GUID_OFFSET]);\r\n    }\r\n\r\n    function receiverB20(bytes calldata _packet) internal pure returns (address) {\r\n        return receiver(_packet).toAddress();\r\n    }\r\n\r\n    function guid(bytes calldata _packet) internal pure returns (bytes32) {\r\n        return bytes32(_packet[GUID_OFFSET:MESSAGE_OFFSET]);\r\n    }\r\n\r\n    function message(bytes calldata _packet) internal pure returns (bytes calldata) {\r\n        return bytes(_packet[MESSAGE_OFFSET:]);\r\n    }\r\n\r\n    function payload(bytes calldata _packet) internal pure returns (bytes calldata) {\r\n        return bytes(_packet[GUID_OFFSET:]);\r\n    }\r\n\r\n    function payloadHash(bytes calldata _packet) internal pure returns (bytes32) {\r\n        return keccak256(payload(_packet));\r\n    }\r\n}\r\n\r\n// lib/LayerZero-v2/packages/layerzero-v2/evm/oapp/contracts/precrime/libs/Packet.sol\r\n\r\n/**\r\n * @title InboundPacket\r\n * @dev Structure representing an inbound packet received by the contract.\r\n */\r\nstruct InboundPacket {\r\n    Origin origin; // Origin information of the packet.\r\n    uint32 dstEid; // Destination endpointId of the packet.\r\n    address receiver; // Receiver address for the packet.\r\n    bytes32 guid; // Unique identifier of the packet.\r\n    uint256 value; // msg.value of the packet.\r\n    address executor; // Executor address for the packet.\r\n    bytes message; // Message payload of the packet.\r\n    bytes extraData; // Additional arbitrary data for the packet.\r\n}\r\n\r\n/**\r\n * @title PacketDecoder\r\n * @dev Library for decoding LayerZero packets.\r\n */\r\nlibrary PacketDecoder {\r\n    using PacketV1Codec for bytes;\r\n\r\n    /**\r\n     * @dev Decode an inbound packet from the given packet data.\r\n     * @param _packet The packet data to decode.\r\n     * @return packet An InboundPacket struct representing the decoded packet.\r\n     */\r\n    function decode(bytes calldata _packet) internal pure returns (InboundPacket memory packet) {\r\n        packet.origin = Origin(_packet.srcEid(), _packet.sender(), _packet.nonce());\r\n        packet.dstEid = _packet.dstEid();\r\n        packet.receiver = _packet.receiverB20();\r\n        packet.guid = _packet.guid();\r\n        packet.message = _packet.message();\r\n    }\r\n\r\n    /**\r\n     * @dev Decode multiple inbound packets from the given packet data and associated message values.\r\n     * @param _packets An array of packet data to decode.\r\n     * @param _packetMsgValues An array of associated message values for each packet.\r\n     * @return packets An array of InboundPacket structs representing the decoded packets.\r\n     */\r\n    function decode(\r\n        bytes[] calldata _packets,\r\n        uint256[] memory _packetMsgValues\r\n    ) internal pure returns (InboundPacket[] memory packets) {\r\n        packets = new InboundPacket[](_packets.length);\r\n        for (uint256 i = 0; i < _packets.length; i++) {\r\n            bytes calldata packet = _packets[i];\r\n            packets[i] = PacketDecoder.decode(packet);\r\n            // @dev Allows the verifier to specify the msg.value that gets passed in lzReceive.\r\n            packets[i].value = _packetMsgValues[i];\r\n        }\r\n    }\r\n}\r\n\r\n// lib/LayerZero-v2/packages/layerzero-v2/evm/oapp/contracts/oapp/OAppReceiver.sol\r\n\r\n/**\r\n * @title OAppReceiver\r\n * @dev Abstract contract implementing the ILayerZeroReceiver interface and extending OAppCore for OApp receivers.\r\n */\r\nabstract contract OAppReceiver is IOAppReceiver, OAppCore {\r\n    // Custom error message for when the caller is not the registered endpoint/\r\n    error OnlyEndpoint(address addr);\r\n\r\n    // @dev The version of the OAppReceiver implementation.\r\n    // @dev Version is bumped when changes are made to this contract.\r\n    uint64 internal constant RECEIVER_VERSION = 1;\r\n\r\n    /**\r\n     * @notice Retrieves the OApp version information.\r\n     * @return senderVersion The version of the OAppSender.sol contract.\r\n     * @return receiverVersion The version of the OAppReceiver.sol contract.\r\n     *\r\n     * @dev Providing 0 as the default for OAppSender version. Indicates that the OAppSender is not implemented.\r\n     * ie. this is a RECEIVE only OApp.\r\n     * @dev If the OApp uses both OAppSender and OAppReceiver, then this needs to be override returning the correct versions.\r\n     */\r\n    function oAppVersion() public view virtual returns (uint64 senderVersion, uint64 receiverVersion) {\r\n        return (0, RECEIVER_VERSION);\r\n    }\r\n\r\n    /**\r\n     * @notice Retrieves the address responsible for 'sending' composeMsg's to the Endpoint.\r\n     * @return sender The address responsible for 'sending' composeMsg's to the Endpoint.\r\n     *\r\n     * @dev Applications can optionally choose to implement a separate composeMsg sender that is NOT the bridging layer.\r\n     * @dev The default sender IS the OApp implementer.\r\n     */\r\n    function composeMsgSender() public view virtual returns (address sender) {\r\n        return address(this);\r\n    }\r\n\r\n    /**\r\n     * @notice Checks if the path initialization is allowed based on the provided origin.\r\n     * @param origin The origin information containing the source endpoint and sender address.\r\n     * @return Whether the path has been initialized.\r\n     *\r\n     * @dev This indicates to the endpoint that the OApp has enabled msgs for this particular path to be received.\r\n     * @dev This defaults to assuming if a peer has been set, its initialized.\r\n     * Can be overridden by the OApp if there is other logic to determine this.\r\n     */\r\n    function allowInitializePath(Origin calldata origin) public view virtual returns (bool) {\r\n        return peers[origin.srcEid] == origin.sender;\r\n    }\r\n\r\n    /**\r\n     * @notice Retrieves the next nonce for a given source endpoint and sender address.\r\n     * @dev _srcEid The source endpoint ID.\r\n     * @dev _sender The sender address.\r\n     * @return nonce The next nonce.\r\n     *\r\n     * @dev The path nonce starts from 1. If 0 is returned it means that there is NO nonce ordered enforcement.\r\n     * @dev Is required by the off-chain executor to determine the OApp expects msg execution is ordered.\r\n     * @dev This is also enforced by the OApp.\r\n     * @dev By default this is NOT enabled. ie. nextNonce is hardcoded to return 0.\r\n     */\r\n    function nextNonce(uint32 /*_srcEid*/, bytes32 /*_sender*/) public view virtual returns (uint64 nonce) {\r\n        return 0;\r\n    }\r\n\r\n    /**\r\n     * @dev Entry point for receiving messages or packets from the endpoint.\r\n     * @param _origin The origin information containing the source endpoint and sender address.\r\n     *  - srcEid: The source chain endpoint ID.\r\n     *  - sender: The sender address on the src chain.\r\n     *  - nonce: The nonce of the message.\r\n     * @param _guid The unique identifier for the received LayerZero message.\r\n     * @param _message The payload of the received message.\r\n     * @param _executor The address of the executor for the received message.\r\n     * @param _extraData Additional arbitrary data provided by the corresponding executor.\r\n     *\r\n     * @dev Entry point for receiving msg/packet from the LayerZero endpoint.\r\n     */\r\n    function lzReceive(\r\n        Origin calldata _origin,\r\n        bytes32 _guid,\r\n        bytes calldata _message,\r\n        address _executor,\r\n        bytes calldata _extraData\r\n    ) public payable virtual {\r\n        // Ensures that only the endpoint can attempt to lzReceive() messages to this OApp.\r\n        if (address(endpoint) != msg.sender) revert OnlyEndpoint(msg.sender);\r\n\r\n        // Ensure that the sender matches the expected peer for the source endpoint.\r\n        if (_getPeerOrRevert(_origin.srcEid) != _origin.sender) revert OnlyPeer(_origin.srcEid, _origin.sender);\r\n\r\n        // Call the internal OApp implementation of lzReceive.\r\n        _lzReceive(_origin, _guid, _message, _executor, _extraData);\r\n    }\r\n\r\n    /**\r\n     * @dev Internal function to implement lzReceive logic without needing to copy the basic parameter validation.\r\n     */\r\n    function _lzReceive(\r\n        Origin calldata _origin,\r\n        bytes32 _guid,\r\n        bytes calldata _message,\r\n        address _executor,\r\n        bytes calldata _extraData\r\n    ) internal virtual;\r\n}\r\n\r\n// lib/LayerZero-v2/packages/layerzero-v2/evm/oapp/contracts/precrime/interfaces/IOAppPreCrimeSimulator.sol\r\n\r\n// @dev Import the Origin so it's exposed to OAppPreCrimeSimulator implementers.\r\n// solhint-disable-next-line no-unused-import\r\n\r\n/**\r\n * @title IOAppPreCrimeSimulator Interface\r\n * @dev Interface for the preCrime simulation functionality in an OApp.\r\n */\r\ninterface IOAppPreCrimeSimulator {\r\n    // @dev simulation result used in PreCrime implementation\r\n    error SimulationResult(bytes result);\r\n    error OnlySelf();\r\n\r\n    /**\r\n     * @dev Emitted when the preCrime contract address is set.\r\n     * @param preCrimeAddress The address of the preCrime contract.\r\n     */\r\n    event PreCrimeSet(address preCrimeAddress);\r\n\r\n    /**\r\n     * @dev Retrieves the address of the preCrime contract implementation.\r\n     * @return The address of the preCrime contract.\r\n     */\r\n    function preCrime() external view returns (address);\r\n\r\n    /**\r\n     * @dev Retrieves the address of the OApp contract.\r\n     * @return The address of the OApp contract.\r\n     */\r\n    function oApp() external view returns (address);\r\n\r\n    /**\r\n     * @dev Sets the preCrime contract address.\r\n     * @param _preCrime The address of the preCrime contract.\r\n     */\r\n    function setPreCrime(address _preCrime) external;\r\n\r\n    /**\r\n     * @dev Mocks receiving a packet, then reverts with a series of data to infer the state/result.\r\n     * @param _packets An array of LayerZero InboundPacket objects representing received packets.\r\n     */\r\n    function lzReceiveAndRevert(InboundPacket[] calldata _packets) external payable;\r\n\r\n    /**\r\n     * @dev checks if the specified peer is considered 'trusted' by the OApp.\r\n     * @param _eid The endpoint Id to check.\r\n     * @param _peer The peer to check.\r\n     * @return Whether the peer passed is considered 'trusted' by the OApp.\r\n     */\r\n    function isPeer(uint32 _eid, bytes32 _peer) external view returns (bool);\r\n}\r\n\r\n// lib/LayerZero-v2/packages/layerzero-v2/evm/oapp/contracts/oapp/OAppSender.sol\r\n\r\n/**\r\n * @title OAppSender\r\n * @dev Abstract contract implementing the OAppSender functionality for sending messages to a LayerZero endpoint.\r\n */\r\nabstract contract OAppSender is OAppCore {\r\n    using SafeERC20 for IERC20;\r\n\r\n    // Custom error messages\r\n    error NotEnoughNative(uint256 msgValue);\r\n    error LzTokenUnavailable();\r\n\r\n    // @dev The version of the OAppSender implementation.\r\n    // @dev Version is bumped when changes are made to this contract.\r\n    uint64 internal constant SENDER_VERSION = 1;\r\n\r\n    /**\r\n     * @notice Retrieves the OApp version information.\r\n     * @return senderVersion The version of the OAppSender.sol contract.\r\n     * @return receiverVersion The version of the OAppReceiver.sol contract.\r\n     *\r\n     * @dev Providing 0 as the default for OAppReceiver version. Indicates that the OAppReceiver is not implemented.\r\n     * ie. this is a SEND only OApp.\r\n     * @dev If the OApp uses both OAppSender and OAppReceiver, then this needs to be override returning the correct versions\r\n     */\r\n    function oAppVersion() public view virtual returns (uint64 senderVersion, uint64 receiverVersion) {\r\n        return (SENDER_VERSION, 0);\r\n    }\r\n\r\n    /**\r\n     * @dev Internal function to interact with the LayerZero EndpointV2.quote() for fee calculation.\r\n     * @param _dstEid The destination endpoint ID.\r\n     * @param _message The message payload.\r\n     * @param _options Additional options for the message.\r\n     * @param _payInLzToken Flag indicating whether to pay the fee in LZ tokens.\r\n     * @return fee The calculated MessagingFee for the message.\r\n     *      - nativeFee: The native fee for the message.\r\n     *      - lzTokenFee: The LZ token fee for the message.\r\n     */\r\n    function _quote(\r\n        uint32 _dstEid,\r\n        bytes memory _message,\r\n        bytes memory _options,\r\n        bool _payInLzToken\r\n    ) internal view virtual returns (MessagingFee memory fee) {\r\n        return\r\n            endpoint.quote(\r\n                MessagingParams(_dstEid, _getPeerOrRevert(_dstEid), _message, _options, _payInLzToken),\r\n                address(this)\r\n            );\r\n    }\r\n\r\n    /**\r\n     * @dev Internal function to interact with the LayerZero EndpointV2.send() for sending a message.\r\n     * @param _dstEid The destination endpoint ID.\r\n     * @param _message The message payload.\r\n     * @param _options Additional options for the message.\r\n     * @param _fee The calculated LayerZero fee for the message.\r\n     *      - nativeFee: The native fee.\r\n     *      - lzTokenFee: The lzToken fee.\r\n     * @param _refundAddress The address to receive any excess fee values sent to the endpoint.\r\n     * @return receipt The receipt for the sent message.\r\n     *      - guid: The unique identifier for the sent message.\r\n     *      - nonce: The nonce of the sent message.\r\n     *      - fee: The LayerZero fee incurred for the message.\r\n     */\r\n    function _lzSend(\r\n        uint32 _dstEid,\r\n        bytes memory _message,\r\n        bytes memory _options,\r\n        MessagingFee memory _fee,\r\n        address _refundAddress\r\n    ) internal virtual returns (MessagingReceipt memory receipt) {\r\n        // @dev Push corresponding fees to the endpoint, any excess is sent back to the _refundAddress from the endpoint.\r\n        uint256 messageValue = _payNative(_fee.nativeFee);\r\n        if (_fee.lzTokenFee > 0) _payLzToken(_fee.lzTokenFee);\r\n\r\n        return\r\n            // solhint-disable-next-line check-send-result\r\n            endpoint.send{ value: messageValue }(\r\n                MessagingParams(_dstEid, _getPeerOrRevert(_dstEid), _message, _options, _fee.lzTokenFee > 0),\r\n                _refundAddress\r\n            );\r\n    }\r\n\r\n    /**\r\n     * @dev Internal function to pay the native fee associated with the message.\r\n     * @param _nativeFee The native fee to be paid.\r\n     * @return nativeFee The amount of native currency paid.\r\n     *\r\n     * @dev If the OApp needs to initiate MULTIPLE LayerZero messages in a single transaction,\r\n     * this will need to be overridden because msg.value would contain multiple lzFees.\r\n     * @dev Should be overridden in the event the LayerZero endpoint requires a different native currency.\r\n     * @dev Some EVMs use an ERC20 as a method for paying transactions/gasFees.\r\n     * @dev The endpoint is EITHER/OR, ie. it will NOT support both types of native payment at a time.\r\n     */\r\n    function _payNative(uint256 _nativeFee) internal virtual returns (uint256 nativeFee) {\r\n        if (msg.value != _nativeFee) revert NotEnoughNative(msg.value);\r\n        return _nativeFee;\r\n    }\r\n\r\n    /**\r\n     * @dev Internal function to pay the LZ token fee associated with the message.\r\n     * @param _lzTokenFee The LZ token fee to be paid.\r\n     *\r\n     * @dev If the caller is trying to pay in the specified lzToken, then the lzTokenFee is passed to the endpoint.\r\n     * @dev Any excess sent, is passed back to the specified _refundAddress in the _lzSend().\r\n     */\r\n    function _payLzToken(uint256 _lzTokenFee) internal virtual {\r\n        // @dev Cannot cache the token because it is not immutable in the endpoint.\r\n        address lzToken = endpoint.lzToken();\r\n        if (lzToken == address(0)) revert LzTokenUnavailable();\r\n\r\n        // Pay LZ token fee by sending tokens to the endpoint.\r\n        IERC20(lzToken).safeTransferFrom(msg.sender, address(endpoint), _lzTokenFee);\r\n    }\r\n}\r\n\r\n// lib/LayerZero-v2/packages/layerzero-v2/evm/oapp/contracts/oft/interfaces/IOFT.sol\r\n\r\n/**\r\n * @dev Struct representing token parameters for the OFT send() operation.\r\n */\r\nstruct SendParam {\r\n    uint32 dstEid; // Destination endpoint ID.\r\n    bytes32 to; // Recipient address.\r\n    uint256 amountLD; // Amount to send in local decimals.\r\n    uint256 minAmountLD; // Minimum amount to send in local decimals.\r\n    bytes extraOptions; // Additional options supplied by the caller to be used in the LayerZero message.\r\n    bytes composeMsg; // The composed message for the send() operation.\r\n    bytes oftCmd; // The OFT command to be executed, unused in default OFT implementations.\r\n}\r\n\r\n/**\r\n * @dev Struct representing OFT limit information.\r\n * @dev These amounts can change dynamically and are up the the specific oft implementation.\r\n */\r\nstruct OFTLimit {\r\n    uint256 minAmountLD; // Minimum amount in local decimals that can be sent to the recipient.\r\n    uint256 maxAmountLD; // Maximum amount in local decimals that can be sent to the recipient.\r\n}\r\n\r\n/**\r\n * @dev Struct representing OFT receipt information.\r\n */\r\nstruct OFTReceipt {\r\n    uint256 amountSentLD; // Amount of tokens ACTUALLY debited from the sender in local decimals.\r\n    // @dev In non-default implementations, the amountReceivedLD COULD differ from this value.\r\n    uint256 amountReceivedLD; // Amount of tokens to be received on the remote side.\r\n}\r\n\r\n/**\r\n * @dev Struct representing OFT fee details.\r\n * @dev Future proof mechanism to provide a standardized way to communicate fees to things like a UI.\r\n */\r\nstruct OFTFeeDetail {\r\n    int256 feeAmountLD; // Amount of the fee in local decimals.\r\n    string description; // Description of the fee.\r\n}\r\n\r\n/**\r\n * @title IOFT\r\n * @dev Interface for the OftChain (OFT) token.\r\n * @dev Does not inherit ERC20 to accommodate usage by OFTAdapter as well.\r\n * @dev This specific interface ID is '0x02e49c2c'.\r\n */\r\ninterface IOFT {\r\n    // Custom error messages\r\n    error InvalidLocalDecimals();\r\n    error SlippageExceeded(uint256 amountLD, uint256 minAmountLD);\r\n\r\n    // Events\r\n    event OFTSent(\r\n        bytes32 indexed guid, // GUID of the OFT message.\r\n        uint32 dstEid, // Destination Endpoint ID.\r\n        address indexed fromAddress, // Address of the sender on the src chain.\r\n        uint256 amountSentLD, // Amount of tokens sent in local decimals.\r\n        uint256 amountReceivedLD // Amount of tokens received in local decimals.\r\n    );\r\n    event OFTReceived(\r\n        bytes32 indexed guid, // GUID of the OFT message.\r\n        uint32 srcEid, // Source Endpoint ID.\r\n        address indexed toAddress, // Address of the recipient on the dst chain.\r\n        uint256 amountReceivedLD // Amount of tokens received in local decimals.\r\n    );\r\n\r\n    /**\r\n     * @notice Retrieves interfaceID and the version of the OFT.\r\n     * @return interfaceId The interface ID.\r\n     * @return version The version.\r\n     *\r\n     * @dev interfaceId: This specific interface ID is '0x02e49c2c'.\r\n     * @dev version: Indicates a cross-chain compatible msg encoding with other OFTs.\r\n     * @dev If a new feature is added to the OFT cross-chain msg encoding, the version will be incremented.\r\n     * ie. localOFT version(x,1) CAN send messages to remoteOFT version(x,1)\r\n     */\r\n    function oftVersion() external view returns (bytes4 interfaceId, uint64 version);\r\n\r\n    /**\r\n     * @notice Retrieves the address of the token associated with the OFT.\r\n     * @return token The address of the ERC20 token implementation.\r\n     */\r\n    function token() external view returns (address);\r\n\r\n    /**\r\n     * @notice Indicates whether the OFT contract requires approval of the 'token()' to send.\r\n     * @return requiresApproval Needs approval of the underlying token implementation.\r\n     *\r\n     * @dev Allows things like wallet implementers to determine integration requirements,\r\n     * without understanding the underlying token implementation.\r\n     */\r\n    function approvalRequired() external view returns (bool);\r\n\r\n    /**\r\n     * @notice Retrieves the shared decimals of the OFT.\r\n     * @return sharedDecimals The shared decimals of the OFT.\r\n     */\r\n    function sharedDecimals() external view returns (uint8);\r\n\r\n    /**\r\n     * @notice Provides a quote for OFT-related operations.\r\n     * @param _sendParam The parameters for the send operation.\r\n     * @return limit The OFT limit information.\r\n     * @return oftFeeDetails The details of OFT fees.\r\n     * @return receipt The OFT receipt information.\r\n     */\r\n    function quoteOFT(\r\n        SendParam calldata _sendParam\r\n    ) external view returns (OFTLimit memory, OFTFeeDetail[] memory oftFeeDetails, OFTReceipt memory);\r\n\r\n    /**\r\n     * @notice Provides a quote for the send() operation.\r\n     * @param _sendParam The parameters for the send() operation.\r\n     * @param _payInLzToken Flag indicating whether the caller is paying in the LZ token.\r\n     * @return fee The calculated LayerZero messaging fee from the send() operation.\r\n     *\r\n     * @dev MessagingFee: LayerZero msg fee\r\n     *  - nativeFee: The native fee.\r\n     *  - lzTokenFee: The lzToken fee.\r\n     */\r\n    function quoteSend(SendParam calldata _sendParam, bool _payInLzToken) external view returns (MessagingFee memory);\r\n\r\n    /**\r\n     * @notice Executes the send() operation.\r\n     * @param _sendParam The parameters for the send operation.\r\n     * @param _fee The fee information supplied by the caller.\r\n     *      - nativeFee: The native fee.\r\n     *      - lzTokenFee: The lzToken fee.\r\n     * @param _refundAddress The address to receive any excess funds from fees etc. on the src.\r\n     * @return receipt The LayerZero messaging receipt from the send() operation.\r\n     * @return oftReceipt The OFT receipt information.\r\n     *\r\n     * @dev MessagingReceipt: LayerZero msg receipt\r\n     *  - guid: The unique identifier for the sent message.\r\n     *  - nonce: The nonce of the sent message.\r\n     *  - fee: The LayerZero fee incurred for the message.\r\n     */\r\n    function send(\r\n        SendParam calldata _sendParam,\r\n        MessagingFee calldata _fee,\r\n        address _refundAddress\r\n    ) external payable returns (MessagingReceipt memory, OFTReceipt memory);\r\n}\r\n\r\n// lib/LayerZero-v2/packages/layerzero-v2/evm/oapp/contracts/precrime/OAppPreCrimeSimulator.sol\r\n\r\n/**\r\n * @title OAppPreCrimeSimulator\r\n * @dev Abstract contract serving as the base for preCrime simulation functionality in an OApp.\r\n */\r\nabstract contract OAppPreCrimeSimulator is IOAppPreCrimeSimulator, Ownable {\r\n    // The address of the preCrime implementation.\r\n    address public preCrime;\r\n\r\n    /**\r\n     * @dev Retrieves the address of the OApp contract.\r\n     * @return The address of the OApp contract.\r\n     *\r\n     * @dev The simulator contract is the base contract for the OApp by default.\r\n     * @dev If the simulator is a separate contract, override this function.\r\n     */\r\n    function oApp() external view virtual returns (address) {\r\n        return address(this);\r\n    }\r\n\r\n    /**\r\n     * @dev Sets the preCrime contract address.\r\n     * @param _preCrime The address of the preCrime contract.\r\n     */\r\n    function setPreCrime(address _preCrime) public virtual onlyOwner {\r\n        preCrime = _preCrime;\r\n        emit PreCrimeSet(_preCrime);\r\n    }\r\n\r\n    /**\r\n     * @dev Interface for pre-crime simulations. Always reverts at the end with the simulation results.\r\n     * @param _packets An array of InboundPacket objects representing received packets to be delivered.\r\n     *\r\n     * @dev WARNING: MUST revert at the end with the simulation results.\r\n     * @dev Gives the preCrime implementation the ability to mock sending packets to the lzReceive function,\r\n     * WITHOUT actually executing them.\r\n     */\r\n    function lzReceiveAndRevert(InboundPacket[] calldata _packets) public payable virtual {\r\n        for (uint256 i = 0; i < _packets.length; i++) {\r\n            InboundPacket calldata packet = _packets[i];\r\n\r\n            // Ignore packets that are not from trusted peers.\r\n            if (!isPeer(packet.origin.srcEid, packet.origin.sender)) continue;\r\n\r\n            // @dev Because a verifier is calling this function, it doesnt have access to executor params:\r\n            //  - address _executor\r\n            //  - bytes calldata _extraData\r\n            // preCrime will NOT work for OApps that rely on these two parameters inside of their _lzReceive().\r\n            // They are instead stubbed to default values, address(0) and bytes(\"\")\r\n            // @dev Calling this.lzReceiveSimulate removes ability for assembly return 0 callstack exit,\r\n            // which would cause the revert to be ignored.\r\n            this.lzReceiveSimulate{ value: packet.value }(\r\n                packet.origin,\r\n                packet.guid,\r\n                packet.message,\r\n                packet.executor,\r\n                packet.extraData\r\n            );\r\n        }\r\n\r\n        // @dev Revert with the simulation results. msg.sender must implement IPreCrime.buildSimulationResult().\r\n        revert SimulationResult(IPreCrime(msg.sender).buildSimulationResult());\r\n    }\r\n\r\n    /**\r\n     * @dev Is effectively an internal function because msg.sender must be address(this).\r\n     * Allows resetting the call stack for 'internal' calls.\r\n     * @param _origin The origin information containing the source endpoint and sender address.\r\n     *  - srcEid: The source chain endpoint ID.\r\n     *  - sender: The sender address on the src chain.\r\n     *  - nonce: The nonce of the message.\r\n     * @param _guid The unique identifier of the packet.\r\n     * @param _message The message payload of the packet.\r\n     * @param _executor The executor address for the packet.\r\n     * @param _extraData Additional data for the packet.\r\n     */\r\n    function lzReceiveSimulate(\r\n        Origin calldata _origin,\r\n        bytes32 _guid,\r\n        bytes calldata _message,\r\n        address _executor,\r\n        bytes calldata _extraData\r\n    ) external payable virtual {\r\n        // @dev Ensure ONLY can be called 'internally'.\r\n        if (msg.sender != address(this)) revert OnlySelf();\r\n        _lzReceiveSimulate(_origin, _guid, _message, _executor, _extraData);\r\n    }\r\n\r\n    /**\r\n     * @dev Internal function to handle the OAppPreCrimeSimulator simulated receive.\r\n     * @param _origin The origin information.\r\n     *  - srcEid: The source chain endpoint ID.\r\n     *  - sender: The sender address from the src chain.\r\n     *  - nonce: The nonce of the LayerZero message.\r\n     * @param _guid The GUID of the LayerZero message.\r\n     * @param _message The LayerZero message.\r\n     * @param _executor The address of the off-chain executor.\r\n     * @param _extraData Arbitrary data passed by the msg executor.\r\n     *\r\n     * @dev Enables the preCrime simulator to mock sending lzReceive() messages,\r\n     * routes the msg down from the OAppPreCrimeSimulator, and back up to the OAppReceiver.\r\n     */\r\n    function _lzReceiveSimulate(\r\n        Origin calldata _origin,\r\n        bytes32 _guid,\r\n        bytes calldata _message,\r\n        address _executor,\r\n        bytes calldata _extraData\r\n    ) internal virtual;\r\n\r\n    /**\r\n     * @dev checks if the specified peer is considered 'trusted' by the OApp.\r\n     * @param _eid The endpoint Id to check.\r\n     * @param _peer The peer to check.\r\n     * @return Whether the peer passed is considered 'trusted' by the OApp.\r\n     */\r\n    function isPeer(uint32 _eid, bytes32 _peer) public view virtual returns (bool);\r\n}\r\n\r\n// lib/LayerZero-v2/packages/layerzero-v2/evm/oapp/contracts/oapp/OApp.sol\r\n\r\n// @dev Import the 'MessagingFee' and 'MessagingReceipt' so it's exposed to OApp implementers\r\n// solhint-disable-next-line no-unused-import\r\n\r\n// @dev Import the 'Origin' so it's exposed to OApp implementers\r\n// solhint-disable-next-line no-unused-import\r\n\r\n/**\r\n * @title OApp\r\n * @dev Abstract contract serving as the base for OApp implementation, combining OAppSender and OAppReceiver functionality.\r\n */\r\nabstract contract OApp is OAppSender, OAppReceiver {\r\n    /**\r\n     * @dev Constructor to initialize the OApp with the provided endpoint and owner.\r\n     * @param _endpoint The address of the LOCAL LayerZero endpoint.\r\n     * @param _delegate The delegate capable of making OApp configurations inside of the endpoint.\r\n     */\r\n    constructor(address _endpoint, address _delegate) OAppCore(_endpoint, _delegate) {}\r\n\r\n    /**\r\n     * @notice Retrieves the OApp version information.\r\n     * @return senderVersion The version of the OAppSender.sol implementation.\r\n     * @return receiverVersion The version of the OAppReceiver.sol implementation.\r\n     */\r\n    function oAppVersion()\r\n        public\r\n        pure\r\n        virtual\r\n        override(OAppSender, OAppReceiver)\r\n        returns (uint64 senderVersion, uint64 receiverVersion)\r\n    {\r\n        return (SENDER_VERSION, RECEIVER_VERSION);\r\n    }\r\n}\r\n\r\n// lib/LayerZero-v2/packages/layerzero-v2/evm/oapp/contracts/oft/OFTCore.sol\r\n\r\n/**\r\n * @title OFTCore\r\n * @dev Abstract contract for the OftChain (OFT) token.\r\n */\r\nabstract contract OFTCore is IOFT, OApp, OAppPreCrimeSimulator, OAppOptionsType3 {\r\n    using OFTMsgCodec for bytes;\r\n    using OFTMsgCodec for bytes32;\r\n\r\n    // @notice Provides a conversion rate when swapping between denominations of SD and LD\r\n    //      - shareDecimals == SD == shared Decimals\r\n    //      - localDecimals == LD == local decimals\r\n    // @dev Considers that tokens have different decimal amounts on various chains.\r\n    // @dev eg.\r\n    //  For a token\r\n    //      - locally with 4 decimals --> 1.2345 => uint(12345)\r\n    //      - remotely with 2 decimals --> 1.23 => uint(123)\r\n    //      - The conversion rate would be 10 ** (4 - 2) = 100\r\n    //  @dev If you want to send 1.2345 -> (uint 12345), you CANNOT represent that value on the remote,\r\n    //  you can only display 1.23 -> uint(123).\r\n    //  @dev To preserve the dust that would otherwise be lost on that conversion,\r\n    //  we need to unify a denomination that can be represented on ALL chains inside of the OFT mesh\r\n    uint256 public immutable decimalConversionRate;\r\n\r\n    // @notice Msg types that are used to identify the various OFT operations.\r\n    // @dev This can be extended in child contracts for non-default oft operations\r\n    // @dev These values are used in things like combineOptions() in OAppOptionsType3.sol.\r\n    uint16 public constant SEND = 1;\r\n    uint16 public constant SEND_AND_CALL = 2;\r\n\r\n    // Address of an optional contract to inspect both 'message' and 'options'\r\n    address public msgInspector;\r\n    event MsgInspectorSet(address inspector);\r\n\r\n    /**\r\n     * @dev Constructor.\r\n     * @param _localDecimals The decimals of the token on the local chain (this chain).\r\n     * @param _endpoint The address of the LayerZero endpoint.\r\n     * @param _delegate The delegate capable of making OApp configurations inside of the endpoint.\r\n     */\r\n    constructor(uint8 _localDecimals, address _endpoint, address _delegate) OApp(_endpoint, _delegate) {\r\n        if (_localDecimals < sharedDecimals()) revert InvalidLocalDecimals();\r\n        decimalConversionRate = 10 ** (_localDecimals - sharedDecimals());\r\n    }\r\n\r\n    /**\r\n     * @dev Retrieves the shared decimals of the OFT.\r\n     * @return The shared decimals of the OFT.\r\n     *\r\n     * @dev Sets an implicit cap on the amount of tokens, over uint64.max() will need some sort of outbound cap / totalSupply cap\r\n     * Lowest common decimal denominator between chains.\r\n     * Defaults to 6 decimal places to provide up to 18,446,744,073,709.551615 units (max uint64).\r\n     * For tokens exceeding this totalSupply(), they will need to override the sharedDecimals function with something smaller.\r\n     * ie. 4 sharedDecimals would be 1,844,674,407,370,955.1615\r\n     */\r\n    function sharedDecimals() public pure virtual returns (uint8) {\r\n        return 6;\r\n    }\r\n\r\n    /**\r\n     * @dev Sets the message inspector address for the OFT.\r\n     * @param _msgInspector The address of the message inspector.\r\n     *\r\n     * @dev This is an optional contract that can be used to inspect both 'message' and 'options'.\r\n     * @dev Set it to address(0) to disable it, or set it to a contract address to enable it.\r\n     */\r\n    function setMsgInspector(address _msgInspector) public virtual onlyOwner {\r\n        msgInspector = _msgInspector;\r\n        emit MsgInspectorSet(_msgInspector);\r\n    }\r\n\r\n    /**\r\n     * @notice Provides a quote for OFT-related operations.\r\n     * @param _sendParam The parameters for the send operation.\r\n     * @return oftLimit The OFT limit information.\r\n     * @return oftFeeDetails The details of OFT fees.\r\n     * @return oftReceipt The OFT receipt information.\r\n     */\r\n    function quoteOFT(\r\n        SendParam calldata _sendParam\r\n    )\r\n        external\r\n        view\r\n        virtual\r\n        returns (OFTLimit memory oftLimit, OFTFeeDetail[] memory oftFeeDetails, OFTReceipt memory oftReceipt)\r\n    {\r\n        uint256 minAmountLD = 0; // Unused in the default implementation.\r\n        uint256 maxAmountLD = type(uint64).max; // Unused in the default implementation.\r\n        oftLimit = OFTLimit(minAmountLD, maxAmountLD);\r\n\r\n        // Unused in the default implementation; reserved for future complex fee details.\r\n        oftFeeDetails = new OFTFeeDetail[](0);\r\n\r\n        // @dev This is the same as the send() operation, but without the actual send.\r\n        // - amountSentLD is the amount in local decimals that would be sent from the sender.\r\n        // - amountReceivedLD is the amount in local decimals that will be credited to the recipient on the remote OFT instance.\r\n        // @dev The amountSentLD MIGHT not equal the amount the user actually receives. HOWEVER, the default does.\r\n        (uint256 amountSentLD, uint256 amountReceivedLD) = _debitView(\r\n            _sendParam.amountLD,\r\n            _sendParam.minAmountLD,\r\n            _sendParam.dstEid\r\n        );\r\n        oftReceipt = OFTReceipt(amountSentLD, amountReceivedLD);\r\n    }\r\n\r\n    /**\r\n     * @notice Provides a quote for the send() operation.\r\n     * @param _sendParam The parameters for the send() operation.\r\n     * @param _payInLzToken Flag indicating whether the caller is paying in the LZ token.\r\n     * @return msgFee The calculated LayerZero messaging fee from the send() operation.\r\n     *\r\n     * @dev MessagingFee: LayerZero msg fee\r\n     *  - nativeFee: The native fee.\r\n     *  - lzTokenFee: The lzToken fee.\r\n     */\r\n    function quoteSend(\r\n        SendParam calldata _sendParam,\r\n        bool _payInLzToken\r\n    ) external view virtual returns (MessagingFee memory msgFee) {\r\n        // @dev mock the amount to receive, this is the same operation used in the send().\r\n        // The quote is as similar as possible to the actual send() operation.\r\n        (, uint256 amountReceivedLD) = _debitView(_sendParam.amountLD, _sendParam.minAmountLD, _sendParam.dstEid);\r\n\r\n        // @dev Builds the options and OFT message to quote in the endpoint.\r\n        (bytes memory message, bytes memory options) = _buildMsgAndOptions(_sendParam, amountReceivedLD);\r\n\r\n        // @dev Calculates the LayerZero fee for the send() operation.\r\n        return _quote(_sendParam.dstEid, message, options, _payInLzToken);\r\n    }\r\n\r\n    /**\r\n     * @dev Executes the send operation.\r\n     * @param _sendParam The parameters for the send operation.\r\n     * @param _fee The calculated fee for the send() operation.\r\n     *      - nativeFee: The native fee.\r\n     *      - lzTokenFee: The lzToken fee.\r\n     * @param _refundAddress The address to receive any excess funds.\r\n     * @return msgReceipt The receipt for the send operation.\r\n     * @return oftReceipt The OFT receipt information.\r\n     *\r\n     * @dev MessagingReceipt: LayerZero msg receipt\r\n     *  - guid: The unique identifier for the sent message.\r\n     *  - nonce: The nonce of the sent message.\r\n     *  - fee: The LayerZero fee incurred for the message.\r\n     */\r\n    function send(\r\n        SendParam calldata _sendParam,\r\n        MessagingFee calldata _fee,\r\n        address _refundAddress\r\n    ) external payable virtual returns (MessagingReceipt memory msgReceipt, OFTReceipt memory oftReceipt) {\r\n        // @dev Applies the token transfers regarding this send() operation.\r\n        // - amountSentLD is the amount in local decimals that was ACTUALLY sent/debited from the sender.\r\n        // - amountReceivedLD is the amount in local decimals that will be received/credited to the recipient on the remote OFT instance.\r\n        (uint256 amountSentLD, uint256 amountReceivedLD) = _debit(\r\n            _sendParam.amountLD,\r\n            _sendParam.minAmountLD,\r\n            _sendParam.dstEid\r\n        );\r\n\r\n        // @dev Builds the options and OFT message to quote in the endpoint.\r\n        (bytes memory message, bytes memory options) = _buildMsgAndOptions(_sendParam, amountReceivedLD);\r\n\r\n        // @dev Sends the message to the LayerZero endpoint and returns the LayerZero msg receipt.\r\n        msgReceipt = _lzSend(_sendParam.dstEid, message, options, _fee, _refundAddress);\r\n        // @dev Formulate the OFT receipt.\r\n        oftReceipt = OFTReceipt(amountSentLD, amountReceivedLD);\r\n\r\n        emit OFTSent(msgReceipt.guid, _sendParam.dstEid, msg.sender, amountSentLD, amountReceivedLD);\r\n    }\r\n\r\n    /**\r\n     * @dev Internal function to build the message and options.\r\n     * @param _sendParam The parameters for the send() operation.\r\n     * @param _amountLD The amount in local decimals.\r\n     * @return message The encoded message.\r\n     * @return options The encoded options.\r\n     */\r\n    function _buildMsgAndOptions(\r\n        SendParam calldata _sendParam,\r\n        uint256 _amountLD\r\n    ) internal view virtual returns (bytes memory message, bytes memory options) {\r\n        bool hasCompose;\r\n        // @dev This generated message has the msg.sender encoded into the payload so the remote knows who the caller is.\r\n        (message, hasCompose) = OFTMsgCodec.encode(\r\n            _sendParam.to,\r\n            _toSD(_amountLD),\r\n            // @dev Must be include a non empty bytes if you want to compose, EVEN if you dont need it on the remote.\r\n            // EVEN if you dont require an arbitrary payload to be sent... eg. '0x01'\r\n            _sendParam.composeMsg\r\n        );\r\n        // @dev Change the msg type depending if its composed or not.\r\n        uint16 msgType = hasCompose ? SEND_AND_CALL : SEND;\r\n        // @dev Combine the callers _extraOptions with the enforced options via the OAppOptionsType3.\r\n        options = combineOptions(_sendParam.dstEid, msgType, _sendParam.extraOptions);\r\n\r\n        // @dev Optionally inspect the message and options depending if the OApp owner has set a msg inspector.\r\n        // @dev If it fails inspection, needs to revert in the implementation. ie. does not rely on return boolean\r\n        if (msgInspector != address(0)) IOAppMsgInspector(msgInspector).inspect(message, options);\r\n    }\r\n\r\n    /**\r\n     * @dev Internal function to handle the receive on the LayerZero endpoint.\r\n     * @param _origin The origin information.\r\n     *  - srcEid: The source chain endpoint ID.\r\n     *  - sender: The sender address from the src chain.\r\n     *  - nonce: The nonce of the LayerZero message.\r\n     * @param _guid The unique identifier for the received LayerZero message.\r\n     * @param _message The encoded message.\r\n     * @dev _executor The address of the executor.\r\n     * @dev _extraData Additional data.\r\n     */\r\n    function _lzReceive(\r\n        Origin calldata _origin,\r\n        bytes32 _guid,\r\n        bytes calldata _message,\r\n        address /*_executor*/, // @dev unused in the default implementation.\r\n        bytes calldata /*_extraData*/ // @dev unused in the default implementation.\r\n    ) internal virtual override {\r\n        // @dev The src sending chain doesnt know the address length on this chain (potentially non-evm)\r\n        // Thus everything is bytes32() encoded in flight.\r\n        address toAddress = _message.sendTo().bytes32ToAddress();\r\n        // @dev Credit the amountLD to the recipient and return the ACTUAL amount the recipient received in local decimals\r\n        uint256 amountReceivedLD = _credit(toAddress, _toLD(_message.amountSD()), _origin.srcEid);\r\n\r\n        if (_message.isComposed()) {\r\n            // @dev Proprietary composeMsg format for the OFT.\r\n            bytes memory composeMsg = OFTComposeMsgCodec.encode(\r\n                _origin.nonce,\r\n                _origin.srcEid,\r\n                amountReceivedLD,\r\n                _message.composeMsg()\r\n            );\r\n\r\n            // @dev Stores the lzCompose payload that will be executed in a separate tx.\r\n            // Standardizes functionality for executing arbitrary contract invocation on some non-evm chains.\r\n            // @dev The off-chain executor will listen and process the msg based on the src-chain-callers compose options passed.\r\n            // @dev The index is used when a OApp needs to compose multiple msgs on lzReceive.\r\n            // For default OFT implementation there is only 1 compose msg per lzReceive, thus its always 0.\r\n            endpoint.sendCompose(toAddress, _guid, 0 /* the index of the composed message*/, composeMsg);\r\n        }\r\n\r\n        emit OFTReceived(_guid, _origin.srcEid, toAddress, amountReceivedLD);\r\n    }\r\n\r\n    /**\r\n     * @dev Internal function to handle the OAppPreCrimeSimulator simulated receive.\r\n     * @param _origin The origin information.\r\n     *  - srcEid: The source chain endpoint ID.\r\n     *  - sender: The sender address from the src chain.\r\n     *  - nonce: The nonce of the LayerZero message.\r\n     * @param _guid The unique identifier for the received LayerZero message.\r\n     * @param _message The LayerZero message.\r\n     * @param _executor The address of the off-chain executor.\r\n     * @param _extraData Arbitrary data passed by the msg executor.\r\n     *\r\n     * @dev Enables the preCrime simulator to mock sending lzReceive() messages,\r\n     * routes the msg down from the OAppPreCrimeSimulator, and back up to the OAppReceiver.\r\n     */\r\n    function _lzReceiveSimulate(\r\n        Origin calldata _origin,\r\n        bytes32 _guid,\r\n        bytes calldata _message,\r\n        address _executor,\r\n        bytes calldata _extraData\r\n    ) internal virtual override {\r\n        _lzReceive(_origin, _guid, _message, _executor, _extraData);\r\n    }\r\n\r\n    /**\r\n     * @dev Check if the peer is considered 'trusted' by the OApp.\r\n     * @param _eid The endpoint ID to check.\r\n     * @param _peer The peer to check.\r\n     * @return Whether the peer passed is considered 'trusted' by the OApp.\r\n     *\r\n     * @dev Enables OAppPreCrimeSimulator to check whether a potential Inbound Packet is from a trusted source.\r\n     */\r\n    function isPeer(uint32 _eid, bytes32 _peer) public view virtual override returns (bool) {\r\n        return peers[_eid] == _peer;\r\n    }\r\n\r\n    /**\r\n     * @dev Internal function to remove dust from the given local decimal amount.\r\n     * @param _amountLD The amount in local decimals.\r\n     * @return amountLD The amount after removing dust.\r\n     *\r\n     * @dev Prevents the loss of dust when moving amounts between chains with different decimals.\r\n     * @dev eg. uint(123) with a conversion rate of 100 becomes uint(100).\r\n     */\r\n    function _removeDust(uint256 _amountLD) internal view virtual returns (uint256 amountLD) {\r\n        return (_amountLD / decimalConversionRate) * decimalConversionRate;\r\n    }\r\n\r\n    /**\r\n     * @dev Internal function to convert an amount from shared decimals into local decimals.\r\n     * @param _amountSD The amount in shared decimals.\r\n     * @return amountLD The amount in local decimals.\r\n     */\r\n    function _toLD(uint64 _amountSD) internal view virtual returns (uint256 amountLD) {\r\n        return _amountSD * decimalConversionRate;\r\n    }\r\n\r\n    /**\r\n     * @dev Internal function to convert an amount from local decimals into shared decimals.\r\n     * @param _amountLD The amount in local decimals.\r\n     * @return amountSD The amount in shared decimals.\r\n     */\r\n    function _toSD(uint256 _amountLD) internal view virtual returns (uint64 amountSD) {\r\n        return uint64(_amountLD / decimalConversionRate);\r\n    }\r\n\r\n    /**\r\n     * @dev Internal function to mock the amount mutation from a OFT debit() operation.\r\n     * @param _amountLD The amount to send in local decimals.\r\n     * @param _minAmountLD The minimum amount to send in local decimals.\r\n     * @dev _dstEid The destination endpoint ID.\r\n     * @return amountSentLD The amount sent, in local decimals.\r\n     * @return amountReceivedLD The amount to be received on the remote chain, in local decimals.\r\n     *\r\n     * @dev This is where things like fees would be calculated and deducted from the amount to be received on the remote.\r\n     */\r\n    function _debitView(\r\n        uint256 _amountLD,\r\n        uint256 _minAmountLD,\r\n        uint32 /*_dstEid*/\r\n    ) internal view virtual returns (uint256 amountSentLD, uint256 amountReceivedLD) {\r\n        // @dev Remove the dust so nothing is lost on the conversion between chains with different decimals for the token.\r\n        amountSentLD = _removeDust(_amountLD);\r\n        // @dev The amount to send is the same as amount received in the default implementation.\r\n        amountReceivedLD = amountSentLD;\r\n\r\n        // @dev Check for slippage.\r\n        if (amountReceivedLD < _minAmountLD) {\r\n            revert SlippageExceeded(amountReceivedLD, _minAmountLD);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * @dev Internal function to perform a debit operation.\r\n     * @param _amountLD The amount to send in local decimals.\r\n     * @param _minAmountLD The minimum amount to send in local decimals.\r\n     * @param _dstEid The destination endpoint ID.\r\n     * @return amountSentLD The amount sent in local decimals.\r\n     * @return amountReceivedLD The amount received in local decimals on the remote.\r\n     *\r\n     * @dev Defined here but are intended to be overriden depending on the OFT implementation.\r\n     * @dev Depending on OFT implementation the _amountLD could differ from the amountReceivedLD.\r\n     */\r\n    function _debit(\r\n        uint256 _amountLD,\r\n        uint256 _minAmountLD,\r\n        uint32 _dstEid\r\n    ) internal virtual returns (uint256 amountSentLD, uint256 amountReceivedLD);\r\n\r\n    /**\r\n     * @dev Internal function to perform a credit operation.\r\n     * @param _to The address to credit.\r\n     * @param _amountLD The amount to credit in local decimals.\r\n     * @param _srcEid The source endpoint ID.\r\n     * @return amountReceivedLD The amount ACTUALLY received in local decimals.\r\n     *\r\n     * @dev Defined here but are intended to be overriden depending on the OFT implementation.\r\n     * @dev Depending on OFT implementation the _amountLD could differ from the amountReceivedLD.\r\n     */\r\n    function _credit(\r\n        address _to,\r\n        uint256 _amountLD,\r\n        uint32 _srcEid\r\n    ) internal virtual returns (uint256 amountReceivedLD);\r\n}\r\n\r\n// lib/LayerZero-v2/packages/layerzero-v2/evm/oapp/contracts/oft/OFTAdapter.sol\r\n\r\n/**\r\n * @title OFTAdapter Contract\r\n * @dev OFTAdapter is a contract that adapts an ERC-20 token to the OFT functionality.\r\n *\r\n * @dev For existing ERC20 tokens, this can be used to convert the token to crosschain compatibility.\r\n * @dev WARNING: ONLY 1 of these should exist for a given global mesh,\r\n * unless you make a NON-default implementation of OFT and needs to be done very carefully.\r\n * @dev WARNING: The default OFTAdapter implementation assumes LOSSLESS transfers, ie. 1 token in, 1 token out.\r\n * IF the 'innerToken' applies something like a transfer fee, the default will NOT work...\r\n * a pre/post balance check will need to be done to calculate the amountSentLD/amountReceivedLD.\r\n */\r\nabstract contract OFTAdapter is OFTCore {\r\n    using SafeERC20 for IERC20;\r\n\r\n    IERC20 internal immutable innerToken;\r\n\r\n    /**\r\n     * @dev Constructor for the OFTAdapter contract.\r\n     * @param _token The address of the ERC-20 token to be adapted.\r\n     * @param _lzEndpoint The LayerZero endpoint address.\r\n     * @param _delegate The delegate capable of making OApp configurations inside of the endpoint.\r\n     */\r\n    constructor(\r\n        address _token,\r\n        address _lzEndpoint,\r\n        address _delegate\r\n    ) OFTCore(IERC20Metadata(_token).decimals(), _lzEndpoint, _delegate) {\r\n        innerToken = IERC20(_token);\r\n    }\r\n\r\n    /**\r\n     * @notice Retrieves interfaceID and the version of the OFT.\r\n     * @return interfaceId The interface ID.\r\n     * @return version The version.\r\n     *\r\n     * @dev interfaceId: This specific interface ID is '0x02e49c2c'.\r\n     * @dev version: Indicates a cross-chain compatible msg encoding with other OFTs.\r\n     * @dev If a new feature is added to the OFT cross-chain msg encoding, the version will be incremented.\r\n     * ie. localOFT version(x,1) CAN send messages to remoteOFT version(x,1)\r\n     */\r\n    function oftVersion() external pure virtual returns (bytes4 interfaceId, uint64 version) {\r\n        return (type(IOFT).interfaceId, 1);\r\n    }\r\n\r\n    /**\r\n     * @dev Retrieves the address of the underlying ERC20 implementation.\r\n     * @return The address of the adapted ERC-20 token.\r\n     *\r\n     * @dev In the case of OFTAdapter, address(this) and erc20 are NOT the same contract.\r\n     */\r\n    function token() external view returns (address) {\r\n        return address(innerToken);\r\n    }\r\n\r\n    /**\r\n     * @notice Indicates whether the OFT contract requires approval of the 'token()' to send.\r\n     * @return requiresApproval Needs approval of the underlying token implementation.\r\n     *\r\n     * @dev In the case of default OFTAdapter, approval is required.\r\n     * @dev In non-default OFTAdapter contracts with something like mint and burn privileges, it would NOT need approval.\r\n     */\r\n    function approvalRequired() external pure virtual returns (bool) {\r\n        return true;\r\n    }\r\n\r\n    /**\r\n     * @dev Burns tokens from the sender's specified balance, ie. pull method.\r\n     * @param _amountLD The amount of tokens to send in local decimals.\r\n     * @param _minAmountLD The minimum amount to send in local decimals.\r\n     * @param _dstEid The destination chain ID.\r\n     * @return amountSentLD The amount sent in local decimals.\r\n     * @return amountReceivedLD The amount received in local decimals on the remote.\r\n     *\r\n     * @dev msg.sender will need to approve this _amountLD of tokens to be locked inside of the contract.\r\n     * @dev WARNING: The default OFTAdapter implementation assumes LOSSLESS transfers, ie. 1 token in, 1 token out.\r\n     * IF the 'innerToken' applies something like a transfer fee, the default will NOT work...\r\n     * a pre/post balance check will need to be done to calculate the amountReceivedLD.\r\n     */\r\n    function _debit(\r\n        uint256 _amountLD,\r\n        uint256 _minAmountLD,\r\n        uint32 _dstEid\r\n    ) internal virtual override returns (uint256 amountSentLD, uint256 amountReceivedLD) {\r\n        (amountSentLD, amountReceivedLD) = _debitView(_amountLD, _minAmountLD, _dstEid);\r\n        // @dev Lock tokens by moving them into this contract from the caller.\r\n        innerToken.safeTransferFrom(msg.sender, address(this), amountSentLD);\r\n    }\r\n\r\n    /**\r\n     * @dev Credits tokens to the specified address.\r\n     * @param _to The address to credit the tokens to.\r\n     * @param _amountLD The amount of tokens to credit in local decimals.\r\n     * @dev _srcEid The source chain ID.\r\n     * @return amountReceivedLD The amount of tokens ACTUALLY received in local decimals.\r\n     *\r\n     * @dev WARNING: The default OFTAdapter implementation assumes LOSSLESS transfers, ie. 1 token in, 1 token out.\r\n     * IF the 'innerToken' applies something like a transfer fee, the default will NOT work...\r\n     * a pre/post balance check will need to be done to calculate the amountReceivedLD.\r\n     */\r\n    function _credit(\r\n        address _to,\r\n        uint256 _amountLD,\r\n        uint32 /*_srcEid*/\r\n    ) internal virtual override returns (uint256 amountReceivedLD) {\r\n        // @dev Unlock the tokens and transfer to the recipient.\r\n        innerToken.safeTransfer(_to, _amountLD);\r\n        // @dev In the case of NON-default OFTAdapter, the amountLD MIGHT not be == amountReceivedLD.\r\n        return _amountLD;\r\n    }\r\n}\r\n\r\n// src/Bridge/StoneBTCLayerZeroAdapter.sol\r\n\r\ncontract StoneBTCLayerZeroAdapter is OFTAdapter, AccessControl {\r\n    bytes32 public constant CAP_SETTER_ROLE = keccak256(\"CAP_SETTER_ROLE\");\r\n    uint256 public cap;\r\n    mapping(uint256 => uint256) public quota;\r\n\r\n    event capSet(uint256 beforeCap, uint256 afterCap);\r\n\r\n    constructor(\r\n        address _token,\r\n        address _lzEndpoint,\r\n        address _delegate,\r\n        uint256 _cap\r\n    ) OFTAdapter(_token, _lzEndpoint, _delegate) Ownable(_delegate) {\r\n        _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);\r\n        cap = _cap;\r\n        emit capSet(0, _cap);\r\n    }\r\n\r\n    function setCap(uint256 _cap) external onlyRole(CAP_SETTER_ROLE) {\r\n        emit capSet(cap, _cap);\r\n        cap = _cap;\r\n    }\r\n    \r\n    function getQuota() external view returns (uint256) {\r\n        uint256 amount = quota[block.timestamp / 1 days];\r\n        if (cap > amount) {\r\n            return cap - amount;\r\n        } else {\r\n            return 0;\r\n        }\r\n    }\r\n\r\n    function approvalRequired() external pure virtual override returns (bool) {\r\n        return false;\r\n    }\r\n\r\n    function _debit(\r\n        uint256 _amountLD,\r\n        uint256 _minAmountLD,\r\n        uint32 _dstEid\r\n    ) internal virtual override returns (uint256 amountSentLD, uint256 amountReceivedLD) {\r\n        (amountSentLD, amountReceivedLD) = _debitView(_amountLD, _minAmountLD, _dstEid);\r\n\r\n        uint256 day = block.timestamp / 1 days;\r\n        quota[day] = quota[day] + amountSentLD;\r\n        if(quota[day] > cap) revert ExceedCap();\r\n        \r\n        IStoneBTC(address(innerToken)).burn(msg.sender, amountSentLD);\r\n    }\r\n\r\n    function _credit(\r\n        address _to,\r\n        uint256 _amountLD,\r\n        uint32 /*_srcEid*/\r\n    ) internal virtual override returns (uint256 amountReceivedLD) {\r\n        IStoneBTC(address(innerToken)).mint(_to, _amountLD);\r\n        return _amountLD;\r\n    }\r\n}","creation_status":"success","file_path":"StoneBTCLayerZeroAdapter.sol"}