Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0x180FcF9C9F5ECB75de90395d54cd7c69B3902Fcd
Balance 0 ETH
Nonce 1
Code Size 11048 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

11048 bytes
0x6080604052600436106101ee5760003560e01c806382413eac1161010d578063bc70b354116100a0578063d045a0dc1161006f578063d045a0dc14610607578063d42438851461061a578063f2fde38b1461063a578063fc0c546a1461065a578063ff7bd03d1461068d57600080fd5b8063bc70b35414610593578063bd815db0146105b3578063c7c7f5b3146105c6578063ca5eb5e1146105e757600080fd5b80639f68b964116100dc5780639f68b96414610512578063b731ea0a14610526578063b98bd07014610546578063bb0b6a531461056657600080fd5b806382413eac14610476578063857749b0146104965780638da5cb5b146104b2578063963efcaa146104d057600080fd5b80633b6f743b116101855780635e280f11116101545780635e280f11146103d25780636fc1b31e14610406578063715018a6146104265780637d25a05e1461043b57600080fd5b80633b6f743b1461031e57806352ae28791461034b5780635535d4611461035e5780635a0dfe4d1461038b57600080fd5b8063156a0d0f116101c1578063156a0d0f146102a057806317442b70146102c75780631f5e1334146102e95780633400288b146102fe57600080fd5b80630d35b415146101f3578063111ecdad1461022b57806313137d6514610263578063134d4f2514610278575b600080fd5b3480156101ff57600080fd5b5061021361020e366004611c72565b6106ad565b60405161022293929190611cf6565b60405180910390f35b34801561023757600080fd5b5060045461024b906001600160a01b031681565b6040516001600160a01b039091168152602001610222565b610276610271366004611dfe565b61083e565b005b34801561028457600080fd5b5061028d600281565b60405161ffff9091168152602001610222565b3480156102ac57600080fd5b506040805162b9270b60e21b81526001602082015201610222565b3480156102d357600080fd5b5060408051600181526002602082015201610222565b3480156102f557600080fd5b5061028d600181565b34801561030a57600080fd5b50610276610319366004611eb6565b6108fe565b34801561032a57600080fd5b5061033e610339366004611eee565b610914565b6040516102229190611f3f565b34801561035757600080fd5b503061024b565b34801561036a57600080fd5b5061037e610379366004611f68565b61097d565b6040516102229190611f9b565b34801561039757600080fd5b506103c26103a6366004611eb6565b63ffffffff919091166000908152600160205260409020541490565b6040519015158152602001610222565b3480156103de57600080fd5b5061024b7f0000000000000000000000001a44076050125825900e736c501f859c50fe728c81565b34801561041257600080fd5b50610276610421366004611fae565b610a22565b34801561043257600080fd5b50610276610a7f565b34801561044757600080fd5b5061045e610456366004611eb6565b600092915050565b6040516001600160401b039091168152602001610222565b34801561048257600080fd5b506103c2610491366004611fcb565b610a93565b3480156104a257600080fd5b5060405160068152602001610222565b3480156104be57600080fd5b506000546001600160a01b031661024b565b3480156104dc57600080fd5b506105047f000000000000000000000000000000000000000000000000000000e8d4a5100081565b604051908152602001610222565b34801561051e57600080fd5b5060016103c2565b34801561053257600080fd5b5060025461024b906001600160a01b031681565b34801561055257600080fd5b50610276610561366004612075565b610aa8565b34801561057257600080fd5b506105046105813660046120b6565b60016020526000908152604090205481565b34801561059f57600080fd5b5061037e6105ae3660046120d1565b610ac2565b6102766105c1366004612075565b610c6a565b6105d96105d4366004612131565b610df4565b60405161022292919061219e565b3480156105f357600080fd5b50610276610602366004611fae565b610e28565b610276610615366004611dfe565b610eae565b34801561062657600080fd5b50610276610635366004611fae565b610edd565b34801561064657600080fd5b50610276610655366004611fae565b610f33565b34801561066657600080fd5b507f0000000000000000000000004737d9b4592b40d51e110b94c9c043c6654067ae61024b565b34801561069957600080fd5b506103c26106a83660046121f0565b610f71565b604080518082019091526000808252602082015260606106e0604051806040016040528060008152602001600081525090565b600080306001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610721573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610745919061220c565b6001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610782573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107a69190612229565b604080518082018252848152602080820184905282516000808252918101909352909750919250906107fb565b6040805180820190915260008152606060208201528152602001906001900390816107d35790505b509350600080610820604089013560608a013561081b60208c018c6120b6565b610fa7565b60408051808201909152918252602082015296989597505050505050565b7f0000000000000000000000001a44076050125825900e736c501f859c50fe728c6001600160a01b0316331461088e576040516391ac5e4f60e01b81523360048201526024015b60405180910390fd5b602087018035906108a8906108a3908a6120b6565b610fe3565b146108e6576108ba60208801886120b6565b60405163309afaf360e21b815263ffffffff909116600482015260208801356024820152604401610885565b6108f58787878787878761101f565b50505050505050565b610906611186565b61091082826111b3565b5050565b604080518082019091526000808252602082015260006109446040850135606086013561081b60208801886120b6565b9150506000806109548684611208565b909250905061097161096960208801886120b6565b83838861132b565b93505050505b92915050565b6003602090815260009283526040808420909152908252902080546109a190612258565b80601f01602080910402602001604051908101604052809291908181526020018280546109cd90612258565b8015610a1a5780601f106109ef57610100808354040283529160200191610a1a565b820191906000526020600020905b8154815290600101906020018083116109fd57829003601f168201915b505050505081565b610a2a611186565b600480546001600160a01b0319166001600160a01b0383169081179091556040519081527ff0be4f1e87349231d80c36b33f9e8639658eeaf474014dee15a3e6a4d4414197906020015b60405180910390a150565b610a87611186565b610a91600061140c565b565b6001600160a01b03811630145b949350505050565b610ab0611186565b610910610abd828461232d565b61145c565b63ffffffff8416600090815260036020908152604080832061ffff87168452909152812080546060929190610af690612258565b80601f0160208091040260200160405190810160405280929190818152602001828054610b2290612258565b8015610b6f5780601f10610b4457610100808354040283529160200191610b6f565b820191906000526020600020905b815481529060010190602001808311610b5257829003601f168201915b505050505090508051600003610bbf5783838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929450610aa09350505050565b6000839003610bcf579050610aa0565b60028310610c4d57610c1684848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061156392505050565b80610c248460028188612442565b604051602001610c369392919061246c565b604051602081830303815290604052915050610aa0565b8383604051639a6d49cd60e01b81526004016108859291906124bd565b60005b81811015610d735736838383818110610c8857610c886124d1565b9050602002810190610c9a91906124e7565b9050610ccd610cac60208301836120b6565b602083013563ffffffff919091166000908152600160205260409020541490565b610cd75750610d6b565b3063d045a0dc60c08301358360a0810135610cf6610100830183612508565b610d07610100890160e08a01611fae565b610d156101208a018a612508565b6040518963ffffffff1660e01b8152600401610d379796959493929190612563565b6000604051808303818588803b158015610d5057600080fd5b505af1158015610d64573d6000803e3d6000fd5b5050505050505b600101610c6d565b50336001600160a01b0316638e9e70996040518163ffffffff1660e01b8152600401600060405180830381865afa158015610db2573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610dda91908101906125e9565b604051638351eea760e01b81526004016108859190611f9b565b610dfc611c13565b6040805180820190915260008082526020820152610e1b85858561158f565b915091505b935093915050565b610e30611186565b60405163ca5eb5e160e01b81526001600160a01b0382811660048301527f0000000000000000000000001a44076050125825900e736c501f859c50fe728c169063ca5eb5e190602401600060405180830381600087803b158015610e9357600080fd5b505af1158015610ea7573d6000803e3d6000fd5b5050505050565b333014610ece5760405163029a949d60e31b815260040160405180910390fd5b6108f5878787878787876108e6565b610ee5611186565b600280546001600160a01b0319166001600160a01b0383169081179091556040519081527fd48d879cef83a1c0bdda516f27b13ddb1b3f8bbac1c9e1511bb2a659c242776090602001610a74565b610f3b611186565b6001600160a01b038116610f6557604051631e4fbdf760e01b815260006004820152602401610885565b610f6e8161140c565b50565b6000602082018035906001908390610f8990866120b6565b63ffffffff1681526020810191909152604001600020541492915050565b600080610fb38561168a565b915081905083811015610e20576040516371c4efed60e01b81526004810182905260248101859052604401610885565b63ffffffff8116600090815260016020526040812054806109775760405163f6ff4fb760e01b815263ffffffff84166004820152602401610885565b600061103161102e87876116c1565b90565b9050600061105d8261104b6110468a8a6116e0565b611703565b61105860208d018d6120b6565b611738565b9050602886111561112457600061109a61107d60608c0160408d01612656565b61108a60208d018d6120b6565b846110958c8c611776565b6117c1565b604051633e5ac80960e11b81529091506001600160a01b037f0000000000000000000000001a44076050125825900e736c501f859c50fe728c1690637cb59012906110f09086908d906000908790600401612673565b600060405180830381600087803b15801561110a57600080fd5b505af115801561111e573d6000803e3d6000fd5b50505050505b6001600160a01b038216887fefed6d3500546b29533b128a29e3a94d70788727f0507505ac12eaf2e578fd9c61115d60208d018d6120b6565b6040805163ffffffff9092168252602082018690520160405180910390a3505050505050505050565b6000546001600160a01b03163314610a915760405163118cdaa760e01b8152336004820152602401610885565b63ffffffff8216600081815260016020908152604091829020849055815192835282018390527f238399d427b947898edb290f5ff0f9109849b1c3ba196a42e35f00c50a54b98b910160405180910390a15050565b6060806000611265856020013561121e866117f3565b61122b60a0890189612508565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061181f92505050565b909350905060008161127857600161127b565b60025b905061129b61128d60208801886120b6565b826105ae60808a018a612508565b6004549093506001600160a01b031680156113215760405163043a78eb60e01b81526001600160a01b0382169063043a78eb906112de90889088906004016126ae565b602060405180830381865afa1580156112fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061131f91906126d3565b505b5050509250929050565b60408051808201909152600080825260208201527f0000000000000000000000001a44076050125825900e736c501f859c50fe728c6001600160a01b031663ddc28c586040518060a001604052808863ffffffff16815260200161138e89610fe3565b8152602001878152602001868152602001851515815250306040518363ffffffff1660e01b81526004016113c39291906126f0565b6040805180830381865afa1580156113df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114039190612799565b95945050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60005b81518110156115335761148e82828151811061147d5761147d6124d1565b602002602001015160400151611563565b8181815181106114a0576114a06124d1565b602002602001015160400151600360008484815181106114c2576114c26124d1565b60200260200101516000015163ffffffff1663ffffffff16815260200190815260200160002060008484815181106114fc576114fc6124d1565b60200260200101516020015161ffff1661ffff168152602001908152602001600020908161152a9190612805565b5060010161145f565b507fbe4864a8e820971c0247f5992e2da559595f7bf076a21cb5928d443d2a13b67481604051610a7491906128c4565b600281015161ffff81166003146109105781604051639a6d49cd60e01b81526004016108859190611f9b565b611597611c13565b60408051808201909152600080825260208201526000806115ce33604089013560608a01356115c960208c018c6120b6565b611899565b915091506000806115df8984611208565b909250905061160b6115f460208b018b6120b6565b8383611605368d90038d018d61294f565b8b6118ea565b60408051808201909152858152602080820186905282519298509096503391907f85496b760a4b7f8d66384b9df21b381f5d1b1e79f229a47aaf4c232edc2fe59a90611659908d018d6120b6565b6040805163ffffffff909216825260208201899052810187905260600160405180910390a350505050935093915050565b60007f000000000000000000000000000000000000000000000000000000e8d4a510006116b78184612981565b61097791906129a3565b60006116d06020828486612442565b6116d9916129c8565b9392505050565b60006116f0602860208486612442565b6116f9916129e6565b60c01c9392505050565b60006109777f000000000000000000000000000000000000000000000000000000e8d4a510006001600160401b0384166129a3565b600061176e6001600160a01b037f0000000000000000000000004737d9b4592b40d51e110b94c9c043c6654067ae1685856119f5565b509092915050565b60606117858260288186612442565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929695505050505050565b6060848484846040516020016117da9493929190612a16565b6040516020818303038152906040529050949350505050565b60006109777f000000000000000000000000000000000000000000000000000000e8d4a5100083612981565b805160609015158061186857848460405160200161185492919091825260c01b6001600160c01b031916602082015260280190565b60405160208183030381529060405261188f565b8484338560405160200161187f9493929190612a65565b6040516020818303038152906040525b9150935093915050565b6000806118a7858585610fa7565b90925090506118e16001600160a01b037f0000000000000000000000004737d9b4592b40d51e110b94c9c043c6654067ae16873085611a59565b94509492505050565b6118f2611c13565b60006119018460000151611a98565b60208501519091501561191b5761191b8460200151611ac0565b7f0000000000000000000000001a44076050125825900e736c501f859c50fe728c6001600160a01b0316632637a450826040518060a001604052808b63ffffffff16815260200161196b8c610fe3565b81526020018a815260200189815260200160008960200151111515815250866040518463ffffffff1660e01b81526004016119a79291906126f0565b60806040518083038185885af11580156119c5573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906119ea9190612aa8565b979650505050505050565b6040516001600160a01b03838116602483015260448201839052611a5491859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050611ba2565b505050565b6040516001600160a01b038481166024830152838116604483015260648201839052611a929186918216906323b872dd90608401611a22565b50505050565b6000813414611abc576040516304fb820960e51b8152346004820152602401610885565b5090565b60007f0000000000000000000000001a44076050125825900e736c501f859c50fe728c6001600160a01b031663e4fe1d946040518163ffffffff1660e01b8152600401602060405180830381865afa158015611b20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b44919061220c565b90506001600160a01b038116611b6d576040516329b99a9560e11b815260040160405180910390fd5b6109106001600160a01b038216337f0000000000000000000000001a44076050125825900e736c501f859c50fe728c85611a59565b600080602060008451602086016000885af180611bc5576040513d6000823e3d81fd5b50506000513d91508115611bdd578060011415611bea565b6001600160a01b0384163b155b15611a9257604051635274afe760e01b81526001600160a01b0385166004820152602401610885565b60405180606001604052806000801916815260200160006001600160401b03168152602001611c55604051806040016040528060008152602001600081525090565b905290565b600060e08284031215611c6c57600080fd5b50919050565b600060208284031215611c8457600080fd5b81356001600160401b03811115611c9a57600080fd5b610aa084828501611c5a565b60005b83811015611cc1578181015183820152602001611ca9565b50506000910152565b60008151808452611ce2816020860160208601611ca6565b601f01601f19169290920160200192915050565b8351815260208085015190820152600060a08201604060a0604085015281865180845260c08601915060c08160051b8701019350602080890160005b83811015611d715788870360bf19018552815180518852830151838801879052611d5e87890182611cca565b9750509382019390820190600101611d32565b50508751606088015250505060208501516080850152509050610aa0565b600060608284031215611c6c57600080fd5b60008083601f840112611db357600080fd5b5081356001600160401b03811115611dca57600080fd5b602083019150836020828501011115611de257600080fd5b9250929050565b6001600160a01b0381168114610f6e57600080fd5b600080600080600080600060e0888a031215611e1957600080fd5b611e238989611d8f565b96506060880135955060808801356001600160401b0380821115611e4657600080fd5b611e528b838c01611da1565b909750955060a08a01359150611e6782611de9565b90935060c08901359080821115611e7d57600080fd5b50611e8a8a828b01611da1565b989b979a50959850939692959293505050565b803563ffffffff81168114611eb157600080fd5b919050565b60008060408385031215611ec957600080fd5b611ed283611e9d565b946020939093013593505050565b8015158114610f6e57600080fd5b60008060408385031215611f0157600080fd5b82356001600160401b03811115611f1757600080fd5b611f2385828601611c5a565b9250506020830135611f3481611ee0565b809150509250929050565b815181526020808301519082015260408101610977565b803561ffff81168114611eb157600080fd5b60008060408385031215611f7b57600080fd5b611f8483611e9d565b9150611f9260208401611f56565b90509250929050565b6020815260006116d96020830184611cca565b600060208284031215611fc057600080fd5b81356116d981611de9565b60008060008060a08587031215611fe157600080fd5b611feb8686611d8f565b935060608501356001600160401b0381111561200657600080fd5b61201287828801611da1565b909450925050608085013561202681611de9565b939692955090935050565b60008083601f84011261204357600080fd5b5081356001600160401b0381111561205a57600080fd5b6020830191508360208260051b8501011115611de257600080fd5b6000806020838503121561208857600080fd5b82356001600160401b0381111561209e57600080fd5b6120aa85828601612031565b90969095509350505050565b6000602082840312156120c857600080fd5b6116d982611e9d565b600080600080606085870312156120e757600080fd5b6120f085611e9d565b93506120fe60208601611f56565b925060408501356001600160401b0381111561211957600080fd5b61212587828801611da1565b95989497509550505050565b6000806000838503608081121561214757600080fd5b84356001600160401b0381111561215d57600080fd5b61216987828801611c5a565b9450506040601f198201121561217e57600080fd5b50602084019150606084013561219381611de9565b809150509250925092565b600060c082019050835182526001600160401b03602085015116602083015260408401516121d9604084018280518252602090810151910152565b5082516080830152602083015160a08301526116d9565b60006060828403121561220257600080fd5b6116d98383611d8f565b60006020828403121561221e57600080fd5b81516116d981611de9565b60006020828403121561223b57600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b600181811c9082168061226c57607f821691505b602082108103611c6c57634e487b7160e01b600052602260045260246000fd5b604051606081016001600160401b03811182821017156122ae576122ae612242565b60405290565b604080519081016001600160401b03811182821017156122ae576122ae612242565b604051601f8201601f191681016001600160401b03811182821017156122fe576122fe612242565b604052919050565b60006001600160401b0382111561231f5761231f612242565b50601f01601f191660200190565b60006001600160401b038084111561234757612347612242565b8360051b60206123588183016122d6565b86815291850191818101903684111561237057600080fd5b865b848110156124365780358681111561238a5760008081fd5b8801606036829003121561239e5760008081fd5b6123a661228c565b6123af82611e9d565b81526123bc868301611f56565b86820152604080830135898111156123d45760008081fd5b929092019136601f8401126123e95760008081fd5b82356123fc6123f782612306565b6122d6565b81815236898387010111156124115760008081fd5b818986018a830137600091810189019190915290820152845250918301918301612372565b50979650505050505050565b6000808585111561245257600080fd5b8386111561245f57600080fd5b5050820193919092039150565b6000845161247e818460208901611ca6565b8201838582376000930192835250909392505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b602081526000610aa0602083018486612494565b634e487b7160e01b600052603260045260246000fd5b6000823561013e198336030181126124fe57600080fd5b9190910192915050565b6000808335601e1984360301811261251f57600080fd5b8301803591506001600160401b0382111561253957600080fd5b602001915036819003821315611de257600080fd5b6001600160401b0381168114610f6e57600080fd5b63ffffffff61257189611e9d565b168152602088013560208201526000604089013561258e8161254e565b6001600160401b03811660408401525087606083015260e060808301526125b960e083018789612494565b6001600160a01b03861660a084015282810360c08401526125db818587612494565b9a9950505050505050505050565b6000602082840312156125fb57600080fd5b81516001600160401b0381111561261157600080fd5b8201601f8101841361262257600080fd5b80516126306123f782612306565b81815285602083850101111561264557600080fd5b611403826020830160208601611ca6565b60006020828403121561266857600080fd5b81356116d98161254e565b60018060a01b038516815283602082015261ffff831660408201526080606082015260006126a46080830184611cca565b9695505050505050565b6040815260006126c16040830185611cca565b82810360208401526114038185611cca565b6000602082840312156126e557600080fd5b81516116d981611ee0565b6040815263ffffffff8351166040820152602083015160608201526000604084015160a0608084015261272660e0840182611cca565b90506060850151603f198483030160a08501526127438282611cca565b60809690960151151560c08501525050506001600160a01b039190911660209091015290565b60006040828403121561277b57600080fd5b6127836122b4565b9050815181526020820151602082015292915050565b6000604082840312156127ab57600080fd5b6116d98383612769565b601f821115611a54576000816000526020600020601f850160051c810160208610156127de5750805b601f850160051c820191505b818110156127fd578281556001016127ea565b505050505050565b81516001600160401b0381111561281e5761281e612242565b6128328161282c8454612258565b846127b5565b602080601f831160018114612867576000841561284f5750858301515b600019600386901b1c1916600185901b1785556127fd565b600085815260208120601f198616915b8281101561289657888601518255948401946001909101908401612877565b50858210156128b45787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600060208083018184528085518083526040925060408601915060408160051b87010184880160005b8381101561294157888303603f190185528151805163ffffffff1684528781015161ffff1688850152860151606087850181905261292d81860183611cca565b9689019694505050908601906001016128ed565b509098975050505050505050565b60006040828403121561296157600080fd5b6129696122b4565b82358152602083013560208201528091505092915050565b60008261299e57634e487b7160e01b600052601260045260246000fd5b500490565b808202811582820484141761097757634e487b7160e01b600052601160045260246000fd5b8035602083101561097757600019602084900360031b1b1692915050565b6001600160c01b03198135818116916008851015612a0e5780818660080360031b1b83161692505b505092915050565b6001600160401b0360c01b8560c01b16815263ffffffff60e01b8460e01b16600882015282600c82015260008251612a5581602c850160208701611ca6565b91909101602c0195945050505050565b8481526001600160401b0360c01b8460c01b16602082015282602882015260008251612a98816048850160208701611ca6565b9190910160480195945050505050565b600060808284031215612aba57600080fd5b612ac261228c565b825181526020830151612ad48161254e565b6020820152612ae68460408501612769565b6040820152939250505056fea2646970667358221220866f244a9ee02aa821008e870b72f454292432ef51e26dd6b30a999a4d4cd09a64736f6c63430008160033

