Address Contract Verified
Address
0x445D4b7b0e15DA9E96E93f35E598dD8c83cB9Dc3
Balance
0 ETH
Nonce
1
Code Size
18825 bytes
Creator
0xD77Ec5Ba...40AE at tx 0xc36d125e...f3e2c1
Indexed Transactions
0
Contract Bytecode
18825 bytes
0x6080604052600436106103285760003560e01c80638ee74912116101a5578063d0f62e1b116100ec578063e985e9c511610095578063f18789221161006f578063f18789221461096e578063f2fde38b1461098e578063f5a8622a146109ae578063f5ecbdbc146109c357600080fd5b8063e985e9c5146108e5578063eb8d72b71461093b578063eed33cef1461095b57600080fd5b8063d7c97fb4116100c6578063d7c97fb414610869578063dacbcbe21461089d578063e8a3d485146108d057600080fd5b8063d0f62e1b1461080d578063d1deba1f14610841578063d547cfb71461085457600080fd5b8063b84c82461161014e578063c47f002711610128578063c47f0027146107ad578063c87b56dd146107cd578063cbed8b9c146107ed57600080fd5b8063b84c82461461074d578063b88d4fde1461076d578063bcc4efba1461078d57600080fd5b80639aac0d051161017f5780639aac0d05146106f3578063a22cb46514610713578063a475b5dd1461073357600080fd5b80638ee749121461066f578063938e3d7b146106be57806395d89b41146106de57600080fd5b80633f388b33116102745780636352211e1161021d57806370a08231116101f757806370a08231146105fa578063715018a61461061a5780638d81592a1461062f5780638da5cb5b1461064457600080fd5b80636352211e1461059a57806366ad5c8a146105ba57806369b41f95146105da57600080fd5b8063519056361161024e578063519056361461054f57806355f804b3146105625780635c975abb1461058257600080fd5b80633f388b33146104fa57806342842e0e1461050f57806342d65a8d1461052f57600080fd5b806310ddb137116102d65780632a205e3d116102b05780632a205e3d1461048f57806336ecd177146104c45780633d8b38f6146104da57600080fd5b806310ddb1371461042b5780631bc103bf1461044b57806323b872dd1461046f57600080fd5b806307e0db171161030757806307e0db17146103a6578063081812fc146103c6578063095ea7b31461040b57600080fd5b80621d35671461032d57806301ffc9a71461034f57806306fdde0314610384575b600080fd5b34801561033957600080fd5b5061034d6103483660046140e6565b6109e3565b005b34801561035b57600080fd5b5061036f61036a366004613d39565b610b0b565b60405190151581526020015b60405180910390f35b34801561039057600080fd5b50610399610bf0565b60405161037b919061442c565b3480156103b257600080fd5b5061034d6103c1366004613e2f565b610c82565b3480156103d257600080fd5b506103e66103e1366004614212565b610d90565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161037b565b34801561041757600080fd5b5061034d610426366004613cf4565b610e50565b34801561043757600080fd5b5061034d610446366004613e2f565b610fa9565b34801561045757600080fd5b50610461600c5481565b60405190815260200161037b565b34801561047b57600080fd5b5061034d61048a366004613b4f565b611086565b34801561049b57600080fd5b506104af6104aa366004613fc3565b61110d565b6040805192835260208301919091520161037b565b3480156104d057600080fd5b50610461600b5481565b3480156104e657600080fd5b5061036f6104f5366004613e67565b61122e565b34801561050657600080fd5b506103996112fa565b34801561051b57600080fd5b5061034d61052a366004613b4f565b611388565b34801561053b57600080fd5b5061034d61054a366004613e67565b6113a3565b61034d61055d366004613c2d565b6114b7565b34801561056e57600080fd5b5061034d61057d366004613de9565b61150a565b34801561058e57600080fd5b50600a5460ff1661036f565b3480156105a657600080fd5b506103e66105b5366004614212565b611588565b3480156105c657600080fd5b5061034d6105d53660046140e6565b611620565b3480156105e657600080fd5b506103996105f5366004613e2f565b6116a1565b34801561060657600080fd5b50610461610615366004613adf565b611748565b34801561062657600080fd5b5061034d6117fc565b34801561063b57600080fd5b5061039961186f565b34801561065057600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166103e6565b34801561067b57600080fd5b5061046161068a366004613f6c565b6002602090815260009384526040808520845180860184018051928152908401958401959095209452929052825290205481565b3480156106ca57600080fd5b5061034d6106d9366004613de9565b61187c565b3480156106ea57600080fd5b506103996118f6565b3480156106ff57600080fd5b5061034d61070e366004614212565b611905565b34801561071f57600080fd5b5061034d61072e366004613bf9565b611b25565b34801561073f57600080fd5b5060105461036f9060ff1681565b34801561075957600080fd5b5061034d610768366004613de9565b611b30565b34801561077957600080fd5b5061034d610788366004613b8f565b611baa565b34801561079957600080fd5b5061034d6107a8366004613adf565b611c32565b3480156107b957600080fd5b5061034d6107c8366004613de9565b611cb2565b3480156107d957600080fd5b506103996107e8366004614212565b611d2c565b3480156107f957600080fd5b5061034d6108083660046141b2565b611d7a565b34801561081957600080fd5b506104617f00000000000000000000000000000000000000000000000000000000000007cf81565b61034d61084f366004614057565b611e89565b34801561086057600080fd5b5061039961204a565b34801561087557600080fd5b506103e67f00000000000000000000000089d0d027bd1e9e4449b8d7975c8cc8e6b0a58b5981565b3480156108a957600080fd5b507f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd6756103e6565b3480156108dc57600080fd5b50610399612057565b3480156108f157600080fd5b5061036f610900366004613b17565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260086020908152604080832093909416825291909152205460ff1690565b34801561094757600080fd5b5061034d610956366004613e67565b612064565b61034d610969366004613eba565b61212a565b34801561097a57600080fd5b5061034d610989366004613d1f565b61217c565b34801561099a57600080fd5b5061034d6109a9366004613adf565b6121f8565b3480156109ba57600080fd5b5061034d6122f1565b3480156109cf57600080fd5b506103996109de366004614162565b612385565b337f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd67573ffffffffffffffffffffffffffffffffffffffff1614610a2557600080fd5b61ffff841660009081526001602052604090208054610a43906147af565b90508351148015610a82575061ffff8416600090815260016020526040908190209051610a709190614327565b60405180910390208380519060200120145b610af95760405162461bcd60e51b815260206004820152602b60248201527f4c7a52656365697665723a20696e76616c696420736f757263652073656e646960448201527f6e6720636f6e747261637400000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610b0584848484612519565b50505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f80ac58cd000000000000000000000000000000000000000000000000000000001480610b9e57507fffffffff0000000000000000000000000000000000000000000000000000000082167f5b5e139f00000000000000000000000000000000000000000000000000000000145b80610bea57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b6060600e8054610bff906147af565b80601f0160208091040260200160405190810160405280929190818152602001828054610c2b906147af565b8015610c785780601f10610c4d57610100808354040283529160200191610c78565b820191906000526020600020905b815481529060010190602001808311610c5b57829003601f168201915b5050505050905090565b60005473ffffffffffffffffffffffffffffffffffffffff163314610ce95760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610af0565b6040517f07e0db1700000000000000000000000000000000000000000000000000000000815261ffff821660048201527f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd67573ffffffffffffffffffffffffffffffffffffffff16906307e0db17906024015b600060405180830381600087803b158015610d7557600080fd5b505af1158015610d89573d6000803e3d6000fd5b5050505050565b60008181526005602052604081205473ffffffffffffffffffffffffffffffffffffffff16610e275760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201527f697374656e7420746f6b656e00000000000000000000000000000000000000006064820152608401610af0565b5060009081526007602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b6000610e5b82611588565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610eff5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f72000000000000000000000000000000000000000000000000000000000000006064820152608401610af0565b3373ffffffffffffffffffffffffffffffffffffffff82161480610f285750610f288133610900565b610f9a5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610af0565b610fa48383612624565b505050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146110105760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610af0565b6040517f10ddb13700000000000000000000000000000000000000000000000000000000815261ffff821660048201527f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd67573ffffffffffffffffffffffffffffffffffffffff16906310ddb13790602401610d5b565b61109033826126c4565b6111025760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f7665640000000000000000000000000000006064820152608401610af0565b610fa4838383612816565b6000806000878760405160200161112592919061443f565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f40a7bb10000000000000000000000000000000000000000000000000000000008252915073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd67516906340a7bb10906111cf908c90309086908c908c908c90600401614461565b604080518083038186803b1580156111e657600080fd5b505afa1580156111fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061121e919061422a565b9250925050965096945050505050565b61ffff83166000908152600160205260408120805482919061124f906147af565b80601f016020809104026020016040519081016040528092919081815260200182805461127b906147af565b80156112c85780601f1061129d576101008083540402835291602001916112c8565b820191906000526020600020905b8154815290600101906020018083116112ab57829003601f168201915b5050505050905083836040516112df9291906142fb565b60405180910390208180519060200120149150509392505050565b600f8054611307906147af565b80601f0160208091040260200160405190810160405280929190818152602001828054611333906147af565b80156113805780601f1061135557610100808354040283529160200191611380565b820191906000526020600020905b81548152906001019060200180831161136357829003601f168201915b505050505081565b610fa483838360405180602001604052806000815250611baa565b60005473ffffffffffffffffffffffffffffffffffffffff16331461140a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610af0565b6040517f42d65a8d00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd67516906342d65a8d90611480908690869086906004016144c2565b600060405180830381600087803b15801561149a57600080fd5b505af11580156114ae573d6000803e3d6000fd5b50505050505050565b6114ff898989898080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508b92508a91508990508888612a49565b505050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146115715760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610af0565b80516115849060099060208401906138b1565b5050565b60008181526005602052604081205473ffffffffffffffffffffffffffffffffffffffff1680610bea5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201527f656e7420746f6b656e00000000000000000000000000000000000000000000006064820152608401610af0565b3330146116955760405162461bcd60e51b815260206004820152602260248201527f4c7a52656365697665723a2063616c6c6572206d75737420626520427269646760448201527f652e0000000000000000000000000000000000000000000000000000000000006064820152608401610af0565b610b0584848484612c80565b61ffff811660009081526001602052604090208054606091906116c3906147af565b80601f01602080910402602001604051908101604052809291908181526020018280546116ef906147af565b801561173c5780601f106117115761010080835404028352916020019161173c565b820191906000526020600020905b81548152906001019060200180831161171f57829003601f168201915b50505050509050919050565b600073ffffffffffffffffffffffffffffffffffffffff82166117d35760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a6560448201527f726f2061646472657373000000000000000000000000000000000000000000006064820152608401610af0565b5073ffffffffffffffffffffffffffffffffffffffff1660009081526006602052604090205490565b60005473ffffffffffffffffffffffffffffffffffffffff1633146118635760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610af0565b61186d6000612d1f565b565b600e8054611307906147af565b60005473ffffffffffffffffffffffffffffffffffffffff1633146118e35760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610af0565b805161158490600d9060208401906138b1565b6060600f8054610bff906147af565b60005473ffffffffffffffffffffffffffffffffffffffff16331461196c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610af0565b600081600b5461197c9190614740565b600b549091505b81811015610fa4577f00000000000000000000000000000000000000000000000000000000000007cf600b5411156119fd5760405162461bcd60e51b815260206004820152601d60248201527f4f4e46543a204d6178204d696e74206c696d697420726561636865642e0000006044820152606401610af0565b6040517f6352211e000000000000000000000000000000000000000000000000000000008152600481018290527f00000000000000000000000089d0d027bd1e9e4449b8d7975c8cc8e6b0a58b5973ffffffffffffffffffffffffffffffffffffffff1690636352211e9060240160206040518083038186803b158015611a8357600080fd5b505afa925050508015611ad1575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201909252611ace91810190613afb565b60015b611afb57600b8054611af69161dead91906000611aed83614803565b91905055612d94565b611b13565b600b8054611b11918391906000611aed83614803565b505b80611b1d81614803565b915050611983565b611584338383612dae565b60005473ffffffffffffffffffffffffffffffffffffffff163314611b975760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610af0565b805161158490600f9060208401906138b1565b611bb433836126c4565b611c265760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f7665640000000000000000000000000000006064820152608401610af0565b610b0584848484612ec2565b60005473ffffffffffffffffffffffffffffffffffffffff163314611c995760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610af0565b600c8054611caf918391906000611aed83614803565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314611d195760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610af0565b805161158490600e9060208401906138b1565b60105460609060ff1615611d7257611d42612f4b565b611d4b83612f5a565b604051602001611d5c9291906143b4565b6040516020818303038152906040529050919050565b610bea612f4b565b60005473ffffffffffffffffffffffffffffffffffffffff163314611de15760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610af0565b6040517fcbed8b9c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd675169063cbed8b9c90611e5b908890889088908890889060040161467d565b600060405180830381600087803b158015611e7557600080fd5b505af11580156114ff573d6000803e3d6000fd5b61ffff85166000908152600260205260408082209051611eaa90879061430b565b908152604080516020928190038301902067ffffffffffffffff871660009081529252902054905080611f1f5760405162461bcd60e51b815260206004820152601d60248201527f4c7a52656365697665723a206e6f2073746f726564206d6573736167650000006044820152606401610af0565b808383604051611f309291906142fb565b604051809103902014611f855760405162461bcd60e51b815260206004820152601b60248201527f4c7a52656365697665723a20696e76616c6964207061796c6f616400000000006044820152606401610af0565b61ffff86166000908152600260205260408082209051611fa690889061430b565b90815260408051918290036020908101832067ffffffffffffffff89166000908152915220919091557f66ad5c8a00000000000000000000000000000000000000000000000000000000815230906366ad5c8a9061201090899089908990899089906004016144e0565b600060405180830381600087803b15801561202a57600080fd5b505af115801561203e573d6000803e3d6000fd5b50505050505050505050565b60098054611307906147af565b600d8054611307906147af565b60005473ffffffffffffffffffffffffffffffffffffffff1633146120cb5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610af0565b61ffff831660009081526001602052604090206120e9908383613935565b507ffa41487ad5d6728f0b19276fa1eddc16558578f5109fc39d2dc33c3230470dab83838360405161211d939291906144c2565b60405180910390a1505050565b612172338989898080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508b92508a91508990508888612a49565b5050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146121e35760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610af0565b806121f057611caf6130da565b611caf6131a1565b60005473ffffffffffffffffffffffffffffffffffffffff16331461225f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610af0565b73ffffffffffffffffffffffffffffffffffffffff81166122e85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610af0565b611caf81612d1f565b60005473ffffffffffffffffffffffffffffffffffffffff1633146123585760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610af0565b601080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b6040517f096568f60000000000000000000000000000000000000000000000000000000081523060048201526060907f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd67573ffffffffffffffffffffffffffffffffffffffff169063f5ecbdbc90829063096568f69060240160206040518083038186803b15801561241557600080fd5b505afa158015612429573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061244d9190613e4b565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16815261ffff918216600482015290871660248201523060448201526064810185905260840160006040518083038186803b1580156124b457600080fd5b505afa1580156124c8573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820160405261250e9190810190613d71565b90505b949350505050565b6040517f66ad5c8a00000000000000000000000000000000000000000000000000000000815230906366ad5c8a9061255b90879087908790879060040161452c565b600060405180830381600087803b15801561257557600080fd5b505af1925050508015612586575060015b610b05578080519060200120600260008661ffff1661ffff168152602001908152602001600020846040516125bb919061430b565b90815260408051918290036020908101832067ffffffffffffffff87166000908152915220919091557fe6f254030bcb01ffd20558175c13fcaed6d1520be7becee4c961b65f79243b0d9061261790869086908690869061452c565b60405180910390a1610b05565b600081815260076020526040902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8416908117909155819061267e82611588565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60008181526005602052604081205473ffffffffffffffffffffffffffffffffffffffff1661275b5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201527f697374656e7420746f6b656e00000000000000000000000000000000000000006064820152608401610af0565b600061276683611588565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614806127d557508373ffffffffffffffffffffffffffffffffffffffff166127bd84610d90565b73ffffffffffffffffffffffffffffffffffffffff16145b80612511575073ffffffffffffffffffffffffffffffffffffffff80821660009081526008602090815260408083209388168352929052205460ff16612511565b8273ffffffffffffffffffffffffffffffffffffffff1661283682611588565b73ffffffffffffffffffffffffffffffffffffffff16146128bf5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201527f6f776e65720000000000000000000000000000000000000000000000000000006064820152608401610af0565b73ffffffffffffffffffffffffffffffffffffffff82166129475760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610af0565b612952600082612624565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260066020526040812080546001929061298890849061476c565b909155505073ffffffffffffffffffffffffffffffffffffffff821660009081526006602052604081208054600192906129c3908490614740565b909155505060008181526005602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff86811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b612a5333866126c4565b612ac55760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f7665640000000000000000000000000000006064820152608401610af0565b612ad188888888613247565b60008686604051602001612ae692919061443f565b6040516020818303038152906040529050612b3a8882878787878080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506132a392505050565b6040517f7a14574800000000000000000000000000000000000000000000000000000000815261ffff891660048201523060248201526000907f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd67573ffffffffffffffffffffffffffffffffffffffff1690637a1457489060440160206040518083038186803b158015612bcc57600080fd5b505afa158015612be0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c04919061424d565b905087604051612c14919061430b565b6040805191829003822089835267ffffffffffffffff841660208401529161ffff8c169173ffffffffffffffffffffffffffffffffffffffff8e16917f024797cc77ce15dc717112d54fb1df125fdfd8c81344fb046c5e074427ce1543910160405180910390a461203e565b60008082806020019051810190612c979190613da4565b60148201519193509150612cac8782846133e1565b6040805161ffff8916815273ffffffffffffffffffffffffffffffffffffffff8316602082015290810183905267ffffffffffffffff861660608201527fd4d39d20f72eabd06c301e516d54653dfc9116de62c1d54bf1cb48cf3b42a7db9060800160405180910390a150505050505050565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6115848282604051806020016040528060008152506133eb565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612e2a5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610af0565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526008602090815260408083209487168084529482529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b612ecd848484612816565b612ed984848484613474565b610b055760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610af0565b606060098054610bff906147af565b606081612f9a57505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115612fc45780612fae81614803565b9150612fbd9050600a83614758565b9150612f9e565b60008167ffffffffffffffff811115613006577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015613030576020820181803683370190505b5090505b84156125115761304560018361476c565b9150613052600a8661483c565b61305d906030614740565b60f81b818381518110613099577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506130d3600a86614758565b9450613034565b600a5460ff1661312c5760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610af0565b600a80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1565b600a5460ff16156131f45760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610af0565b600a80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586131773390565b600a5460ff161561329a5760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610af0565b610b0581613656565b61ffff8516600090815260016020526040902080546132c1906147af565b151590506133375760405162461bcd60e51b815260206004820152603260248201527f4c7a53656e643a2064657374696e6174696f6e20636861696e206973206e6f7460448201527f2061207472757374656420736f757263652e00000000000000000000000000006064820152608401610af0565b61ffff85166000908152600160205260409081902090517fc580310000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd675169163c58031009134916133c8918a91908a908a908a908a90600401614576565b6000604051808303818588803b15801561202a57600080fd5b610fa48282612d94565b6133f58383613723565b6134026000848484613474565b610fa45760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610af0565b600073ffffffffffffffffffffffffffffffffffffffff84163b1561364e576040517f150b7a0200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85169063150b7a02906134eb9033908990889088906004016143e3565b602060405180830381600087803b15801561350557600080fd5b505af1925050508015613553575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820190925261355091810190613d55565b60015b613603573d808015613581576040519150601f19603f3d011682016040523d82523d6000602084013e613586565b606091505b5080516135fb5760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610af0565b805181602001fd5b7fffffffff00000000000000000000000000000000000000000000000000000000167f150b7a0200000000000000000000000000000000000000000000000000000000149050612511565b506001612511565b600061366182611588565b905061366e600083612624565b73ffffffffffffffffffffffffffffffffffffffff811660009081526006602052604081208054600192906136a490849061476c565b909155505060008281526005602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001690555183919073ffffffffffffffffffffffffffffffffffffffff8416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b73ffffffffffffffffffffffffffffffffffffffff82166137865760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610af0565b60008181526005602052604090205473ffffffffffffffffffffffffffffffffffffffff16156137f85760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610af0565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260066020526040812080546001929061382e908490614740565b909155505060008181526005602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b8280546138bd906147af565b90600052602060002090601f0160209004810192826138df5760008555613925565b82601f106138f857805160ff1916838001178555613925565b82800160010185558215613925579182015b8281111561392557825182559160200191906001019061390a565b506139319291506139c7565b5090565b828054613941906147af565b90600052602060002090601f0160209004810192826139635760008555613925565b82601f1061399a578280017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00823516178555613925565b82800160010185558215613925579182015b828111156139255782358255916020019190600101906139ac565b5b8082111561393157600081556001016139c8565b60006139ef6139ea846146fa565b6146ab565b9050828152838383011115613a0357600080fd5b828260208301376000602084830101529392505050565b80358015158114613a2a57600080fd5b919050565b60008083601f840112613a40578182fd5b50813567ffffffffffffffff811115613a57578182fd5b602083019150836020828501011115613a6f57600080fd5b9250929050565b600082601f830112613a86578081fd5b613a95838335602085016139dc565b9392505050565b600082601f830112613aac578081fd5b8151613aba6139ea826146fa565b818152846020838601011115613ace578283fd5b612511826020830160208701614783565b600060208284031215613af0578081fd5b8135613a95816148dd565b600060208284031215613b0c578081fd5b8151613a95816148dd565b60008060408385031215613b29578081fd5b8235613b34816148dd565b91506020830135613b44816148dd565b809150509250929050565b600080600060608486031215613b63578081fd5b8335613b6e816148dd565b92506020840135613b7e816148dd565b929592945050506040919091013590565b60008060008060808587031215613ba4578081fd5b8435613baf816148dd565b93506020850135613bbf816148dd565b925060408501359150606085013567ffffffffffffffff811115613be1578182fd5b613bed87828801613a76565b91505092959194509250565b60008060408385031215613c0b578182fd5b8235613c16816148dd565b9150613c2460208401613a1a565b90509250929050565b600080600080600080600080600060e08a8c031215613c4a578485fd5b8935613c55816148dd565b985060208a0135613c658161492d565b975060408a013567ffffffffffffffff80821115613c81578687fd5b613c8d8d838e01613a2f565b909950975060608c0135965060808c01359150613ca9826148dd565b90945060a08b013590613cbb826148dd565b90935060c08b01359080821115613cd0578384fd5b50613cdd8c828d01613a2f565b915080935050809150509295985092959850929598565b60008060408385031215613d06578182fd5b8235613d11816148dd565b946020939093013593505050565b600060208284031215613d30578081fd5b613a9582613a1a565b600060208284031215613d4a578081fd5b8135613a95816148ff565b600060208284031215613d66578081fd5b8151613a95816148ff565b600060208284031215613d82578081fd5b815167ffffffffffffffff811115613d98578182fd5b61251184828501613a9c565b60008060408385031215613db6578182fd5b825167ffffffffffffffff811115613dcc578283fd5b613dd885828601613a9c565b925050602083015190509250929050565b600060208284031215613dfa578081fd5b813567ffffffffffffffff811115613e10578182fd5b8201601f81018413613e20578182fd5b612511848235602084016139dc565b600060208284031215613e40578081fd5b8135613a958161492d565b600060208284031215613e5c578081fd5b8151613a958161492d565b600080600060408486031215613e7b578081fd5b8335613e868161492d565b9250602084013567ffffffffffffffff811115613ea1578182fd5b613ead86828701613a2f565b9497909650939450505050565b60008060008060008060008060c0898b031215613ed5578182fd5b8835613ee08161492d565b9750602089013567ffffffffffffffff80821115613efc578384fd5b613f088c838d01613a2f565b909950975060408b0135965060608b01359150613f24826148dd565b90945060808a013590613f36826148dd565b90935060a08a01359080821115613f4b578384fd5b50613f588b828c01613a2f565b999c989b5096995094979396929594505050565b600080600060608486031215613f80578081fd5b8335613f8b8161492d565b9250602084013567ffffffffffffffff811115613fa6578182fd5b613fb286828701613a76565b925050604084013590509250925092565b60008060008060008060a08789031215613fdb578384fd5b8635613fe68161492d565b9550602087013567ffffffffffffffff80821115614002578586fd5b61400e8a838b01613a76565b96506040890135955061402360608a01613a1a565b94506080890135915080821115614038578384fd5b5061404589828a01613a2f565b979a9699509497509295939492505050565b60008060008060006080868803121561406e578283fd5b85356140798161492d565b9450602086013567ffffffffffffffff80821115614095578485fd5b6140a189838a01613a76565b9550604088013591506140b38261493d565b909350606087013590808211156140c8578283fd5b506140d588828901613a2f565b969995985093965092949392505050565b600080600080608085870312156140fb578182fd5b84356141068161492d565b9350602085013567ffffffffffffffff80821115614122578384fd5b61412e88838901613a76565b9450604087013591506141408261493d565b90925060608601359080821115614155578283fd5b50613bed87828801613a76565b60008060008060808587031215614177578182fd5b84356141828161492d565b935060208501356141928161492d565b925060408501356141a2816148dd565b9396929550929360600135925050565b6000806000806000608086880312156141c9578283fd5b85356141d48161492d565b945060208601356141e48161492d565b935060408601359250606086013567ffffffffffffffff811115614206578182fd5b6140d588828901613a2f565b600060208284031215614223578081fd5b5035919050565b6000806040838503121561423c578182fd5b505080516020909101519092909150565b60006020828403121561425e578081fd5b8151613a958161493d565b81835281816020850137506000806020838501015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b600081518084526142c9816020860160208601614783565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b8183823760009101908152919050565b6000825161431d818460208701614783565b9190910192915050565b6000808354614335816147af565b6001828116801561434d576001811461437c576143a8565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff008416875282870194506143a8565b8786526020808720875b8581101561439f5781548a820152908401908201614386565b50505082870194505b50929695505050505050565b600083516143c6818460208801614783565b8351908301906143da818360208801614783565b01949350505050565b600073ffffffffffffffffffffffffffffffffffffffff80871683528086166020840152508360408301526080606083015261442260808301846142b1565b9695505050505050565b602081526000613a9560208301846142b1565b60408152600061445260408301856142b1565b90508260208301529392505050565b61ffff8716815273ffffffffffffffffffffffffffffffffffffffff8616602082015260a06040820152600061449a60a08301876142b1565b851515606084015282810360808401526144b5818587614269565b9998505050505050505050565b61ffff8416815260406020820152600061250e604083018486614269565b61ffff861681526080602082015260006144fd60808301876142b1565b67ffffffffffffffff861660408401528281036060840152614520818587614269565b98975050505050505050565b61ffff8516815260806020820152600061454960808301866142b1565b67ffffffffffffffff85166040840152828103606084015261456b81856142b1565b979650505050505050565b61ffff871681526000602060c081840152818854614593816147af565b8060c087015260e06001808416600081146145b557600181146145e857614613565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff008516838a015261010089019550614613565b8d8852868820885b8581101561460b5781548b82018601529083019088016145f0565b8a0184019650505b5050505050838103604085015261462a81896142b1565b91505061464f606084018773ffffffffffffffffffffffffffffffffffffffff169052565b73ffffffffffffffffffffffffffffffffffffffff8516608084015282810360a08401526144b581856142b1565b600061ffff80881683528087166020840152508460408301526080606083015261456b608083018486614269565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156146f2576146f26148ae565b604052919050565b600067ffffffffffffffff821115614714576147146148ae565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b6000821982111561475357614753614850565b500190565b6000826147675761476761487f565b500490565b60008282101561477e5761477e614850565b500390565b60005b8381101561479e578181015183820152602001614786565b83811115610b055750506000910152565b600181811c908216806147c357607f821691505b602082108114156147fd577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561483557614835614850565b5060010190565b60008261484b5761484b61487f565b500690565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff81168114611caf57600080fd5b7fffffffff0000000000000000000000000000000000000000000000000000000081168114611caf57600080fd5b61ffff81168114611caf57600080fd5b67ffffffffffffffff81168114611caf57600080fdfea26469706673582212200436acbf3d799727690d5225d66bd4f817721af10138ee3e29ded5bc12ff6d4564736f6c63430008040033
Verified Source Code Full Match
Compiler: v0.8.4+commit.c7e474f2
EVM: istanbul
Optimization: Yes (30000 runs)
LzApp.sol 83 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "./interfaces/ILayerZeroReceiver.sol";
import "./interfaces/ILayerZeroUserApplicationConfig.sol";
import "./interfaces/ILayerZeroEndpoint.sol";
/*
* a generic LzReceiver implementation
*/
abstract contract LzApp is Ownable, ILayerZeroReceiver, ILayerZeroUserApplicationConfig {
ILayerZeroEndpoint internal immutable lzEndpoint;
mapping(uint16 => bytes) internal trustedRemoteLookup;
event SetTrustedRemote(uint16 _srcChainId, bytes _srcAddress);
constructor(address _endpoint) {
lzEndpoint = ILayerZeroEndpoint(_endpoint);
}
function lzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) external override {
// lzReceive must be called by the endpoint for security
require(_msgSender() == address(lzEndpoint));
// if will still block the message pathway from (srcChainId, srcAddress). should not receive message from untrusted remote.
require(_srcAddress.length == trustedRemoteLookup[_srcChainId].length && keccak256(_srcAddress) == keccak256(trustedRemoteLookup[_srcChainId]), "LzReceiver: invalid source sending contract");
_blockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload);
}
// abstract function - the default behaviour of LayerZero is blocking. See: NonblockingLzApp if you dont need to enforce ordered messaging
function _blockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual;
function _lzSend(uint16 _dstChainId, bytes memory _payload, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParam) internal {
require(trustedRemoteLookup[_dstChainId].length != 0, "LzSend: destination chain is not a trusted source.");
lzEndpoint.send{value: msg.value}(_dstChainId, trustedRemoteLookup[_dstChainId], _payload, _refundAddress, _zroPaymentAddress, _adapterParam);
}
//---------------------------UserApplication config----------------------------------------
function getConfig(uint16, uint16 _chainId, address, uint _configType) external view returns (bytes memory) {
return lzEndpoint.getConfig(lzEndpoint.getSendVersion(address(this)), _chainId, address(this), _configType);
}
// generic config for LayerZero user Application
function setConfig(uint16 _version, uint16 _chainId, uint _configType, bytes calldata _config) external override onlyOwner {
lzEndpoint.setConfig(_version, _chainId, _configType, _config);
}
function setSendVersion(uint16 _version) external override onlyOwner {
lzEndpoint.setSendVersion(_version);
}
function setReceiveVersion(uint16 _version) external override onlyOwner {
lzEndpoint.setReceiveVersion(_version);
}
function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) external override onlyOwner {
lzEndpoint.forceResumeReceive(_srcChainId, _srcAddress);
}
// allow owner to set it multiple times.
function setTrustedRemote(uint16 _srcChainId, bytes calldata _srcAddress) external onlyOwner {
trustedRemoteLookup[_srcChainId] = _srcAddress;
emit SetTrustedRemote(_srcChainId, _srcAddress);
}
function isTrustedRemote(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (bool) {
bytes memory trustedSource = trustedRemoteLookup[_srcChainId];
return keccak256(trustedSource) == keccak256(_srcAddress);
}
//--------------------------- VIEW FUNCTION ----------------------------------------
// interacting with the LayerZero Endpoint and remote contracts
function getTrustedRemote(uint16 _chainId) external view returns (bytes memory) {
return trustedRemoteLookup[_chainId];
}
function getLzEndpoint() external view returns (address) {
return address(lzEndpoint);
}
}
ONFT721.sol 95 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "./interfaces/IONFT721.sol";
import "./NonblockingLzApp.sol";
// NOTE: this ONFT contract has no public minting logic.
// must implement your own minting logic in child classes
contract ONFT721 is IONFT721, NonblockingLzApp, ERC721 {
string public baseTokenURI;
constructor(string memory _name, string memory _symbol, address _lzEndpoint) ERC721(_name, _symbol) NonblockingLzApp(_lzEndpoint) {}
function estimateSendFee(uint16 _dstChainId, bytes memory _toAddress, uint _tokenId, bool _payInZRO, bytes calldata _adapterParams) external virtual returns (uint nativeFee, uint _zroFee) {
bytes memory payload = abi.encode(_toAddress, _tokenId);
return lzEndpoint.estimateFees(_dstChainId, address(this), payload, _payInZRO, _adapterParams);
}
function sendFrom(address _from, uint16 _dstChainId, bytes calldata _toAddress, uint _tokenId, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParam) external payable virtual override {
_send(_from, _dstChainId, _toAddress, _tokenId, _refundAddress, _zroPaymentAddress, _adapterParam);
}
function send(uint16 _dstChainId, bytes calldata _toAddress, uint _tokenId, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParam) external payable virtual override {
_send(_msgSender(), _dstChainId, _toAddress, _tokenId, _refundAddress, _zroPaymentAddress, _adapterParam);
}
function _send(address _from, uint16 _dstChainId, bytes memory _toAddress, uint _tokenId, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParam) internal virtual {
require(_isApprovedOrOwner(_msgSender(), _tokenId), "ERC721: transfer caller is not owner nor approved");
_beforeSend(_from, _dstChainId, _toAddress, _tokenId);
bytes memory payload = abi.encode(_toAddress, _tokenId);
_lzSend(_dstChainId, payload, _refundAddress, _zroPaymentAddress, _adapterParam);
uint64 nonce = lzEndpoint.getOutboundNonce(_dstChainId, address(this));
emit SendToChain(_from, _dstChainId, _toAddress, _tokenId, nonce);
_afterSend(_from, _dstChainId, _toAddress, _tokenId);
}
function _nonblockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual override {
_beforeReceive(_srcChainId, _srcAddress, _payload);
// decode and load the toAddress
(bytes memory toAddress, uint tokenId) = abi.decode(_payload, (bytes, uint));
address localToAddress;
assembly {
localToAddress := mload(add(toAddress, 20))
}
// if the toAddress is 0x0, convert to dead address, or it will get cached
if (localToAddress == address(0x0)) localToAddress == address(0xdEaD);
_afterReceive(_srcChainId, localToAddress, tokenId);
emit ReceiveFromChain(_srcChainId, localToAddress, tokenId, _nonce);
}
function _beforeSend(
address, /* _from */
uint16, /* _dstChainId */
bytes memory, /* _toAddress */
uint _tokenId
) internal virtual {
_burn(_tokenId);
}
function _afterSend(
address, /* _from */
uint16, /* _dstChainId */
bytes memory, /* _toAddress */
uint /* _tokenId */
) internal virtual {}
function _beforeReceive(
uint16, /* _srcChainId */
bytes memory, /* _srcAddress */
bytes memory /* _payload */
) internal virtual {}
function _afterReceive(
uint16, /* _srcChainId */
address _toAddress,
uint _tokenId
) internal virtual {
_safeMint(_toAddress, _tokenId);
}
function setBaseURI(string memory _baseTokenURI) public onlyOwner {
baseTokenURI = _baseTokenURI;
}
function _baseURI() internal view override returns (string memory) {
return baseTokenURI;
}
}
ONFTBased.sol 96 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8;
import "@openzeppelin/contracts/security/Pausable.sol";
import "./ONFT721.sol";
contract ONFTBased is ONFT721, Pausable {
using Strings for uint;
uint public startMintId;
uint public immutable endMintId;
uint public startHonoraryMintId;
string public contractURI;
string public customName;
string public customSymbol;
bool public reveal;
IERC721 public immutable erc721Contract;
/// @notice Constructor for the ONFTBased
/// @param _name the name of the token
/// @param _symbol the token symbol
/// @param _baseTokenURI the base URI for computing the tokenURI
/// @param _layerZeroEndpoint handles message transmission across chains
/// @param _startMintId the starting mint number on this chain
/// @param _endMintId the max number of mints on this chain
/// @param _startHonoraryMintId the starting honorary mint number on this chain
/// @param _erc721Address the address of the original erc721Address
constructor(string memory _name, string memory _symbol, string memory _baseTokenURI, address _layerZeroEndpoint, uint _startMintId, uint _endMintId, uint _startHonoraryMintId, address _erc721Address) ONFT721(_name, _symbol, _layerZeroEndpoint) {
customName = _name;
customSymbol = _symbol;
setBaseURI(_baseTokenURI);
contractURI = _baseTokenURI;
startMintId = _startMintId;
endMintId = _endMintId;
startHonoraryMintId = _startHonoraryMintId;
erc721Contract = IERC721(_erc721Address);
_pause();
}
function mintHonorary(address to) external onlyOwner {
_safeMint(to, startHonoraryMintId++);
}
function assignNewONFT(uint amount) external onlyOwner {
uint numOfLoops = startMintId + amount;
for (uint i = startMintId; i < numOfLoops; i++) {
require(startMintId <= endMintId, "ONFT: Max Mint limit reached.");
try erc721Contract.ownerOf(i) returns (address toAddress) {
_safeMint(toAddress, startMintId++);
} catch {
_safeMint(address(0xdEaD), startMintId++);
}
}
}
function _beforeSend(address, uint16, bytes memory, uint _tokenId) internal override whenNotPaused {
_burn(_tokenId);
}
function pauseSendTokens(bool pause) external onlyOwner {
pause ? _pause() : _unpause();
}
function activateReveal() external onlyOwner {
reveal = true;
}
function tokenURI(uint tokenId) public view override returns (string memory) {
if (reveal) {
return string(abi.encodePacked(_baseURI(), tokenId.toString()));
}
return _baseURI();
}
function setContractURI(string memory _contractURI) public onlyOwner {
contractURI = _contractURI;
}
function setName(string memory name) external onlyOwner {
customName = name;
}
function setSymbol(string memory symbol) external onlyOwner {
customSymbol = symbol;
}
function name() public view virtual override returns (string memory) {
return customName;
}
function symbol() public view virtual override returns (string memory) {
return customSymbol;
}
}
NonblockingLzApp.sol 49 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./LzApp.sol";
/*
* the default LayerZero messaging behaviour is blocking, i.e. any failed message will block the channel
* this abstract class try-catch all fail messages and store locally for future retry. hence, non-blocking
* NOTE: if the srcAddress is not configured properly, it will still block the message pathway from (srcChainId, srcAddress)
*/
abstract contract NonblockingLzApp is LzApp {
constructor(address _endpoint) LzApp(_endpoint) {}
mapping(uint16 => mapping(bytes => mapping(uint => bytes32))) public failedMessages;
event MessageFailed(uint16 _srcChainId, bytes _srcAddress, uint64 _nonce, bytes _payload);
// overriding the virtual function in LzReceiver
function _blockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual override {
// try-catch all errors/exceptions
try this.nonblockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload) {
// do nothing
} catch {
// error / exception
failedMessages[_srcChainId][_srcAddress][_nonce] = keccak256(_payload);
emit MessageFailed(_srcChainId, _srcAddress, _nonce, _payload);
}
}
function nonblockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) public virtual {
// only internal transaction
require(_msgSender() == address(this), "LzReceiver: caller must be Bridge.");
_nonblockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload);
}
//@notice override this function
function _nonblockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual;
function retryMessage(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes calldata _payload) external payable virtual {
// assert there is message to retry
bytes32 payloadHash = failedMessages[_srcChainId][_srcAddress][_nonce];
require(payloadHash != bytes32(0), "LzReceiver: no stored message");
require(keccak256(_payload) == payloadHash, "LzReceiver: invalid payload");
// clear the stored message
failedMessages[_srcChainId][_srcAddress][_nonce] = bytes32(0);
// execute the message. revert if it fails again
this.nonblockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload);
}
}
IONFT721.sol 36 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
/**
* @dev Interface of the ONFT standard
*/
interface IONFT721 is IERC721 {
/**
* @dev send token `_tokenId` to (`_dstChainId`, `_toAddress`)
* `_toAddress` can be any size depending on the `dstChainId`.
* `_zroPaymentAddress` set to address(0x0) if not paying in ZRO (LayerZero Token)
* `_adapterParam` is a flexible bytes array to indicate messaging adapter services
*/
function send(uint16 _dstChainId, bytes calldata _toAddress, uint _tokenId, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParam) external payable;
/**
* @dev send token `_tokenId` to (`_dstChainId`, `_toAddress`) from `_from`
* `_toAddress` can be any size depending on the `dstChainId`.
* `_zroPaymentAddress` set to address(0x0) if not paying in ZRO (LayerZero Token)
* `_adapterParam` is a flexible bytes array to indicate messaging adapter services
*/
function sendFrom(address _from, uint16 _dstChainId, bytes calldata _toAddress, uint _tokenId, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParam) external payable;
/**
* @dev Emitted when `_tokenId` are moved from the `_sender` to (`_dstChainId`, `_toAddress`)
* `_nonce` is the outbound nonce from
*/
event SendToChain(address indexed _sender, uint16 indexed _dstChainId, bytes indexed _toAddress, uint _tokenId, uint64 _nonce);
/**
* @dev Emitted when `_tokenId` are sent from `_srcChainId` to the `_toAddress` at this chain. `_nonce` is the inbound nonce.
*/
event ReceiveFromChain(uint16 _srcChainId, address _toAddress, uint _tokenId, uint64 _nonce);
}
Address.sol 222 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @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;
}
}
Strings.sol 67 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
Ownable.sol 76 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @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.
*
* By default, the owner account will be the one that deploys the contract. 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;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing 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 {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_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);
}
}
ILayerZeroEndpoint.sol 86 lines
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0;
import "./ILayerZeroUserApplicationConfig.sol";
interface ILayerZeroEndpoint is ILayerZeroUserApplicationConfig {
// @notice send a LayerZero message to the specified address at a LayerZero endpoint.
// @param _dstChainId - the destination chain identifier
// @param _destination - the address on destination chain (in bytes). address length/format may vary by chains
// @param _payload - a custom bytes payload to send to the destination contract
// @param _refundAddress - if the source transaction is cheaper than the amount of value passed, refund the additional amount to this address
// @param _zroPaymentAddress - the address of the ZRO token holder who would pay for the transaction
// @param _adapterParams - parameters for custom functionality. e.g. receive airdropped native gas from the relayer on destination
function send(uint16 _dstChainId, bytes calldata _destination, bytes calldata _payload, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams) external payable;
// @notice used by the messaging library to publish verified payload
// @param _srcChainId - the source chain identifier
// @param _srcAddress - the source contract (as bytes) at the source chain
// @param _dstAddress - the address on destination chain
// @param _nonce - the unbound message ordering nonce
// @param _gasLimit - the gas limit for external contract execution
// @param _payload - verified payload to send to the destination contract
function receivePayload(uint16 _srcChainId, bytes calldata _srcAddress, address _dstAddress, uint64 _nonce, uint _gasLimit, bytes calldata _payload) external;
// @notice get the inboundNonce of a lzApp from a source chain which could be EVM or non-EVM chain
// @param _srcChainId - the source chain identifier
// @param _srcAddress - the source chain contract address
function getInboundNonce(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (uint64);
// @notice get the outboundNonce from this source chain which, consequently, is always an EVM
// @param _srcAddress - the source chain contract address
function getOutboundNonce(uint16 _dstChainId, address _srcAddress) external view returns (uint64);
// @notice gets a quote in source native gas, for the amount that send() requires to pay for message delivery
// @param _dstChainId - the destination chain identifier
// @param _userApplication - the user app address on this EVM chain
// @param _payload - the custom message to send over LayerZero
// @param _payInZRO - if false, user app pays the protocol fee in native token
// @param _adapterParam - parameters for the adapter service, e.g. send some dust native token to dstChain
function estimateFees(uint16 _dstChainId, address _userApplication, bytes calldata _payload, bool _payInZRO, bytes calldata _adapterParam) external view returns (uint nativeFee, uint zroFee);
// @notice get this Endpoint's immutable source identifier
function getChainId() external view returns (uint16);
// @notice the interface to retry failed message on this Endpoint destination
// @param _srcChainId - the source chain identifier
// @param _srcAddress - the source chain contract address
// @param _payload - the payload to be retried
function retryPayload(uint16 _srcChainId, bytes calldata _srcAddress, bytes calldata _payload) external;
// @notice query if any STORED payload (message blocking) at the endpoint.
// @param _srcChainId - the source chain identifier
// @param _srcAddress - the source chain contract address
function hasStoredPayload(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (bool);
// @notice query if the _libraryAddress is valid for sending msgs.
// @param _userApplication - the user app address on this EVM chain
function getSendLibraryAddress(address _userApplication) external view returns (address);
// @notice query if the _libraryAddress is valid for receiving msgs.
// @param _userApplication - the user app address on this EVM chain
function getReceiveLibraryAddress(address _userApplication) external view returns (address);
// @notice query if the non-reentrancy guard for send() is on
// @return true if the guard is on. false otherwise
function isSendingPayload() external view returns (bool);
// @notice query if the non-reentrancy guard for receive() is on
// @return true if the guard is on. false otherwise
function isReceivingPayload() external view returns (bool);
// @notice get the configuration of the LayerZero messaging library of the specified version
// @param _version - messaging library version
// @param _chainId - the chainId for the pending config change
// @param _userApplication - the contract address of the user application
// @param _configType - type of configuration. every messaging library has its own convention.
function getConfig(uint16 _version, uint16 _chainId, address _userApplication, uint _configType) external view returns (bytes memory);
// @notice get the send() LayerZero messaging library version
// @param _userApplication - the contract address of the user application
function getSendVersion(address _userApplication) external view returns (uint16);
// @notice get the lzReceive() LayerZero messaging library version
// @param _userApplication - the contract address of the user application
function getReceiveVersion(address _userApplication) external view returns (uint16);
}
ILayerZeroReceiver.sol 11 lines
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0;
interface ILayerZeroReceiver {
// @notice LayerZero endpoint will invoke this function to deliver the message on the destination
// @param _srcChainId - the source endpoint identifier
// @param _srcAddress - the source sending contract address from the source chain
// @param _nonce - the ordered message nonce
// @param _payload - the signed payload is the UA bytes has encoded to be sent
function lzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) external;
}
Pausable.sol 91 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract Pausable is Context {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
constructor() {
_paused = false;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
require(!paused(), "Pausable: paused");
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
require(paused(), "Pausable: not paused");
_;
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}
ERC721.sol 447 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/ERC721.sol)
pragma solidity ^0.8.0;
import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}.
*/
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _owners;
// Mapping owner address to token count
mapping(address => uint256) private _balances;
// Mapping from token ID to approved address
mapping(uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _balances[owner];
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _owners[tokenId];
require(owner != address(0), "ERC721: owner query for nonexistent token");
return owner;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overriden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
_setApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_safeTransfer(from, to, tokenId, _data);
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* `_data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
/**
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
_afterTokenTransfer(address(0), to, tokenId);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
_afterTokenTransfer(owner, address(0), tokenId);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_balances[from] -= 1;
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
_afterTokenTransfer(from, to, tokenId);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
/**
* @dev Approve `operator` to operate on all of `owner` tokens
*
* Emits a {ApprovalForAll} event.
*/
function _setApprovalForAll(
address owner,
address operator,
bool approved
) internal virtual {
require(owner != operator, "ERC721: approve to caller");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver.onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721: transfer to non ERC721Receiver implementer");
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
}
IERC721.sol 143 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
ERC165.sol 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
IERC165.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* 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[EIP 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);
}
IERC721Receiver.sol 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
ILayerZeroUserApplicationConfig.sol 24 lines
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0;
interface ILayerZeroUserApplicationConfig {
// @notice set the configuration of the LayerZero messaging library of the specified version
// @param _version - messaging library version
// @param _chainId - the chainId for the pending config change
// @param _configType - type of configuration. every messaging library has its own convention.
// @param _config - configuration in the bytes. can encode arbitrary content.
function setConfig(uint16 _version, uint16 _chainId, uint _configType, bytes calldata _config) external;
// @notice set the send() LayerZero messaging library version to _version
// @param _version - new messaging library version
function setSendVersion(uint16 _version) external;
// @notice set the lzReceive() LayerZero messaging library version to _version
// @param _version - new messaging library version
function setReceiveVersion(uint16 _version) external;
// @notice Only when the UA needs to resume the message flow in blocking mode and clear the stored payload
// @param _srcChainId - the chainId of the source chain
// @param _srcAddress - the contract address of the source contract at the source chain
function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) external;
}
IERC721Metadata.sol 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
Read Contract
balanceOf 0x70a08231 → uint256
baseTokenURI 0xd547cfb7 → string
contractURI 0xe8a3d485 → string
customName 0x8d81592a → string
customSymbol 0x3f388b33 → string
endMintId 0xd0f62e1b → uint256
erc721Contract 0xd7c97fb4 → address
failedMessages 0x8ee74912 → bytes32
getApproved 0x081812fc → address
getConfig 0xf5ecbdbc → bytes
getLzEndpoint 0xdacbcbe2 → address
getTrustedRemote 0x69b41f95 → bytes
isApprovedForAll 0xe985e9c5 → bool
isTrustedRemote 0x3d8b38f6 → bool
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
paused 0x5c975abb → bool
reveal 0xa475b5dd → bool
startHonoraryMintId 0x1bc103bf → uint256
startMintId 0x36ecd177 → uint256
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenURI 0xc87b56dd → string
Write Contract 26 functions
These functions modify contract state and require a wallet transaction to execute.
activateReveal 0xf5a8622a
No parameters
approve 0x095ea7b3
address to
uint256 tokenId
assignNewONFT 0x9aac0d05
uint256 amount
estimateSendFee 0x2a205e3d
uint16 _dstChainId
bytes _toAddress
uint256 _tokenId
bool _payInZRO
bytes _adapterParams
returns: uint256, uint256
forceResumeReceive 0x42d65a8d
uint16 _srcChainId
bytes _srcAddress
lzReceive 0x001d3567
uint16 _srcChainId
bytes _srcAddress
uint64 _nonce
bytes _payload
mintHonorary 0xbcc4efba
address to
nonblockingLzReceive 0x66ad5c8a
uint16 _srcChainId
bytes _srcAddress
uint64 _nonce
bytes _payload
pauseSendTokens 0xf1878922
bool pause
renounceOwnership 0x715018a6
No parameters
retryMessage 0xd1deba1f
uint16 _srcChainId
bytes _srcAddress
uint64 _nonce
bytes _payload
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
send 0xeed33cef
uint16 _dstChainId
bytes _toAddress
uint256 _tokenId
address _refundAddress
address _zroPaymentAddress
bytes _adapterParam
sendFrom 0x51905636
address _from
uint16 _dstChainId
bytes _toAddress
uint256 _tokenId
address _refundAddress
address _zroPaymentAddress
bytes _adapterParam
setApprovalForAll 0xa22cb465
address operator
bool approved
setBaseURI 0x55f804b3
string _baseTokenURI
setConfig 0xcbed8b9c
uint16 _version
uint16 _chainId
uint256 _configType
bytes _config
setContractURI 0x938e3d7b
string _contractURI
setName 0xc47f0027
string name
setReceiveVersion 0x10ddb137
uint16 _version
setSendVersion 0x07e0db17
uint16 _version
setSymbol 0xb84c8246
string symbol
setTrustedRemote 0xeb8d72b7
uint16 _srcChainId
bytes _srcAddress
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
Recent Transactions
No transactions found for this address