Verified Source Code Partial Match

Compiler: v0.8.22+commit.4fc1097e EVM: paris Optimization: Yes (200 runs)
MyOFTAdapter.sol 2888 lines
// Sources flattened with hardhat v2.22.18 https://hardhat.org

// SPDX-License-Identifier: LZBL-1.2 AND MIT AND UNLICENSED

// File @layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/[email protected]

// Original license: SPDX_License_Identifier: MIT

pragma solidity >=0.8.0;

struct SetConfigParam {
    uint32 eid;
    uint32 configType;
    bytes config;
}

interface IMessageLibManager {
    struct Timeout {
        address lib;
        uint256 expiry;
    }

    event LibraryRegistered(address newLib);
    event DefaultSendLibrarySet(uint32 eid, address newLib);
    event DefaultReceiveLibrarySet(uint32 eid, address newLib);
    event DefaultReceiveLibraryTimeoutSet(uint32 eid, address oldLib, uint256 expiry);
    event SendLibrarySet(address sender, uint32 eid, address newLib);
    event ReceiveLibrarySet(address receiver, uint32 eid, address newLib);
    event ReceiveLibraryTimeoutSet(address receiver, uint32 eid, address oldLib, uint256 timeout);

    function registerLibrary(address _lib) external;

    function isRegisteredLibrary(address _lib) external view returns (bool);

    function getRegisteredLibraries() external view returns (address[] memory);

    function setDefaultSendLibrary(uint32 _eid, address _newLib) external;

    function defaultSendLibrary(uint32 _eid) external view returns (address);

    function setDefaultReceiveLibrary(uint32 _eid, address _newLib, uint256 _gracePeriod) external;

    function defaultReceiveLibrary(uint32 _eid) external view returns (address);

    function setDefaultReceiveLibraryTimeout(uint32 _eid, address _lib, uint256 _expiry) external;

    function defaultReceiveLibraryTimeout(uint32 _eid) external view returns (address lib, uint256 expiry);

    function isSupportedEid(uint32 _eid) external view returns (bool);

    function isValidReceiveLibrary(address _receiver, uint32 _eid, address _lib) external view returns (bool);

    /// ------------------- OApp interfaces -------------------
    function setSendLibrary(address _oapp, uint32 _eid, address _newLib) external;

    function getSendLibrary(address _sender, uint32 _eid) external view returns (address lib);

    function isDefaultSendLibrary(address _sender, uint32 _eid) external view returns (bool);

    function setReceiveLibrary(address _oapp, uint32 _eid, address _newLib, uint256 _gracePeriod) external;

    function getReceiveLibrary(address _receiver, uint32 _eid) external view returns (address lib, bool isDefault);

    function setReceiveLibraryTimeout(address _oapp, uint32 _eid, address _lib, uint256 _expiry) external;

    function receiveLibraryTimeout(address _receiver, uint32 _eid) external view returns (address lib, uint256 expiry);

    function setConfig(address _oapp, address _lib, SetConfigParam[] calldata _params) external;

    function getConfig(
        address _oapp,
        address _lib,
        uint32 _eid,
        uint32 _configType
    ) external view returns (bytes memory config);
}


// File @layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/[email protected]

// Original license: SPDX_License_Identifier: MIT

pragma solidity >=0.8.0;

interface IMessagingChannel {
    event InboundNonceSkipped(uint32 srcEid, bytes32 sender, address receiver, uint64 nonce);
    event PacketNilified(uint32 srcEid, bytes32 sender, address receiver, uint64 nonce, bytes32 payloadHash);
    event PacketBurnt(uint32 srcEid, bytes32 sender, address receiver, uint64 nonce, bytes32 payloadHash);

    function eid() external view returns (uint32);

    // this is an emergency function if a message cannot be verified for some reasons
    // required to provide _nextNonce to avoid race condition
    function skip(address _oapp, uint32 _srcEid, bytes32 _sender, uint64 _nonce) external;

    function nilify(address _oapp, uint32 _srcEid, bytes32 _sender, uint64 _nonce, bytes32 _payloadHash) external;

    function burn(address _oapp, uint32 _srcEid, bytes32 _sender, uint64 _nonce, bytes32 _payloadHash) external;

    function nextGuid(address _sender, uint32 _dstEid, bytes32 _receiver) external view returns (bytes32);

    function inboundNonce(address _receiver, uint32 _srcEid, bytes32 _sender) external view returns (uint64);

    function outboundNonce(address _sender, uint32 _dstEid, bytes32 _receiver) external view returns (uint64);

    function inboundPayloadHash(
        address _receiver,
        uint32 _srcEid,
        bytes32 _sender,
        uint64 _nonce
    ) external view returns (bytes32);

    function lazyInboundNonce(address _receiver, uint32 _srcEid, bytes32 _sender) external view returns (uint64);
}


// File @layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/[email protected]

// Original license: SPDX_License_Identifier: MIT

pragma solidity >=0.8.0;

interface IMessagingComposer {
    event ComposeSent(address from, address to, bytes32 guid, uint16 index, bytes message);
    event ComposeDelivered(address from, address to, bytes32 guid, uint16 index);
    event LzComposeAlert(
        address indexed from,
        address indexed to,
        address indexed executor,
        bytes32 guid,
        uint16 index,
        uint256 gas,
        uint256 value,
        bytes message,
        bytes extraData,
        bytes reason
    );

    function composeQueue(
        address _from,
        address _to,
        bytes32 _guid,
        uint16 _index
    ) external view returns (bytes32 messageHash);

    function sendCompose(address _to, bytes32 _guid, uint16 _index, bytes calldata _message) external;

    function lzCompose(
        address _from,
        address _to,
        bytes32 _guid,
        uint16 _index,
        bytes calldata _message,
        bytes calldata _extraData
    ) external payable;
}


// File @layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/[email protected]

// Original license: SPDX_License_Identifier: MIT

pragma solidity >=0.8.0;

interface IMessagingContext {
    function isSendingMessage() external view returns (bool);

    function getSendContext() external view returns (uint32 dstEid, address sender);
}


// File @layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/[email protected]

// Original license: SPDX_License_Identifier: MIT

pragma solidity >=0.8.0;




struct MessagingParams {
    uint32 dstEid;
    bytes32 receiver;
    bytes message;
    bytes options;
    bool payInLzToken;
}

struct MessagingReceipt {
    bytes32 guid;
    uint64 nonce;
    MessagingFee fee;
}

struct MessagingFee {
    uint256 nativeFee;
    uint256 lzTokenFee;
}

struct Origin {
    uint32 srcEid;
    bytes32 sender;
    uint64 nonce;
}

interface ILayerZeroEndpointV2 is IMessageLibManager, IMessagingComposer, IMessagingChannel, IMessagingContext {
    event PacketSent(bytes encodedPayload, bytes options, address sendLibrary);

    event PacketVerified(Origin origin, address receiver, bytes32 payloadHash);

    event PacketDelivered(Origin origin, address receiver);

    event LzReceiveAlert(
        address indexed receiver,
        address indexed executor,
        Origin origin,
        bytes32 guid,
        uint256 gas,
        uint256 value,
        bytes message,
        bytes extraData,
        bytes reason
    );

    event LzTokenSet(address token);

    event DelegateSet(address sender, address delegate);

    function quote(MessagingParams calldata _params, address _sender) external view returns (MessagingFee memory);

    function send(
        MessagingParams calldata _params,
        address _refundAddress
    ) external payable returns (MessagingReceipt memory);

    function verify(Origin calldata _origin, address _receiver, bytes32 _payloadHash) external;

    function verifiable(Origin calldata _origin, address _receiver) external view returns (bool);

    function initializable(Origin calldata _origin, address _receiver) external view returns (bool);

    function lzReceive(
        Origin calldata _origin,
        address _receiver,
        bytes32 _guid,
        bytes calldata _message,
        bytes calldata _extraData
    ) external payable;

    // oapp can burn messages partially by calling this function with its own business logic if messages are verified in order
    function clear(address _oapp, Origin calldata _origin, bytes32 _guid, bytes calldata _message) external;

    function setLzToken(address _lzToken) external;

    function lzToken() external view returns (address);

    function nativeToken() external view returns (address);

    function setDelegate(address _delegate) external;
}


// File @layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/[email protected]

// Original license: SPDX_License_Identifier: MIT

pragma solidity >=0.8.0;

interface ILayerZeroReceiver {
    function allowInitializePath(Origin calldata _origin) external view returns (bool);

    function nextNonce(uint32 _eid, bytes32 _sender) external view returns (uint64);

    function lzReceive(
        Origin calldata _origin,
        bytes32 _guid,
        bytes calldata _message,
        address _executor,
        bytes calldata _extraData
    ) external payable;
}


// File @openzeppelin/contracts/utils/introspection/[email protected]

// Original license: SPDX_License_Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC-165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[ERC].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}


// File @layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/[email protected]

// Original license: SPDX_License_Identifier: MIT

pragma solidity >=0.8.0;

enum MessageLibType {
    Send,
    Receive,
    SendAndReceive
}

interface IMessageLib is IERC165 {
    function setConfig(address _oapp, SetConfigParam[] calldata _config) external;

    function getConfig(uint32 _eid, address _oapp, uint32 _configType) external view returns (bytes memory config);

    function isSupportedEid(uint32 _eid) external view returns (bool);

    // message libs of same major version are compatible
    function version() external view returns (uint64 major, uint8 minor, uint8 endpointVersion);

    function messageLibType() external view returns (MessageLibType);
}


// File @layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/[email protected]

// Original license: SPDX_License_Identifier: MIT

pragma solidity >=0.8.0;


struct Packet {
    uint64 nonce;
    uint32 srcEid;
    address sender;
    uint32 dstEid;
    bytes32 receiver;
    bytes32 guid;
    bytes message;
}

interface ISendLib is IMessageLib {
    function send(
        Packet calldata _packet,
        bytes calldata _options,
        bool _payInLzToken
    ) external returns (MessagingFee memory, bytes memory encodedPacket);

    function quote(
        Packet calldata _packet,
        bytes calldata _options,
        bool _payInLzToken
    ) external view returns (MessagingFee memory);

    function setTreasury(address _treasury) external;

    function withdrawFee(address _to, uint256 _amount) external;

    function withdrawLzTokenFee(address _lzToken, address _to, uint256 _amount) external;
}


// File @layerzerolabs/lz-evm-protocol-v2/contracts/libs/[email protected]

// Original license: SPDX_License_Identifier: LZBL-1.2

pragma solidity ^0.8.20;

library AddressCast {
    error AddressCast_InvalidSizeForAddress();
    error AddressCast_InvalidAddress();

    function toBytes32(bytes calldata _addressBytes) internal pure returns (bytes32 result) {
        if (_addressBytes.length > 32) revert AddressCast_InvalidAddress();
        result = bytes32(_addressBytes);
        unchecked {
            uint256 offset = 32 - _addressBytes.length;
            result = result >> (offset * 8);
        }
    }

    function toBytes32(address _address) internal pure returns (bytes32 result) {
        result = bytes32(uint256(uint160(_address)));
    }

    function toBytes(bytes32 _addressBytes32, uint256 _size) internal pure returns (bytes memory result) {
        if (_size == 0 || _size > 32) revert AddressCast_InvalidSizeForAddress();
        result = new bytes(_size);
        unchecked {
            uint256 offset = 256 - _size * 8;
            assembly {
                mstore(add(result, 32), shl(offset, _addressBytes32))
            }
        }
    }

    function toAddress(bytes32 _addressBytes32) internal pure returns (address result) {
        result = address(uint160(uint256(_addressBytes32)));
    }

    function toAddress(bytes calldata _addressBytes) internal pure returns (address result) {
        if (_addressBytes.length != 20) revert AddressCast_InvalidAddress();
        result = address(bytes20(_addressBytes));
    }
}


// File @layerzerolabs/lz-evm-protocol-v2/contracts/messagelib/libs/[email protected]

// Original license: SPDX_License_Identifier: LZBL-1.2

pragma solidity ^0.8.20;


library PacketV1Codec {
    using AddressCast for address;
    using AddressCast for bytes32;

    uint8 internal constant PACKET_VERSION = 1;

    // header (version + nonce + path)
    // version
    uint256 private constant PACKET_VERSION_OFFSET = 0;
    //    nonce
    uint256 private constant NONCE_OFFSET = 1;
    //    path
    uint256 private constant SRC_EID_OFFSET = 9;
    uint256 private constant SENDER_OFFSET = 13;
    uint256 private constant DST_EID_OFFSET = 45;
    uint256 private constant RECEIVER_OFFSET = 49;
    // payload (guid + message)
    uint256 private constant GUID_OFFSET = 81; // keccak256(nonce + path)
    uint256 private constant MESSAGE_OFFSET = 113;

    function encode(Packet memory _packet) internal pure returns (bytes memory encodedPacket) {
        encodedPacket = abi.encodePacked(
            PACKET_VERSION,
            _packet.nonce,
            _packet.srcEid,
            _packet.sender.toBytes32(),
            _packet.dstEid,
            _packet.receiver,
            _packet.guid,
            _packet.message
        );
    }

    function encodePacketHeader(Packet memory _packet) internal pure returns (bytes memory) {
        return
            abi.encodePacked(
                PACKET_VERSION,
                _packet.nonce,
                _packet.srcEid,
                _packet.sender.toBytes32(),
                _packet.dstEid,
                _packet.receiver
            );
    }

    function encodePayload(Packet memory _packet) internal pure returns (bytes memory) {
        return abi.encodePacked(_packet.guid, _packet.message);
    }

    function header(bytes calldata _packet) internal pure returns (bytes calldata) {
        return _packet[0:GUID_OFFSET];
    }

    function version(bytes calldata _packet) internal pure returns (uint8) {
        return uint8(bytes1(_packet[PACKET_VERSION_OFFSET:NONCE_OFFSET]));
    }

    function nonce(bytes calldata _packet) internal pure returns (uint64) {
        return uint64(bytes8(_packet[NONCE_OFFSET:SRC_EID_OFFSET]));
    }

    function srcEid(bytes calldata _packet) internal pure returns (uint32) {
        return uint32(bytes4(_packet[SRC_EID_OFFSET:SENDER_OFFSET]));
    }

    function sender(bytes calldata _packet) internal pure returns (bytes32) {
        return bytes32(_packet[SENDER_OFFSET:DST_EID_OFFSET]);
    }

    function senderAddressB20(bytes calldata _packet) internal pure returns (address) {
        return sender(_packet).toAddress();
    }

    function dstEid(bytes calldata _packet) internal pure returns (uint32) {
        return uint32(bytes4(_packet[DST_EID_OFFSET:RECEIVER_OFFSET]));
    }

    function receiver(bytes calldata _packet) internal pure returns (bytes32) {
        return bytes32(_packet[RECEIVER_OFFSET:GUID_OFFSET]);
    }

    function receiverB20(bytes calldata _packet) internal pure returns (address) {
        return receiver(_packet).toAddress();
    }

    function guid(bytes calldata _packet) internal pure returns (bytes32) {
        return bytes32(_packet[GUID_OFFSET:MESSAGE_OFFSET]);
    }

    function message(bytes calldata _packet) internal pure returns (bytes calldata) {
        return bytes(_packet[MESSAGE_OFFSET:]);
    }

    function payload(bytes calldata _packet) internal pure returns (bytes calldata) {
        return bytes(_packet[GUID_OFFSET:]);
    }

    function payloadHash(bytes calldata _packet) internal pure returns (bytes32) {
        return keccak256(payload(_packet));
    }
}


// File @layerzerolabs/oapp-evm/contracts/oapp/interfaces/[email protected]

// Original license: SPDX_License_Identifier: MIT

pragma solidity ^0.8.20;

/**
 * @title IOAppCore
 */
interface IOAppCore {
    // Custom error messages
    error OnlyPeer(uint32 eid, bytes32 sender);
    error NoPeer(uint32 eid);
    error InvalidEndpointCall();
    error InvalidDelegate();

    // Event emitted when a peer (OApp) is set for a corresponding endpoint
    event PeerSet(uint32 eid, bytes32 peer);

    /**
     * @notice Retrieves the OApp version information.
     * @return senderVersion The version of the OAppSender.sol contract.
     * @return receiverVersion The version of the OAppReceiver.sol contract.
     */
    function oAppVersion() external view returns (uint64 senderVersion, uint64 receiverVersion);

    /**
     * @notice Retrieves the LayerZero endpoint associated with the OApp.
     * @return iEndpoint The LayerZero endpoint as an interface.
     */
    function endpoint() external view returns (ILayerZeroEndpointV2 iEndpoint);

    /**
     * @notice Retrieves the peer (OApp) associated with a corresponding endpoint.
     * @param _eid The endpoint ID.
     * @return peer The peer address (OApp instance) associated with the corresponding endpoint.
     */
    function peers(uint32 _eid) external view returns (bytes32 peer);

    /**
     * @notice Sets the peer address (OApp instance) for a corresponding endpoint.
     * @param _eid The endpoint ID.
     * @param _peer The address of the peer to be associated with the corresponding endpoint.
     */
    function setPeer(uint32 _eid, bytes32 _peer) external;

    /**
     * @notice Sets the delegate address for the OApp Core.
     * @param _delegate The address of the delegate to be set.
     */
    function setDelegate(address _delegate) external;
}


// File @layerzerolabs/oapp-evm/contracts/oapp/interfaces/[email protected]

// Original license: SPDX_License_Identifier: MIT
pragma solidity ^0.8.20;

interface IOAppReceiver is ILayerZeroReceiver {
    /**
     * @notice Indicates whether an address is an approved composeMsg sender to the Endpoint.
     * @param _origin The origin information containing the source endpoint and sender address.
     *  - srcEid: The source chain endpoint ID.
     *  - sender: The sender address on the src chain.
     *  - nonce: The nonce of the message.
     * @param _message The lzReceive payload.
     * @param _sender The sender address.
     * @return isSender Is a valid sender.
     *
     * @dev Applications can optionally choose to implement a separate composeMsg sender that is NOT the bridging layer.
     * @dev The default sender IS the OAppReceiver implementer.
     */
    function isComposeMsgSender(
        Origin calldata _origin,
        bytes calldata _message,
        address _sender
    ) external view returns (bool isSender);
}


// File @layerzerolabs/oapp-evm/contracts/oapp/interfaces/[email protected]

// Original license: SPDX_License_Identifier: MIT

pragma solidity ^0.8.20;

/**
 * @dev Struct representing enforced option parameters.
 */
struct EnforcedOptionParam {
    uint32 eid; // Endpoint ID
    uint16 msgType; // Message Type
    bytes options; // Additional options
}

/**
 * @title IOAppOptionsType3
 * @dev Interface for the OApp with Type 3 Options, allowing the setting and combining of enforced options.
 */
interface IOAppOptionsType3 {
    // Custom error message for invalid options
    error InvalidOptions(bytes options);

    // Event emitted when enforced options are set
    event EnforcedOptionSet(EnforcedOptionParam[] _enforcedOptions);

    /**
     * @notice Sets enforced options for specific endpoint and message type combinations.
     * @param _enforcedOptions An array of EnforcedOptionParam structures specifying enforced options.
     */
    function setEnforcedOptions(EnforcedOptionParam[] calldata _enforcedOptions) external;

    /**
     * @notice Combines options for a given endpoint and message type.
     * @param _eid The endpoint ID.
     * @param _msgType The OApp message type.
     * @param _extraOptions Additional options passed by the caller.
     * @return options The combination of caller specified options AND enforced options.
     */
    function combineOptions(
        uint32 _eid,
        uint16 _msgType,
        bytes calldata _extraOptions
    ) external view returns (bytes memory options);
}


// File @openzeppelin/contracts/utils/[email protected]

// Original license: SPDX_License_Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}


// File @openzeppelin/contracts/access/[email protected]

// Original license: SPDX_License_Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is set to the address provided by the deployer. This can
 * later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}


// File @layerzerolabs/oapp-evm/contracts/oapp/libs/[email protected]

// Original license: SPDX_License_Identifier: MIT

pragma solidity ^0.8.20;


/**
 * @title OAppOptionsType3
 * @dev Abstract contract implementing the IOAppOptionsType3 interface with type 3 options.
 */
abstract contract OAppOptionsType3 is IOAppOptionsType3, Ownable {
    uint16 internal constant OPTION_TYPE_3 = 3;

    // @dev The "msgType" should be defined in the child contract.
    mapping(uint32 eid => mapping(uint16 msgType => bytes enforcedOption)) public enforcedOptions;

    /**
     * @dev Sets the enforced options for specific endpoint and message type combinations.
     * @param _enforcedOptions An array of EnforcedOptionParam structures specifying enforced options.
     *
     * @dev Only the owner/admin of the OApp can call this function.
     * @dev Provides a way for the OApp to enforce things like paying for PreCrime, AND/OR minimum dst lzReceive gas amounts etc.
     * @dev These enforced options can vary as the potential options/execution on the remote may differ as per the msgType.
     * eg. Amount of lzReceive() gas necessary to deliver a lzCompose() message adds overhead you dont want to pay
     * if you are only making a standard LayerZero message ie. lzReceive() WITHOUT sendCompose().
     */
    function setEnforcedOptions(EnforcedOptionParam[] calldata _enforcedOptions) public virtual onlyOwner {
        _setEnforcedOptions(_enforcedOptions);
    }

    /**
     * @dev Sets the enforced options for specific endpoint and message type combinations.
     * @param _enforcedOptions An array of EnforcedOptionParam structures specifying enforced options.
     *
     * @dev Provides a way for the OApp to enforce things like paying for PreCrime, AND/OR minimum dst lzReceive gas amounts etc.
     * @dev These enforced options can vary as the potential options/execution on the remote may differ as per the msgType.
     * eg. Amount of lzReceive() gas necessary to deliver a lzCompose() message adds overhead you dont want to pay
     * if you are only making a standard LayerZero message ie. lzReceive() WITHOUT sendCompose().
     */
    function _setEnforcedOptions(EnforcedOptionParam[] memory _enforcedOptions) internal virtual {
        for (uint256 i = 0; i < _enforcedOptions.length; i++) {
            // @dev Enforced options are only available for optionType 3, as type 1 and 2 dont support combining.
            _assertOptionsType3(_enforcedOptions[i].options);
            enforcedOptions[_enforcedOptions[i].eid][_enforcedOptions[i].msgType] = _enforcedOptions[i].options;
        }

        emit EnforcedOptionSet(_enforcedOptions);
    }

    /**
     * @notice Combines options for a given endpoint and message type.
     * @param _eid The endpoint ID.
     * @param _msgType The OAPP message type.
     * @param _extraOptions Additional options passed by the caller.
     * @return options The combination of caller specified options AND enforced options.
     *
     * @dev If there is an enforced lzReceive option:
     * - {gasLimit: 200k, msg.value: 1 ether} AND a caller supplies a lzReceive option: {gasLimit: 100k, msg.value: 0.5 ether}
     * - The resulting options will be {gasLimit: 300k, msg.value: 1.5 ether} when the message is executed on the remote lzReceive() function.
     * @dev This presence of duplicated options is handled off-chain in the verifier/executor.
     */
    function combineOptions(
        uint32 _eid,
        uint16 _msgType,
        bytes calldata _extraOptions
    ) public view virtual returns (bytes memory) {
        bytes memory enforced = enforcedOptions[_eid][_msgType];

        // No enforced options, pass whatever the caller supplied, even if it's empty or legacy type 1/2 options.
        if (enforced.length == 0) return _extraOptions;

        // No caller options, return enforced
        if (_extraOptions.length == 0) return enforced;

        // @dev If caller provided _extraOptions, must be type 3 as its the ONLY type that can be combined.
        if (_extraOptions.length >= 2) {
            _assertOptionsType3(_extraOptions);
            // @dev Remove the first 2 bytes containing the type from the _extraOptions and combine with enforced.
            return bytes.concat(enforced, _extraOptions[2:]);
        }

        // No valid set of options was found.
        revert InvalidOptions(_extraOptions);
    }

    /**
     * @dev Internal function to assert that options are of type 3.
     * @param _options The options to be checked.
     */
    function _assertOptionsType3(bytes memory _options) internal pure virtual {
        uint16 optionsType;
        assembly {
            optionsType := mload(add(_options, 2))
        }
        if (optionsType != OPTION_TYPE_3) revert InvalidOptions(_options);
    }
}


// File @layerzerolabs/oapp-evm/contracts/oapp/[email protected]

// Original license: SPDX_License_Identifier: MIT

pragma solidity ^0.8.20;


/**
 * @title OAppCore
 * @dev Abstract contract implementing the IOAppCore interface with basic OApp configurations.
 */
abstract contract OAppCore is IOAppCore, Ownable {
    // The LayerZero endpoint associated with the given OApp
    ILayerZeroEndpointV2 public immutable endpoint;

    // Mapping to store peers associated with corresponding endpoints
    mapping(uint32 eid => bytes32 peer) public peers;

    /**
     * @dev Constructor to initialize the OAppCore with the provided endpoint and delegate.
     * @param _endpoint The address of the LOCAL Layer Zero endpoint.
     * @param _delegate The delegate capable of making OApp configurations inside of the endpoint.
     *
     * @dev The delegate typically should be set as the owner of the contract.
     */
    constructor(address _endpoint, address _delegate) {
        endpoint = ILayerZeroEndpointV2(_endpoint);

        if (_delegate == address(0)) revert InvalidDelegate();
        endpoint.setDelegate(_delegate);
    }

    /**
     * @notice Sets the peer address (OApp instance) for a corresponding endpoint.
     * @param _eid The endpoint ID.
     * @param _peer The address of the peer to be associated with the corresponding endpoint.
     *
     * @dev Only the owner/admin of the OApp can call this function.
     * @dev Indicates that the peer is trusted to send LayerZero messages to this OApp.
     * @dev Set this to bytes32(0) to remove the peer address.
     * @dev Peer is a bytes32 to accommodate non-evm chains.
     */
    function setPeer(uint32 _eid, bytes32 _peer) public virtual onlyOwner {
        _setPeer(_eid, _peer);
    }

    /**
     * @notice Sets the peer address (OApp instance) for a corresponding endpoint.
     * @param _eid The endpoint ID.
     * @param _peer The address of the peer to be associated with the corresponding endpoint.
     *
     * @dev Indicates that the peer is trusted to send LayerZero messages to this OApp.
     * @dev Set this to bytes32(0) to remove the peer address.
     * @dev Peer is a bytes32 to accommodate non-evm chains.
     */
    function _setPeer(uint32 _eid, bytes32 _peer) internal virtual {
        peers[_eid] = _peer;
        emit PeerSet(_eid, _peer);
    }

    /**
     * @notice Internal function to get the peer address associated with a specific endpoint; reverts if NOT set.
     * ie. the peer is set to bytes32(0).
     * @param _eid The endpoint ID.
     * @return peer The address of the peer associated with the specified endpoint.
     */
    function _getPeerOrRevert(uint32 _eid) internal view virtual returns (bytes32) {
        bytes32 peer = peers[_eid];
        if (peer == bytes32(0)) revert NoPeer(_eid);
        return peer;
    }

    /**
     * @notice Sets the delegate address for the OApp.
     * @param _delegate The address of the delegate to be set.
     *
     * @dev Only the owner/admin of the OApp can call this function.
     * @dev Provides the ability for a delegate to set configs, on behalf of the OApp, directly on the Endpoint contract.
     */
    function setDelegate(address _delegate) public onlyOwner {
        endpoint.setDelegate(_delegate);
    }
}


// File @layerzerolabs/oapp-evm/contracts/oapp/[email protected]

// Original license: SPDX_License_Identifier: MIT

pragma solidity ^0.8.20;


/**
 * @title OAppReceiver
 * @dev Abstract contract implementing the ILayerZeroReceiver interface and extending OAppCore for OApp receivers.
 */
abstract contract OAppReceiver is IOAppReceiver, OAppCore {
    // Custom error message for when the caller is not the registered endpoint/
    error OnlyEndpoint(address addr);

    // @dev The version of the OAppReceiver implementation.
    // @dev Version is bumped when changes are made to this contract.
    uint64 internal constant RECEIVER_VERSION = 2;

    /**
     * @notice Retrieves the OApp version information.
     * @return senderVersion The version of the OAppSender.sol contract.
     * @return receiverVersion The version of the OAppReceiver.sol contract.
     *
     * @dev Providing 0 as the default for OAppSender version. Indicates that the OAppSender is not implemented.
     * ie. this is a RECEIVE only OApp.
     * @dev If the OApp uses both OAppSender and OAppReceiver, then this needs to be override returning the correct versions.
     */
    function oAppVersion() public view virtual returns (uint64 senderVersion, uint64 receiverVersion) {
        return (0, RECEIVER_VERSION);
    }

    /**
     * @notice Indicates whether an address is an approved composeMsg sender to the Endpoint.
     * @dev _origin The origin information containing the source endpoint and sender address.
     *  - srcEid: The source chain endpoint ID.
     *  - sender: The sender address on the src chain.
     *  - nonce: The nonce of the message.
     * @dev _message The lzReceive payload.
     * @param _sender The sender address.
     * @return isSender Is a valid sender.
     *
     * @dev Applications can optionally choose to implement separate composeMsg senders that are NOT the bridging layer.
     * @dev The default sender IS the OAppReceiver implementer.
     */
    function isComposeMsgSender(
        Origin calldata /*_origin*/,
        bytes calldata /*_message*/,
        address _sender
    ) public view virtual returns (bool) {
        return _sender == address(this);
    }

    /**
     * @notice Checks if the path initialization is allowed based on the provided origin.
     * @param origin The origin information containing the source endpoint and sender address.
     * @return Whether the path has been initialized.
     *
     * @dev This indicates to the endpoint that the OApp has enabled msgs for this particular path to be received.
     * @dev This defaults to assuming if a peer has been set, its initialized.
     * Can be overridden by the OApp if there is other logic to determine this.
     */
    function allowInitializePath(Origin calldata origin) public view virtual returns (bool) {
        return peers[origin.srcEid] == origin.sender;
    }

    /**
     * @notice Retrieves the next nonce for a given source endpoint and sender address.
     * @dev _srcEid The source endpoint ID.
     * @dev _sender The sender address.
     * @return nonce The next nonce.
     *
     * @dev The path nonce starts from 1. If 0 is returned it means that there is NO nonce ordered enforcement.
     * @dev Is required by the off-chain executor to determine the OApp expects msg execution is ordered.
     * @dev This is also enforced by the OApp.
     * @dev By default this is NOT enabled. ie. nextNonce is hardcoded to return 0.
     */
    function nextNonce(uint32 /*_srcEid*/, bytes32 /*_sender*/) public view virtual returns (uint64 nonce) {
        return 0;
    }

    /**
     * @dev Entry point for receiving messages or packets from the endpoint.
     * @param _origin The origin information containing the source endpoint and sender address.
     *  - srcEid: The source chain endpoint ID.
     *  - sender: The sender address on the src chain.
     *  - nonce: The nonce of the message.
     * @param _guid The unique identifier for the received LayerZero message.
     * @param _message The payload of the received message.
     * @param _executor The address of the executor for the received message.
     * @param _extraData Additional arbitrary data provided by the corresponding executor.
     *
     * @dev Entry point for receiving msg/packet from the LayerZero endpoint.
     */
    function lzReceive(
        Origin calldata _origin,
        bytes32 _guid,
        bytes calldata _message,
        address _executor,
        bytes calldata _extraData
    ) public payable virtual {
        // Ensures that only the endpoint can attempt to lzReceive() messages to this OApp.
        if (address(endpoint) != msg.sender) revert OnlyEndpoint(msg.sender);

        // Ensure that the sender matches the expected peer for the source endpoint.
        if (_getPeerOrRevert(_origin.srcEid) != _origin.sender) revert OnlyPeer(_origin.srcEid, _origin.sender);

        // Call the internal OApp implementation of lzReceive.
        _lzReceive(_origin, _guid, _message, _executor, _extraData);
    }

    /**
     * @dev Internal function to implement lzReceive logic without needing to copy the basic parameter validation.
     */
    function _lzReceive(
        Origin calldata _origin,
        bytes32 _guid,
        bytes calldata _message,
        address _executor,
        bytes calldata _extraData
    ) internal virtual;
}


// File @openzeppelin/contracts/interfaces/[email protected]

// Original license: SPDX_License_Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)

pragma solidity ^0.8.20;


// File @openzeppelin/contracts/token/ERC20/[email protected]

// Original license: SPDX_License_Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC-20 standard as defined in the ERC.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the value of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 value) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 value) external returns (bool);
}


// File @openzeppelin/contracts/interfaces/[email protected]

// Original license: SPDX_License_Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)

pragma solidity ^0.8.20;


// File @openzeppelin/contracts/interfaces/[email protected]

// Original license: SPDX_License_Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1363.sol)

pragma solidity ^0.8.20;


/**
 * @title IERC1363
 * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
 *
 * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
 * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
 */
interface IERC1363 is IERC20, IERC165 {
    /*
     * Note: the ERC-165 identifier for this interface is 0xb0202a11.
     * 0xb0202a11 ===
     *   bytes4(keccak256('transferAndCall(address,uint256)')) ^
     *   bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
     */

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @param data Additional data with no specified format, sent in call to `spender`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}


// File @openzeppelin/contracts/token/ERC20/utils/[email protected]

// Original license: SPDX_License_Identifier: MIT
// OpenZeppelin Contracts (last updated v5.2.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;


/**
 * @title SafeERC20
 * @dev Wrappers around ERC-20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    /**
     * @dev An operation with an ERC-20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal ...

// [truncated — 116367 bytes total]

Read Contract

SEND 0x1f5e1334 → uint16
SEND_AND_CALL 0x134d4f25 → uint16
allowInitializePath 0xbfe94e81 → bool
approvalRequired 0x9f68b964 → bool
combineOptions 0xbc70b354 → bytes
decimalConversionRate 0x963efcaa → uint256
endpoint 0x5e280f11 → address
enforcedOptions 0x5535d461 → bytes
isComposeMsgSender 0x8833c245 → bool
isPeer 0x5a0dfe4d → bool
msgInspector 0x111ecdad → address
nextNonce 0x7d25a05e → uint64
oApp 0x52ae2879 → address
oAppVersion 0x17442b70 → uint64, uint64
oftVersion 0x156a0d0f → bytes4, uint64
owner 0x8da5cb5b → address
peers 0xbb0b6a53 → bytes32
preCrime 0xb731ea0a → address
quoteOFT 0xe6343d44 → tuple, tuple[], tuple
quoteSend 0x2f603a24 → tuple
sharedDecimals 0x857749b0 → uint8
token 0xfc0c546a → address

Write Contract 11 functions

These functions modify contract state and require a wallet transaction to execute.

lzReceive 0xbf282d99
tuple _origin
bytes32 _guid
bytes _message
address _executor
bytes _extraData
lzReceiveAndRevert 0x215f7f2f
tuple[] _packets
lzReceiveSimulate 0xa454778b
tuple _origin
bytes32 _guid
bytes _message
address _executor
bytes _extraData
renounceOwnership 0x715018a6
No parameters
send 0xccfc9451
tuple _sendParam
tuple _fee
address _refundAddress
returns: tuple, tuple
setDelegate 0xca5eb5e1
address _delegate
setEnforcedOptions 0xd833f371
tuple[] _enforcedOptions
setMsgInspector 0x6fc1b31e
address _msgInspector
setPeer 0x3400288b
uint32 _eid
bytes32 _peer
setPreCrime 0xd4243885
address _preCrime
transferOwnership 0xf2fde38b
address newOwner

Recent Transactions

No transactions found for this address