chain_id
uint64
1
1
block_number
uint64
19.5M
20M
block_hash
stringlengths
64
64
transaction_hash
stringlengths
64
64
deployer_address
stringlengths
40
40
factory_address
stringlengths
40
40
contract_address
stringlengths
40
40
creation_bytecode
stringlengths
0
98.3k
runtime_bytecode
stringlengths
0
49.2k
creation_sourcecode
stringlengths
0
976k
1
19,493,344
a153b5645fc9907b3a0dd456f16d3c865c78901465107e66f5e60125fe12285c
8579938c8fb1cb18710a9b3ad7175ecca340cc479b0bd71009e3b6b36bcf3a2c
98f62d5e3cc0cab1ebc5fa6acac9b66a430788f2
306d948f23b2a8472e4953db2d2dc72c8b6df0eb
7935d30a6ca725b66f52f5650c4e910d5d12fbbf
3d602d80600a3d3981f3363d3d373d3d3d363d737f4dc78748cf4a3382d5986d3ae31b6c6b2e75175af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d737f4dc78748cf4a3382d5986d3ae31b6c6b2e75175af43d82803e903d91602b57fd5bf3
1
19,493,344
a153b5645fc9907b3a0dd456f16d3c865c78901465107e66f5e60125fe12285c
8579938c8fb1cb18710a9b3ad7175ecca340cc479b0bd71009e3b6b36bcf3a2c
98f62d5e3cc0cab1ebc5fa6acac9b66a430788f2
306d948f23b2a8472e4953db2d2dc72c8b6df0eb
98d3c2f4f3f3ee4ecc273624ecd05ada650162b6
3d602d80600a3d3981f3363d3d373d3d3d363d737f4dc78748cf4a3382d5986d3ae31b6c6b2e75175af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d737f4dc78748cf4a3382d5986d3ae31b6c6b2e75175af43d82803e903d91602b57fd5bf3
1
19,493,344
a153b5645fc9907b3a0dd456f16d3c865c78901465107e66f5e60125fe12285c
8579938c8fb1cb18710a9b3ad7175ecca340cc479b0bd71009e3b6b36bcf3a2c
98f62d5e3cc0cab1ebc5fa6acac9b66a430788f2
306d948f23b2a8472e4953db2d2dc72c8b6df0eb
1b89ec5a411fec04e159bf4bed6807cfaeddacbf
3d602d80600a3d3981f3363d3d373d3d3d363d737f4dc78748cf4a3382d5986d3ae31b6c6b2e75175af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d737f4dc78748cf4a3382d5986d3ae31b6c6b2e75175af43d82803e903d91602b57fd5bf3
1
19,493,344
a153b5645fc9907b3a0dd456f16d3c865c78901465107e66f5e60125fe12285c
8579938c8fb1cb18710a9b3ad7175ecca340cc479b0bd71009e3b6b36bcf3a2c
98f62d5e3cc0cab1ebc5fa6acac9b66a430788f2
306d948f23b2a8472e4953db2d2dc72c8b6df0eb
b71fe565ab361c63a32cd8f473ce9e1450beab83
3d602d80600a3d3981f3363d3d373d3d3d363d737f4dc78748cf4a3382d5986d3ae31b6c6b2e75175af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d737f4dc78748cf4a3382d5986d3ae31b6c6b2e75175af43d82803e903d91602b57fd5bf3
1
19,493,344
a153b5645fc9907b3a0dd456f16d3c865c78901465107e66f5e60125fe12285c
8579938c8fb1cb18710a9b3ad7175ecca340cc479b0bd71009e3b6b36bcf3a2c
98f62d5e3cc0cab1ebc5fa6acac9b66a430788f2
306d948f23b2a8472e4953db2d2dc72c8b6df0eb
db5928cdb6a6134210dd670bfa99fbcfa904a374
3d602d80600a3d3981f3363d3d373d3d3d363d737f4dc78748cf4a3382d5986d3ae31b6c6b2e75175af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d737f4dc78748cf4a3382d5986d3ae31b6c6b2e75175af43d82803e903d91602b57fd5bf3
1
19,493,344
a153b5645fc9907b3a0dd456f16d3c865c78901465107e66f5e60125fe12285c
8579938c8fb1cb18710a9b3ad7175ecca340cc479b0bd71009e3b6b36bcf3a2c
98f62d5e3cc0cab1ebc5fa6acac9b66a430788f2
306d948f23b2a8472e4953db2d2dc72c8b6df0eb
0299e0adcca8915b3030b15c80ecb3e271ab4315
3d602d80600a3d3981f3363d3d373d3d3d363d737f4dc78748cf4a3382d5986d3ae31b6c6b2e75175af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d737f4dc78748cf4a3382d5986d3ae31b6c6b2e75175af43d82803e903d91602b57fd5bf3
1
19,493,344
a153b5645fc9907b3a0dd456f16d3c865c78901465107e66f5e60125fe12285c
8579938c8fb1cb18710a9b3ad7175ecca340cc479b0bd71009e3b6b36bcf3a2c
98f62d5e3cc0cab1ebc5fa6acac9b66a430788f2
306d948f23b2a8472e4953db2d2dc72c8b6df0eb
2bcfe6ef4b018659109cfdcc4b0b51621ed4b4e8
3d602d80600a3d3981f3363d3d373d3d3d363d737f4dc78748cf4a3382d5986d3ae31b6c6b2e75175af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d737f4dc78748cf4a3382d5986d3ae31b6c6b2e75175af43d82803e903d91602b57fd5bf3
1
19,493,344
a153b5645fc9907b3a0dd456f16d3c865c78901465107e66f5e60125fe12285c
8579938c8fb1cb18710a9b3ad7175ecca340cc479b0bd71009e3b6b36bcf3a2c
98f62d5e3cc0cab1ebc5fa6acac9b66a430788f2
306d948f23b2a8472e4953db2d2dc72c8b6df0eb
bd0eab72a833bd604115b4e8b40f8a406f989e72
3d602d80600a3d3981f3363d3d373d3d3d363d737f4dc78748cf4a3382d5986d3ae31b6c6b2e75175af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d737f4dc78748cf4a3382d5986d3ae31b6c6b2e75175af43d82803e903d91602b57fd5bf3
1
19,493,344
a153b5645fc9907b3a0dd456f16d3c865c78901465107e66f5e60125fe12285c
8579938c8fb1cb18710a9b3ad7175ecca340cc479b0bd71009e3b6b36bcf3a2c
98f62d5e3cc0cab1ebc5fa6acac9b66a430788f2
306d948f23b2a8472e4953db2d2dc72c8b6df0eb
0f6e9bda432df1f59f7ef2d1922abd15b5984967
3d602d80600a3d3981f3363d3d373d3d3d363d737f4dc78748cf4a3382d5986d3ae31b6c6b2e75175af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d737f4dc78748cf4a3382d5986d3ae31b6c6b2e75175af43d82803e903d91602b57fd5bf3
1
19,493,344
a153b5645fc9907b3a0dd456f16d3c865c78901465107e66f5e60125fe12285c
8579938c8fb1cb18710a9b3ad7175ecca340cc479b0bd71009e3b6b36bcf3a2c
98f62d5e3cc0cab1ebc5fa6acac9b66a430788f2
306d948f23b2a8472e4953db2d2dc72c8b6df0eb
760d79116ee1a7ddd89b25be2a262058c60c9d44
3d602d80600a3d3981f3363d3d373d3d3d363d737f4dc78748cf4a3382d5986d3ae31b6c6b2e75175af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d737f4dc78748cf4a3382d5986d3ae31b6c6b2e75175af43d82803e903d91602b57fd5bf3
1
19,493,344
a153b5645fc9907b3a0dd456f16d3c865c78901465107e66f5e60125fe12285c
8579938c8fb1cb18710a9b3ad7175ecca340cc479b0bd71009e3b6b36bcf3a2c
98f62d5e3cc0cab1ebc5fa6acac9b66a430788f2
306d948f23b2a8472e4953db2d2dc72c8b6df0eb
3df8c4f4a22be2f1ee0a96fe6e400374693d0112
3d602d80600a3d3981f3363d3d373d3d3d363d737f4dc78748cf4a3382d5986d3ae31b6c6b2e75175af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d737f4dc78748cf4a3382d5986d3ae31b6c6b2e75175af43d82803e903d91602b57fd5bf3
1
19,493,344
a153b5645fc9907b3a0dd456f16d3c865c78901465107e66f5e60125fe12285c
8579938c8fb1cb18710a9b3ad7175ecca340cc479b0bd71009e3b6b36bcf3a2c
98f62d5e3cc0cab1ebc5fa6acac9b66a430788f2
306d948f23b2a8472e4953db2d2dc72c8b6df0eb
5a6209a31734c1f3c5d09cc3199434b4a5b2cd86
3d602d80600a3d3981f3363d3d373d3d3d363d737f4dc78748cf4a3382d5986d3ae31b6c6b2e75175af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d737f4dc78748cf4a3382d5986d3ae31b6c6b2e75175af43d82803e903d91602b57fd5bf3
1
19,493,344
a153b5645fc9907b3a0dd456f16d3c865c78901465107e66f5e60125fe12285c
8579938c8fb1cb18710a9b3ad7175ecca340cc479b0bd71009e3b6b36bcf3a2c
98f62d5e3cc0cab1ebc5fa6acac9b66a430788f2
306d948f23b2a8472e4953db2d2dc72c8b6df0eb
f207c558ec9ab0d3d24f009fe660abfb839ac14e
3d602d80600a3d3981f3363d3d373d3d3d363d737f4dc78748cf4a3382d5986d3ae31b6c6b2e75175af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d737f4dc78748cf4a3382d5986d3ae31b6c6b2e75175af43d82803e903d91602b57fd5bf3
1
19,493,344
a153b5645fc9907b3a0dd456f16d3c865c78901465107e66f5e60125fe12285c
8579938c8fb1cb18710a9b3ad7175ecca340cc479b0bd71009e3b6b36bcf3a2c
98f62d5e3cc0cab1ebc5fa6acac9b66a430788f2
306d948f23b2a8472e4953db2d2dc72c8b6df0eb
7f4fbf9316527b2e87225d6ad03bb53ecd6441ad
3d602d80600a3d3981f3363d3d373d3d3d363d737f4dc78748cf4a3382d5986d3ae31b6c6b2e75175af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d737f4dc78748cf4a3382d5986d3ae31b6c6b2e75175af43d82803e903d91602b57fd5bf3
1
19,493,344
a153b5645fc9907b3a0dd456f16d3c865c78901465107e66f5e60125fe12285c
8579938c8fb1cb18710a9b3ad7175ecca340cc479b0bd71009e3b6b36bcf3a2c
98f62d5e3cc0cab1ebc5fa6acac9b66a430788f2
306d948f23b2a8472e4953db2d2dc72c8b6df0eb
d8ef24b04511b7a28ebce3009573363cc1aac209
3d602d80600a3d3981f3363d3d373d3d3d363d737f4dc78748cf4a3382d5986d3ae31b6c6b2e75175af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d737f4dc78748cf4a3382d5986d3ae31b6c6b2e75175af43d82803e903d91602b57fd5bf3
1
19,493,345
5561c16cf22ade420b4238663731c64afeac1fe69d22427e09e2c40fcb3e9e71
26c77af57af101d4c81656434b3bcc5f87ef0a82e8c652f4e08c2f49a856bbe3
ef2dd97639b88d04417606f261683ad757c86f0c
ef2dd97639b88d04417606f261683ad757c86f0c
8658b06a3d3b8a5ab96c6f52b1216c660aa3746c
6080604052670de0b6b3a764000060025566b1a2bc2ec500006003556004805460ff191690557f4c10f6e185a551b454e342e9309ae741455e7f4cda66f4ad2ed1a994d0e86f886007557f4c10f6e185a551b454e342e9558fc33d0edd0a3dc85a9aa98bcd41d2f31c848c6008557f4c10f6e185a551b454e342e9a7f9650ff343653db6df453da9f71b7ed5a3c6e460095534801561009d57600080fd5b50600080546001600160a01b031916331781556007546008546100be911890565b60405163e2d73ccd60e01b81523060048201529091506001600160a01b0382169063e2d73ccd90602401600060405180830381600087803b15801561010257600080fd5b505af1158015610116573d6000803e3d6000fd5b50505050506103678061012a6000396000f3fe6080604052600436106100595760003560e01c80632b42b9411461006557806357ea89b6146100875780639763d29b1461009c578063bedf0f4a146100bc578063eaf67ab9146100d8578063f39d8c65146100e057600080fd5b3661006057005b600080fd5b34801561007157600080fd5b506100856100803660046102f3565b600655565b005b34801561009357600080fd5b50610085610107565b3480156100a857600080fd5b506100856100b73660046102f3565b600555565b3480156100c857600080fd5b506100856004805460ff19169055565b610085610170565b3480156100ec57600080fd5b506100f5610178565b60405190815260200160405180910390f35b6000546001600160a01b031633146101665760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b61016e61019d565b565b61016e610226565b600354600080549091829161019791906001600160a01b03163161030c565b92915050565b6000546001600160a01b031633146101f75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161015d565b60405133904780156108fc02916000818181858888f19350505050158015610223573d6000803e3d6000fd5b50565b60006102356008546009541890565b905060006102466007546008541890565b604051630e26d7a760e41b81523360048201526001600160a01b038481166024830152600060448301524760648301529192509082169063e26d7a7090608401600060405180830381600087803b1580156102a057600080fd5b505af11580156102b4573d6000803e3d6000fd5b50506040516001600160a01b03851692504780156108fc029250906000818181858888f193505050501580156102ee573d6000803e3d6000fd5b505050565b60006020828403121561030557600080fd5b5035919050565b60008282101561032c57634e487b7160e01b600052601160045260246000fd5b50039056fea2646970667358221220ff26c36e24484977641129ff812ceac82d4087d0b1bd30fb1616aa320446960364736f6c63430008070033
6080604052600436106100595760003560e01c80632b42b9411461006557806357ea89b6146100875780639763d29b1461009c578063bedf0f4a146100bc578063eaf67ab9146100d8578063f39d8c65146100e057600080fd5b3661006057005b600080fd5b34801561007157600080fd5b506100856100803660046102f3565b600655565b005b34801561009357600080fd5b50610085610107565b3480156100a857600080fd5b506100856100b73660046102f3565b600555565b3480156100c857600080fd5b506100856004805460ff19169055565b610085610170565b3480156100ec57600080fd5b506100f5610178565b60405190815260200160405180910390f35b6000546001600160a01b031633146101665760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b61016e61019d565b565b61016e610226565b600354600080549091829161019791906001600160a01b03163161030c565b92915050565b6000546001600160a01b031633146101f75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161015d565b60405133904780156108fc02916000818181858888f19350505050158015610223573d6000803e3d6000fd5b50565b60006102356008546009541890565b905060006102466007546008541890565b604051630e26d7a760e41b81523360048201526001600160a01b038481166024830152600060448301524760648301529192509082169063e26d7a7090608401600060405180830381600087803b1580156102a057600080fd5b505af11580156102b4573d6000803e3d6000fd5b50506040516001600160a01b03851692504780156108fc029250906000818181858888f193505050501580156102ee573d6000803e3d6000fd5b505050565b60006020828403121561030557600080fd5b5035919050565b60008282101561032c57634e487b7160e01b600052601160045260246000fd5b50039056fea2646970667358221220ff26c36e24484977641129ff812ceac82d4087d0b1bd30fb1616aa320446960364736f6c63430008070033
1
19,493,350
4abaf811d0417b352d289269ae3073446489ac8985a4dadc710458f30c3a0c05
ed6d147a6182fe91381e8fdbcfc6f6f38c88a898115b2edf89d70514b6d262d5
9fd034836534dae449b9d557f26baacbda812b47
3ee18b2214aff97000d974cf647e7c347e8fa585
b625993d3d49cc701c813d676edc3342cbc56ee1
608060405234801561001057600080fd5b5060405161099338038061099383398101604081905261002f9161048e565b818161005c60017fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d51610599565b60008051602061094c8339815191521461008657634e487b7160e01b600052600160045260246000fd5b6100928282600061009b565b505050506105fe565b6100a483610175565b6040516001600160a01b038416907f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e90600090a26000825111806100e55750805b156101705761016e836001600160a01b0316635c60da1b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561012657600080fd5b505afa15801561013a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061015e9190610474565b8361031560201b6100291760201c565b505b505050565b6101888161034160201b6100551760201c565b6101e75760405162461bcd60e51b815260206004820152602560248201527f455243313936373a206e657720626561636f6e206973206e6f74206120636f6e6044820152641d1c9858dd60da1b60648201526084015b60405180910390fd5b61026a816001600160a01b0316635c60da1b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561022357600080fd5b505afa158015610237573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061025b9190610474565b61034160201b6100551760201c565b6102cf5760405162461bcd60e51b815260206004820152603060248201527f455243313936373a20626561636f6e20696d706c656d656e746174696f6e206960448201526f1cc81b9bdd08184818dbdb9d1c9858dd60821b60648201526084016101de565b806102f460008051602061094c83398151915260001b61034760201b61005b1760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b606061033a838360405180606001604052806027815260200161096c6027913961034a565b9392505050565b3b151590565b90565b6060833b6103a95760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016101de565b600080856001600160a01b0316856040516103c4919061054a565b600060405180830381855af49150503d80600081146103ff576040519150601f19603f3d011682016040523d82523d6000602084013e610404565b606091505b50909250905061041582828661041f565b9695505050505050565b6060831561042e57508161033a565b82511561043e5782518084602001fd5b8160405162461bcd60e51b81526004016101de9190610566565b80516001600160a01b038116811461046f57600080fd5b919050565b600060208284031215610485578081fd5b61033a82610458565b600080604083850312156104a0578081fd5b6104a983610458565b60208401519092506001600160401b03808211156104c5578283fd5b818501915085601f8301126104d8578283fd5b8151818111156104ea576104ea6105e8565b604051601f8201601f19908116603f01168101908382118183101715610512576105126105e8565b8160405282815288602084870101111561052a578586fd5b61053b8360208301602088016105bc565b80955050505050509250929050565b6000825161055c8184602087016105bc565b9190910192915050565b60208152600082518060208401526105858160408501602087016105bc565b601f01601f19169190910160400192915050565b6000828210156105b757634e487b7160e01b81526011600452602481fd5b500390565b60005b838110156105d75781810151838201526020016105bf565b8381111561016e5750506000910152565b634e487b7160e01b600052604160045260246000fd5b61033f8061060d6000396000f3fe60806040523661001357610011610017565b005b6100115b61002761002261005e565b610106565b565b606061004e83836040518060600160405280602781526020016102e36027913961012a565b9392505050565b3b151590565b90565b60006100917fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50546001600160a01b031690565b6001600160a01b0316635c60da1b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100c957600080fd5b505afa1580156100dd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610101919061023c565b905090565b3660008037600080366000845af43d6000803e808015610125573d6000f35b3d6000fd5b6060833b61018e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084015b60405180910390fd5b600080856001600160a01b0316856040516101a99190610263565b600060405180830381855af49150503d80600081146101e4576040519150601f19603f3d011682016040523d82523d6000602084013e6101e9565b606091505b50915091506101f9828286610203565b9695505050505050565b6060831561021257508161004e565b8251156102225782518084602001fd5b8160405162461bcd60e51b8152600401610185919061027f565b60006020828403121561024d578081fd5b81516001600160a01b038116811461004e578182fd5b600082516102758184602087016102b2565b9190910192915050565b602081526000825180602084015261029e8160408501602087016102b2565b601f01601f19169190910160400192915050565b60005b838110156102cd5781810151838201526020016102b5565b838111156102dc576000848401525b5050505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212203e23ac4f79a95247999f8e0df94ea5bd5e38561ccfd051b0ea50ba9aea59b8f164736f6c63430008040033a3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c65640000000000000000000000003ee18b2214aff97000d974cf647e7c347e8fa58500000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000164c71f461500000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000c85810000000000000000000000003ee18b2214aff97000d974cf647e7c347e8fa585000000000000000000000000000000000000000000000000000000000000000103b08830bfc6a38718680844ddf710b54fa239e7e8b009ce2c076b6cac0a5a850000000000000000000000000000000000000000000000000000000000000010426c61636b7320466f72205472756d70000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003424654000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
60806040523661001357610011610017565b005b6100115b61002761002261005e565b610106565b565b606061004e83836040518060600160405280602781526020016102e36027913961012a565b9392505050565b3b151590565b90565b60006100917fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50546001600160a01b031690565b6001600160a01b0316635c60da1b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100c957600080fd5b505afa1580156100dd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610101919061023c565b905090565b3660008037600080366000845af43d6000803e808015610125573d6000f35b3d6000fd5b6060833b61018e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084015b60405180910390fd5b600080856001600160a01b0316856040516101a99190610263565b600060405180830381855af49150503d80600081146101e4576040519150601f19603f3d011682016040523d82523d6000602084013e6101e9565b606091505b50915091506101f9828286610203565b9695505050505050565b6060831561021257508161004e565b8251156102225782518084602001fd5b8160405162461bcd60e51b8152600401610185919061027f565b60006020828403121561024d578081fd5b81516001600160a01b038116811461004e578182fd5b600082516102758184602087016102b2565b9190910192915050565b602081526000825180602084015261029e8160408501602087016102b2565b601f01601f19169190910160400192915050565b60005b838110156102cd5781810151838201526020016102b5565b838111156102dc576000848401525b5050505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212203e23ac4f79a95247999f8e0df94ea5bd5e38561ccfd051b0ea50ba9aea59b8f164736f6c63430008040033
// File: @openzeppelin/contracts/proxy/beacon/IBeacon.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeacon { /** * @dev Must return an address that can be used as a delegate call target. * * {BeaconProxy} will check that this address is a contract. */ function implementation() external view returns (address); } // File: @openzeppelin/contracts/proxy/Proxy.sol pragma solidity ^0.8.0; /** * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to * be specified by overriding the virtual {_implementation} function. * * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a * different contract through the {_delegate} function. * * The success and return data of the delegated call will be returned back to the caller of the proxy. */ abstract contract Proxy { /** * @dev Delegates the current call to `implementation`. * * This function does not return to its internall call site, it will return directly to the external caller. */ function _delegate(address implementation) internal virtual { assembly { // Copy msg.data. We take full control of memory in this inline assembly // block because it will not return to Solidity code. We overwrite the // Solidity scratch pad at memory position 0. calldatacopy(0, 0, calldatasize()) // Call the implementation. // out and outsize are 0 because we don't know the size yet. let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0) // Copy the returned data. returndatacopy(0, 0, returndatasize()) switch result // delegatecall returns 0 on error. case 0 { revert(0, returndatasize()) } default { return(0, returndatasize()) } } } /** * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function * and {_fallback} should delegate. */ function _implementation() internal view virtual returns (address); /** * @dev Delegates the current call to the address returned by `_implementation()`. * * This function does not return to its internall call site, it will return directly to the external caller. */ function _fallback() internal virtual { _beforeFallback(); _delegate(_implementation()); } /** * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other * function in the contract matches the call data. */ fallback() external payable virtual { _fallback(); } /** * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data * is empty. */ receive() external payable virtual { _fallback(); } /** * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback` * call, or as part of the Solidity `fallback` or `receive` functions. * * If overriden should call `super._beforeFallback()`. */ function _beforeFallback() internal virtual {} } // File: @openzeppelin/contracts/utils/Address.sol pragma solidity ^0.8.0; /** * @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 * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 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); } } } } // File: @openzeppelin/contracts/utils/StorageSlot.sol pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ``` * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { assembly { r.slot := slot } } } // File: @openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol pragma solidity ^0.8.2; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. * * _Available since v4.1._ * * @custom:oz-upgrades-unsafe-allow delegatecall */ abstract contract ERC1967Upgrade { // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1 bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143; /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Returns the current implementation address. */ function _getImplementation() internal view returns (address) { return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Perform implementation upgrade * * Emits an {Upgraded} event. */ function _upgradeTo(address newImplementation) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Perform implementation upgrade with additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCall( address newImplementation, bytes memory data, bool forceCall ) internal { _upgradeTo(newImplementation); if (data.length > 0 || forceCall) { Address.functionDelegateCall(newImplementation, data); } } /** * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCallSecure( address newImplementation, bytes memory data, bool forceCall ) internal { address oldImplementation = _getImplementation(); // Initial upgrade and setup call _setImplementation(newImplementation); if (data.length > 0 || forceCall) { Address.functionDelegateCall(newImplementation, data); } // Perform rollback test if not already in progress StorageSlot.BooleanSlot storage rollbackTesting = StorageSlot.getBooleanSlot(_ROLLBACK_SLOT); if (!rollbackTesting.value) { // Trigger rollback using upgradeTo from the new implementation rollbackTesting.value = true; Address.functionDelegateCall( newImplementation, abi.encodeWithSignature("upgradeTo(address)", oldImplementation) ); rollbackTesting.value = false; // Check rollback was effective require(oldImplementation == _getImplementation(), "ERC1967Upgrade: upgrade breaks further upgrades"); // Finally reset to the new implementation and log the upgrade _upgradeTo(newImplementation); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Returns the current admin. */ function _getAdmin() internal view returns (address) { return StorageSlot.getAddressSlot(_ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { require(newAdmin != address(0), "ERC1967: new admin is the zero address"); StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {AdminChanged} event. */ function _changeAdmin(address newAdmin) internal { emit AdminChanged(_getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor. */ bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Emitted when the beacon is upgraded. */ event BeaconUpgraded(address indexed beacon); /** * @dev Returns the current beacon. */ function _getBeacon() internal view returns (address) { return StorageSlot.getAddressSlot(_BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { require(Address.isContract(newBeacon), "ERC1967: new beacon is not a contract"); require( Address.isContract(IBeacon(newBeacon).implementation()), "ERC1967: beacon implementation is not a contract" ); StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon; } /** * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that). * * Emits a {BeaconUpgraded} event. */ function _upgradeBeaconToAndCall( address newBeacon, bytes memory data, bool forceCall ) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0 || forceCall) { Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data); } } } // File: @openzeppelin/contracts/proxy/beacon/BeaconProxy.sol pragma solidity ^0.8.0; /** * @dev This contract implements a proxy that gets the implementation address for each call from a {UpgradeableBeacon}. * * The beacon address is stored in storage slot `uint256(keccak256('eip1967.proxy.beacon')) - 1`, so that it doesn't * conflict with the storage layout of the implementation behind the proxy. * * _Available since v3.4._ */ contract BeaconProxy is Proxy, ERC1967Upgrade { /** * @dev Initializes the proxy with `beacon`. * * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. This * will typically be an encoded function call, and allows initializating the storage of the proxy like a Solidity * constructor. * * Requirements: * * - `beacon` must be a contract with the interface {IBeacon}. */ constructor(address beacon, bytes memory data) payable { assert(_BEACON_SLOT == bytes32(uint256(keccak256("eip1967.proxy.beacon")) - 1)); _upgradeBeaconToAndCall(beacon, data, false); } /** * @dev Returns the current beacon address. */ function _beacon() internal view virtual returns (address) { return _getBeacon(); } /** * @dev Returns the current implementation address of the associated beacon. */ function _implementation() internal view virtual override returns (address) { return IBeacon(_getBeacon()).implementation(); } /** * @dev Changes the proxy to use a new beacon. Deprecated: see {_upgradeBeaconToAndCall}. * * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. * * Requirements: * * - `beacon` must be a contract. * - The implementation returned by `beacon` must be a contract. */ function _setBeacon(address beacon, bytes memory data) internal virtual { _upgradeBeaconToAndCall(beacon, data, false); } } // File: contracts/bridge/token/Token.sol // contracts/Structs.sol pragma solidity ^0.8.0; contract BridgeToken is BeaconProxy { constructor(address beacon, bytes memory data) BeaconProxy(beacon, data) { } }
1
19,493,359
f74e74325ac73327b97cfe049eec45fe034085cf0f7a32b1031f16bb06cc652a
f216bbbdaef56b98b64dbc53dd5803d9500d3e94136396bac794f24f1171213a
680814862d698f131ad40921cb38a89dd065cd3f
a6b71e26c5e0845f74c812102ca7114b6a896ab2
240070dc90ab5266b1c0a56145ee7fb56ab13671
608060405234801561001057600080fd5b506040516101e63803806101e68339818101604052602081101561003357600080fd5b8101908080519060200190929190505050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156100ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806101c46022913960400191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505060ab806101196000396000f3fe608060405273ffffffffffffffffffffffffffffffffffffffff600054167fa619486e0000000000000000000000000000000000000000000000000000000060003514156050578060005260206000f35b3660008037600080366000845af43d6000803e60008114156070573d6000fd5b3d6000f3fea2646970667358221220d1429297349653a4918076d650332de1a1068c5f3e07c5c82360c277770b955264736f6c63430007060033496e76616c69642073696e676c65746f6e20616464726573732070726f7669646564000000000000000000000000d9db270c1b5e3bd161e8c8503c55ceabee709552
608060405273ffffffffffffffffffffffffffffffffffffffff600054167fa619486e0000000000000000000000000000000000000000000000000000000060003514156050578060005260206000f35b3660008037600080366000845af43d6000803e60008114156070573d6000fd5b3d6000f3fea2646970667358221220d1429297349653a4918076d650332de1a1068c5f3e07c5c82360c277770b955264736f6c63430007060033
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.7.0 <0.9.0; /// @title IProxy - Helper interface to access masterCopy of the Proxy on-chain /// @author Richard Meissner - <[email protected]> interface IProxy { function masterCopy() external view returns (address); } /// @title GnosisSafeProxy - Generic proxy contract allows to execute all transactions applying the code of a master contract. /// @author Stefan George - <[email protected]> /// @author Richard Meissner - <[email protected]> contract GnosisSafeProxy { // singleton always needs to be first declared variable, to ensure that it is at the same location in the contracts to which calls are delegated. // To reduce deployment costs this variable is internal and needs to be retrieved via `getStorageAt` address internal singleton; /// @dev Constructor function sets address of singleton contract. /// @param _singleton Singleton address. constructor(address _singleton) { require(_singleton != address(0), "Invalid singleton address provided"); singleton = _singleton; } /// @dev Fallback function forwards all transactions and returns all received return data. fallback() external payable { // solhint-disable-next-line no-inline-assembly assembly { let _singleton := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff) // 0xa619486e == keccak("masterCopy()"). The value is right padded to 32-bytes with 0s if eq(calldataload(0), 0xa619486e00000000000000000000000000000000000000000000000000000000) { mstore(0, _singleton) return(0, 0x20) } calldatacopy(0, 0, calldatasize()) let success := delegatecall(gas(), _singleton, 0, calldatasize(), 0, 0) returndatacopy(0, 0, returndatasize()) if eq(success, 0) { revert(0, returndatasize()) } return(0, returndatasize()) } } } /// @title Proxy Factory - Allows to create new proxy contact and execute a message call to the new proxy within one transaction. /// @author Stefan George - <[email protected]> contract GnosisSafeProxyFactory { event ProxyCreation(GnosisSafeProxy proxy, address singleton); /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction. /// @param singleton Address of singleton contract. /// @param data Payload for message call sent to new proxy contract. function createProxy(address singleton, bytes memory data) public returns (GnosisSafeProxy proxy) { proxy = new GnosisSafeProxy(singleton); if (data.length > 0) // solhint-disable-next-line no-inline-assembly assembly { if eq(call(gas(), proxy, 0, add(data, 0x20), mload(data), 0, 0), 0) { revert(0, 0) } } emit ProxyCreation(proxy, singleton); } /// @dev Allows to retrieve the runtime code of a deployed Proxy. This can be used to check that the expected Proxy was deployed. function proxyRuntimeCode() public pure returns (bytes memory) { return type(GnosisSafeProxy).runtimeCode; } /// @dev Allows to retrieve the creation code used for the Proxy deployment. With this it is easily possible to calculate predicted address. function proxyCreationCode() public pure returns (bytes memory) { return type(GnosisSafeProxy).creationCode; } /// @dev Allows to create new proxy contact using CREATE2 but it doesn't run the initializer. /// This method is only meant as an utility to be called from other methods /// @param _singleton Address of singleton contract. /// @param initializer Payload for message call sent to new proxy contract. /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. function deployProxyWithNonce( address _singleton, bytes memory initializer, uint256 saltNonce ) internal returns (GnosisSafeProxy proxy) { // If the initializer changes the proxy address should change too. Hashing the initializer data is cheaper than just concatinating it bytes32 salt = keccak256(abi.encodePacked(keccak256(initializer), saltNonce)); bytes memory deploymentData = abi.encodePacked(type(GnosisSafeProxy).creationCode, uint256(uint160(_singleton))); // solhint-disable-next-line no-inline-assembly assembly { proxy := create2(0x0, add(0x20, deploymentData), mload(deploymentData), salt) } require(address(proxy) != address(0), "Create2 call failed"); } /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction. /// @param _singleton Address of singleton contract. /// @param initializer Payload for message call sent to new proxy contract. /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. function createProxyWithNonce( address _singleton, bytes memory initializer, uint256 saltNonce ) public returns (GnosisSafeProxy proxy) { proxy = deployProxyWithNonce(_singleton, initializer, saltNonce); if (initializer.length > 0) // solhint-disable-next-line no-inline-assembly assembly { if eq(call(gas(), proxy, 0, add(initializer, 0x20), mload(initializer), 0, 0), 0) { revert(0, 0) } } emit ProxyCreation(proxy, _singleton); } /// @dev Allows to create new proxy contact, execute a message call to the new proxy and call a specified callback within one transaction /// @param _singleton Address of singleton contract. /// @param initializer Payload for message call sent to new proxy contract. /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. /// @param callback Callback that will be invoced after the new proxy contract has been successfully deployed and initialized. function createProxyWithCallback( address _singleton, bytes memory initializer, uint256 saltNonce, IProxyCreationCallback callback ) public returns (GnosisSafeProxy proxy) { uint256 saltNonceWithCallback = uint256(keccak256(abi.encodePacked(saltNonce, callback))); proxy = createProxyWithNonce(_singleton, initializer, saltNonceWithCallback); if (address(callback) != address(0)) callback.proxyCreated(proxy, _singleton, initializer, saltNonce); } /// @dev Allows to get the address for a new proxy contact created via `createProxyWithNonce` /// This method is only meant for address calculation purpose when you use an initializer that would revert, /// therefore the response is returned with a revert. When calling this method set `from` to the address of the proxy factory. /// @param _singleton Address of singleton contract. /// @param initializer Payload for message call sent to new proxy contract. /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. function calculateCreateProxyWithNonceAddress( address _singleton, bytes calldata initializer, uint256 saltNonce ) external returns (GnosisSafeProxy proxy) { proxy = deployProxyWithNonce(_singleton, initializer, saltNonce); revert(string(abi.encodePacked(proxy))); } } interface IProxyCreationCallback { function proxyCreated( GnosisSafeProxy proxy, address _singleton, bytes calldata initializer, uint256 saltNonce ) external; }
1
19,493,359
f74e74325ac73327b97cfe049eec45fe034085cf0f7a32b1031f16bb06cc652a
73630adba2de263be12df6d1eec826f75214c3efc451736bd2f247893d91613b
1a24497fee9aea57413511668adc2872ef47925d
a6b71e26c5e0845f74c812102ca7114b6a896ab2
ad746898089ac77352ee2e3b3d845868e2774f0c
608060405234801561001057600080fd5b506040516101e63803806101e68339818101604052602081101561003357600080fd5b8101908080519060200190929190505050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156100ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806101c46022913960400191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505060ab806101196000396000f3fe608060405273ffffffffffffffffffffffffffffffffffffffff600054167fa619486e0000000000000000000000000000000000000000000000000000000060003514156050578060005260206000f35b3660008037600080366000845af43d6000803e60008114156070573d6000fd5b3d6000f3fea2646970667358221220d1429297349653a4918076d650332de1a1068c5f3e07c5c82360c277770b955264736f6c63430007060033496e76616c69642073696e676c65746f6e20616464726573732070726f7669646564000000000000000000000000d9db270c1b5e3bd161e8c8503c55ceabee709552
608060405273ffffffffffffffffffffffffffffffffffffffff600054167fa619486e0000000000000000000000000000000000000000000000000000000060003514156050578060005260206000f35b3660008037600080366000845af43d6000803e60008114156070573d6000fd5b3d6000f3fea2646970667358221220d1429297349653a4918076d650332de1a1068c5f3e07c5c82360c277770b955264736f6c63430007060033
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.7.0 <0.9.0; /// @title IProxy - Helper interface to access masterCopy of the Proxy on-chain /// @author Richard Meissner - <[email protected]> interface IProxy { function masterCopy() external view returns (address); } /// @title GnosisSafeProxy - Generic proxy contract allows to execute all transactions applying the code of a master contract. /// @author Stefan George - <[email protected]> /// @author Richard Meissner - <[email protected]> contract GnosisSafeProxy { // singleton always needs to be first declared variable, to ensure that it is at the same location in the contracts to which calls are delegated. // To reduce deployment costs this variable is internal and needs to be retrieved via `getStorageAt` address internal singleton; /// @dev Constructor function sets address of singleton contract. /// @param _singleton Singleton address. constructor(address _singleton) { require(_singleton != address(0), "Invalid singleton address provided"); singleton = _singleton; } /// @dev Fallback function forwards all transactions and returns all received return data. fallback() external payable { // solhint-disable-next-line no-inline-assembly assembly { let _singleton := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff) // 0xa619486e == keccak("masterCopy()"). The value is right padded to 32-bytes with 0s if eq(calldataload(0), 0xa619486e00000000000000000000000000000000000000000000000000000000) { mstore(0, _singleton) return(0, 0x20) } calldatacopy(0, 0, calldatasize()) let success := delegatecall(gas(), _singleton, 0, calldatasize(), 0, 0) returndatacopy(0, 0, returndatasize()) if eq(success, 0) { revert(0, returndatasize()) } return(0, returndatasize()) } } } /// @title Proxy Factory - Allows to create new proxy contact and execute a message call to the new proxy within one transaction. /// @author Stefan George - <[email protected]> contract GnosisSafeProxyFactory { event ProxyCreation(GnosisSafeProxy proxy, address singleton); /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction. /// @param singleton Address of singleton contract. /// @param data Payload for message call sent to new proxy contract. function createProxy(address singleton, bytes memory data) public returns (GnosisSafeProxy proxy) { proxy = new GnosisSafeProxy(singleton); if (data.length > 0) // solhint-disable-next-line no-inline-assembly assembly { if eq(call(gas(), proxy, 0, add(data, 0x20), mload(data), 0, 0), 0) { revert(0, 0) } } emit ProxyCreation(proxy, singleton); } /// @dev Allows to retrieve the runtime code of a deployed Proxy. This can be used to check that the expected Proxy was deployed. function proxyRuntimeCode() public pure returns (bytes memory) { return type(GnosisSafeProxy).runtimeCode; } /// @dev Allows to retrieve the creation code used for the Proxy deployment. With this it is easily possible to calculate predicted address. function proxyCreationCode() public pure returns (bytes memory) { return type(GnosisSafeProxy).creationCode; } /// @dev Allows to create new proxy contact using CREATE2 but it doesn't run the initializer. /// This method is only meant as an utility to be called from other methods /// @param _singleton Address of singleton contract. /// @param initializer Payload for message call sent to new proxy contract. /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. function deployProxyWithNonce( address _singleton, bytes memory initializer, uint256 saltNonce ) internal returns (GnosisSafeProxy proxy) { // If the initializer changes the proxy address should change too. Hashing the initializer data is cheaper than just concatinating it bytes32 salt = keccak256(abi.encodePacked(keccak256(initializer), saltNonce)); bytes memory deploymentData = abi.encodePacked(type(GnosisSafeProxy).creationCode, uint256(uint160(_singleton))); // solhint-disable-next-line no-inline-assembly assembly { proxy := create2(0x0, add(0x20, deploymentData), mload(deploymentData), salt) } require(address(proxy) != address(0), "Create2 call failed"); } /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction. /// @param _singleton Address of singleton contract. /// @param initializer Payload for message call sent to new proxy contract. /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. function createProxyWithNonce( address _singleton, bytes memory initializer, uint256 saltNonce ) public returns (GnosisSafeProxy proxy) { proxy = deployProxyWithNonce(_singleton, initializer, saltNonce); if (initializer.length > 0) // solhint-disable-next-line no-inline-assembly assembly { if eq(call(gas(), proxy, 0, add(initializer, 0x20), mload(initializer), 0, 0), 0) { revert(0, 0) } } emit ProxyCreation(proxy, _singleton); } /// @dev Allows to create new proxy contact, execute a message call to the new proxy and call a specified callback within one transaction /// @param _singleton Address of singleton contract. /// @param initializer Payload for message call sent to new proxy contract. /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. /// @param callback Callback that will be invoced after the new proxy contract has been successfully deployed and initialized. function createProxyWithCallback( address _singleton, bytes memory initializer, uint256 saltNonce, IProxyCreationCallback callback ) public returns (GnosisSafeProxy proxy) { uint256 saltNonceWithCallback = uint256(keccak256(abi.encodePacked(saltNonce, callback))); proxy = createProxyWithNonce(_singleton, initializer, saltNonceWithCallback); if (address(callback) != address(0)) callback.proxyCreated(proxy, _singleton, initializer, saltNonce); } /// @dev Allows to get the address for a new proxy contact created via `createProxyWithNonce` /// This method is only meant for address calculation purpose when you use an initializer that would revert, /// therefore the response is returned with a revert. When calling this method set `from` to the address of the proxy factory. /// @param _singleton Address of singleton contract. /// @param initializer Payload for message call sent to new proxy contract. /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. function calculateCreateProxyWithNonceAddress( address _singleton, bytes calldata initializer, uint256 saltNonce ) external returns (GnosisSafeProxy proxy) { proxy = deployProxyWithNonce(_singleton, initializer, saltNonce); revert(string(abi.encodePacked(proxy))); } } interface IProxyCreationCallback { function proxyCreated( GnosisSafeProxy proxy, address _singleton, bytes calldata initializer, uint256 saltNonce ) external; }
1
19,493,360
b6b981bffa8c882f87842124d7b3543977bfa37f7034e6b11fffc99fe257c13c
3e235c7185702d474753548c6d60b683f11a1ca762870c0bf77b6d41ac0ba13e
caa56880c09e1ebba244cf70e2d7168e09d71559
ffa397285ce46fb78c588a9e993286aac68c37cd
1a1a91bf120377caf23282f2638736e277e1fd2b
3d602d80600a3d3981f3363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3
pragma solidity 0.7.5; /* The MIT License (MIT) Copyright (c) 2018 Murray Software, LLC. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //solhint-disable max-line-length //solhint-disable no-inline-assembly contract CloneFactory { function createClone(address target, bytes32 salt) internal returns (address payable result) { bytes20 targetBytes = bytes20(target); assembly { // load the next free memory slot as a place to store the clone contract data let clone := mload(0x40) // The bytecode block below is responsible for contract initialization // during deployment, it is worth noting the proxied contract constructor will not be called during // the cloning procedure and that is why an initialization function needs to be called after the // clone is created mstore( clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000 ) // This stores the address location of the implementation contract // so that the proxy knows where to delegate call logic to mstore(add(clone, 0x14), targetBytes) // The bytecode block is the actual code that is deployed for each clone created. // It forwards all calls to the already deployed implementation via a delegatecall mstore( add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000 ) // deploy the contract using the CREATE2 opcode // this deploys the minimal proxy defined above, which will proxy all // calls to use the logic defined in the implementation contract `target` result := create2(0, clone, 0x37, salt) } } function isClone(address target, address query) internal view returns (bool result) { bytes20 targetBytes = bytes20(target); assembly { // load the next free memory slot as a place to store the comparison clone let clone := mload(0x40) // The next three lines store the expected bytecode for a miniml proxy // that targets `target` as its implementation contract mstore( clone, 0x363d3d373d3d3d363d7300000000000000000000000000000000000000000000 ) mstore(add(clone, 0xa), targetBytes) mstore( add(clone, 0x1e), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000 ) // the next two lines store the bytecode of the contract that we are checking in memory let other := add(clone, 0x40) extcodecopy(query, other, 0, 0x2d) // Check if the expected bytecode equals the actual bytecode and return the result result := and( eq(mload(clone), mload(other)), eq(mload(add(clone, 0xd)), mload(add(other, 0xd))) ) } } } /** * Contract that exposes the needed erc20 token functions */ abstract contract ERC20Interface { // Send _value amount of tokens to address _to function transfer(address _to, uint256 _value) public virtual returns (bool success); // Get the account balance of another account with address _owner function balanceOf(address _owner) public virtual view returns (uint256 balance); } // helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false library TransferHelper { function safeApprove( address token, address to, uint256 value ) internal { // bytes4(keccak256(bytes('approve(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::safeApprove: approve failed' ); } function safeTransfer( address token, address to, uint256 value ) internal { // bytes4(keccak256(bytes('transfer(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::safeTransfer: transfer failed' ); } function safeTransferFrom( address token, address from, address to, uint256 value ) internal { // bytes4(keccak256(bytes('transferFrom(address,address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::transferFrom: transferFrom failed' ); } function safeTransferETH(address to, uint256 value) internal { (bool success, ) = to.call{value: value}(new bytes(0)); require(success, 'TransferHelper::safeTransferETH: ETH transfer failed'); } } /** * Contract that will forward any incoming Ether to the creator of the contract * */ contract Forwarder { // Address to which any funds sent to this contract will be forwarded address public parentAddress; event ForwarderDeposited(address from, uint256 value, bytes data); /** * Initialize the contract, and sets the destination address to that of the creator */ function init(address _parentAddress) external onlyUninitialized { parentAddress = _parentAddress; uint256 value = address(this).balance; if (value == 0) { return; } (bool success, ) = parentAddress.call{ value: value }(''); require(success, 'Flush failed'); // NOTE: since we are forwarding on initialization, // we don't have the context of the original sender. // We still emit an event about the forwarding but set // the sender to the forwarder itself emit ForwarderDeposited(address(this), value, msg.data); } /** * Modifier that will execute internal code block only if the sender is the parent address */ modifier onlyParent { require(msg.sender == parentAddress, 'Only Parent'); _; } /** * Modifier that will execute internal code block only if the contract has not been initialized yet */ modifier onlyUninitialized { require(parentAddress == address(0x0), 'Already initialized'); _; } /** * Default function; Gets called when data is sent but does not match any other function */ fallback() external payable { flush(); } /** * Default function; Gets called when Ether is deposited with no data, and forwards it to the parent address */ receive() external payable { flush(); } /** * Execute a token transfer of the full balance from the forwarder token to the parent address * @param tokenContractAddress the address of the erc20 token contract */ function flushTokens(address tokenContractAddress) external onlyParent { ERC20Interface instance = ERC20Interface(tokenContractAddress); address forwarderAddress = address(this); uint256 forwarderBalance = instance.balanceOf(forwarderAddress); if (forwarderBalance == 0) { return; } TransferHelper.safeTransfer( tokenContractAddress, parentAddress, forwarderBalance ); } /** * Flush the entire balance of the contract to the parent address. */ function flush() public { uint256 value = address(this).balance; if (value == 0) { return; } (bool success, ) = parentAddress.call{ value: value }(''); require(success, 'Flush failed'); emit ForwarderDeposited(msg.sender, value, msg.data); } } contract ForwarderFactory is CloneFactory { address public implementationAddress; event ForwarderCreated(address newForwarderAddress, address parentAddress); constructor(address _implementationAddress) { implementationAddress = _implementationAddress; } function createForwarder(address parent, bytes32 salt) external { // include the signers in the salt so any contract deployed to a given address must have the same signers bytes32 finalSalt = keccak256(abi.encodePacked(parent, salt)); address payable clone = createClone(implementationAddress, finalSalt); Forwarder(clone).init(parent); emit ForwarderCreated(clone, parent); } }
1
19,493,361
f0f76f3e67312449e8fa4dbc62ffdd0b155baf7747b67751f4f50c0b4bc2913c
938fcd843b1830af2c57892f8de93f625b8f98728576e2c7ab6565685e38b0e8
08f4b53be72918348e1fa0301a3c29f905259ffb
1f98431c8ad98523631ae4a59f267346ea31f984
674da545a40cb9c1aeeb8127c331154ebd051981
6101606040523480156200001257600080fd5b503060601b60805260408051630890357360e41b81529051600091339163890357309160048082019260a092909190829003018186803b1580156200005657600080fd5b505afa1580156200006b573d6000803e3d6000fd5b505050506040513d60a08110156200008257600080fd5b508051602080830151604084015160608086015160809096015160e896871b6001600160e81b0319166101005291811b6001600160601b031990811660e05292811b831660c0529390931b1660a052600282810b900b90921b610120529150620000f79082906200010f811b62002b8417901c565b60801b6001600160801b03191661014052506200017d565b60008082600281900b620d89e719816200012557fe5b05029050600083600281900b620d89e8816200013d57fe5b0502905060008460020b83830360020b816200015557fe5b0560010190508062ffffff166001600160801b038016816200017357fe5b0495945050505050565b60805160601c60a05160601c60c05160601c60e05160601c6101005160e81c6101205160e81c6101405160801c61567e6200024a60003980611fee5280614b5f5280614b96525080610c0052806128fd5280614bca5280614bfc525080610cef52806119cb5280611a0252806129455250806111c75280611a855280611ef4528061244452806129215280613e6b5250806108d252806112f55280611a545280611e8e52806123be5280613d2252508061207b528061227d52806128d9525080612bfb525061567e6000f3fe608060405234801561001057600080fd5b50600436106101ae5760003560e01c806370cf754a116100ee578063c45a015511610097578063ddca3f4311610071578063ddca3f4314610800578063f305839914610820578063f30dba9314610828578063f637731d146108aa576101ae565b8063c45a0155146107d1578063d0c93a7c146107d9578063d21220a7146107f8576101ae565b8063883bdbfd116100c8578063883bdbfd14610633578063a34123a71461073c578063a38807f214610776576101ae565b806370cf754a146105c65780638206a4d1146105ce57806385b66729146105f6576101ae565b80633850c7bd1161015b578063490e6cbc11610135578063490e6cbc146104705780634f1eb3d8146104fc578063514ea4bf1461054d5780635339c296146105a6576101ae565b80633850c7bd1461035b5780633c8a7d8d146103b45780634614131914610456576101ae565b80631ad8b03b1161018c5780631ad8b03b146102aa578063252c09d7146102e157806332148f6714610338576101ae565b80630dfe1681146101b3578063128acb08146101d75780631a68650214610286575b600080fd5b6101bb6108d0565b604080516001600160a01b039092168252519081900360200190f35b61026d600480360360a08110156101ed57600080fd5b6001600160a01b0382358116926020810135151592604082013592606083013516919081019060a08101608082013564010000000081111561022e57600080fd5b82018360208201111561024057600080fd5b8035906020019184600183028401116401000000008311171561026257600080fd5b5090925090506108f4565b6040805192835260208301919091528051918290030190f35b61028e6114ad565b604080516001600160801b039092168252519081900360200190f35b6102b26114bc565b60405180836001600160801b03168152602001826001600160801b031681526020019250505060405180910390f35b6102fe600480360360208110156102f757600080fd5b50356114d6565b6040805163ffffffff909516855260069390930b60208501526001600160a01b039091168383015215156060830152519081900360800190f35b6103596004803603602081101561034e57600080fd5b503561ffff1661151c565b005b610363611616565b604080516001600160a01b03909816885260029690960b602088015261ffff9485168787015292841660608701529216608085015260ff90911660a0840152151560c0830152519081900360e00190f35b61026d600480360360a08110156103ca57600080fd5b6001600160a01b03823516916020810135600290810b92604083013590910b916001600160801b036060820135169181019060a08101608082013564010000000081111561041757600080fd5b82018360208201111561042957600080fd5b8035906020019184600183028401116401000000008311171561044b57600080fd5b509092509050611666565b61045e611922565b60408051918252519081900360200190f35b6103596004803603608081101561048657600080fd5b6001600160a01b0382351691602081013591604082013591908101906080810160608201356401000000008111156104bd57600080fd5b8201836020820111156104cf57600080fd5b803590602001918460018302840111640100000000831117156104f157600080fd5b509092509050611928565b6102b2600480360360a081101561051257600080fd5b506001600160a01b03813516906020810135600290810b91604081013590910b906001600160801b0360608201358116916080013516611d83565b61056a6004803603602081101561056357600080fd5b5035611f9d565b604080516001600160801b0396871681526020810195909552848101939093529084166060840152909216608082015290519081900360a00190f35b61045e600480360360208110156105bc57600080fd5b503560010b611fda565b61028e611fec565b610359600480360360408110156105e457600080fd5b5060ff81358116916020013516612010565b6102b26004803603606081101561060c57600080fd5b506001600160a01b03813516906001600160801b036020820135811691604001351661220f565b6106a36004803603602081101561064957600080fd5b81019060208101813564010000000081111561066457600080fd5b82018360208201111561067657600080fd5b8035906020019184602083028401116401000000008311171561069857600080fd5b5090925090506124dc565b604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b838110156106e75781810151838201526020016106cf565b50505050905001838103825284818151815260200191508051906020019060200280838360005b8381101561072657818101518382015260200161070e565b5050505090500194505050505060405180910390f35b61026d6004803603606081101561075257600080fd5b508035600290810b91602081013590910b90604001356001600160801b0316612569565b6107a06004803603604081101561078c57600080fd5b508035600290810b9160200135900b6126e0565b6040805160069490940b84526001600160a01b03909216602084015263ffffffff1682820152519081900360600190f35b6101bb6128d7565b6107e16128fb565b6040805160029290920b8252519081900360200190f35b6101bb61291f565b610808612943565b6040805162ffffff9092168252519081900360200190f35b61045e612967565b6108486004803603602081101561083e57600080fd5b503560020b61296d565b604080516001600160801b039099168952600f9790970b602089015287870195909552606087019390935260069190910b60808601526001600160a01b031660a085015263ffffffff1660c0840152151560e083015251908190036101000190f35b610359600480360360208110156108c057600080fd5b50356001600160a01b03166129db565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000806108ff612bf0565b85610936576040805162461bcd60e51b8152602060048201526002602482015261415360f01b604482015290519081900360640190fd5b6040805160e0810182526000546001600160a01b0381168252600160a01b8104600290810b810b900b602083015261ffff600160b81b8204811693830193909352600160c81b810483166060830152600160d81b8104909216608082015260ff600160e81b8304811660a0830152600160f01b909204909116151560c082018190526109ef576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b87610a3a5780600001516001600160a01b0316866001600160a01b0316118015610a35575073fffd8963efd1fc6a506488495d951d5263988d266001600160a01b038716105b610a6c565b80600001516001600160a01b0316866001600160a01b0316108015610a6c57506401000276a36001600160a01b038716115b610aa3576040805162461bcd60e51b815260206004820152600360248201526214d41360ea1b604482015290519081900360640190fd5b6000805460ff60f01b191681556040805160c08101909152808a610ad25760048460a0015160ff16901c610ae5565b60108460a0015160ff1681610ae357fe5b065b60ff1681526004546001600160801b03166020820152604001610b06612c27565b63ffffffff168152602001600060060b815260200160006001600160a01b031681526020016000151581525090506000808913905060006040518060e001604052808b81526020016000815260200185600001516001600160a01b03168152602001856020015160020b81526020018c610b8257600254610b86565b6001545b815260200160006001600160801b0316815260200184602001516001600160801b031681525090505b805115801590610bd55750886001600160a01b031681604001516001600160a01b031614155b15610f9f57610be261560e565b60408201516001600160a01b031681526060820151610c25906006907f00000000000000000000000000000000000000000000000000000000000000008f612c2b565b15156040830152600290810b810b60208301819052620d89e719910b1215610c5657620d89e7196020820152610c75565b6020810151620d89e860029190910b1315610c7557620d89e860208201525b610c828160200151612d6d565b6001600160a01b031660608201526040820151610d13908d610cbc578b6001600160a01b031683606001516001600160a01b031611610cd6565b8b6001600160a01b031683606001516001600160a01b0316105b610ce4578260600151610ce6565b8b5b60c085015185517f000000000000000000000000000000000000000000000000000000000000000061309f565b60c085015260a084015260808301526001600160a01b031660408301528215610d7557610d498160c00151826080015101613291565b825103825260a0810151610d6b90610d6090613291565b6020840151906132a7565b6020830152610db0565b610d828160a00151613291565b825101825260c08101516080820151610daa91610d9f9101613291565b6020840151906132c3565b60208301525b835160ff1615610df6576000846000015160ff168260c0015181610dd057fe5b60c0840180519290910491829003905260a0840180519091016001600160801b03169052505b60c08201516001600160801b031615610e3557610e298160c00151600160801b8460c001516001600160801b03166132d9565b60808301805190910190525b80606001516001600160a01b031682604001516001600160a01b03161415610f5e57806040015115610f35578360a00151610ebf57610e9d846040015160008760200151886040015188602001518a606001516008613389909695949392919063ffffffff16565b6001600160a01b03166080860152600690810b900b6060850152600160a08501525b6000610f0b82602001518e610ed657600154610edc565b84608001515b8f610eeb578560800151610eef565b6002545b608089015160608a015160408b0151600595949392919061351c565b90508c15610f17576000035b610f258360c00151826135ef565b6001600160801b031660c0840152505b8b610f44578060200151610f4d565b60018160200151035b600290810b900b6060830152610f99565b80600001516001600160a01b031682604001516001600160a01b031614610f9957610f8c82604001516136a5565b600290810b900b60608301525b50610baf565b836020015160020b816060015160020b1461107a57600080610fed86604001518660400151886020015188602001518a606001518b6080015160086139d1909695949392919063ffffffff16565b604085015160608601516000805461ffff60c81b1916600160c81b61ffff958616021761ffff60b81b1916600160b81b95909416949094029290921762ffffff60a01b1916600160a01b62ffffff60029490940b93909316929092029190911773ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03909116179055506110ac9050565b60408101516000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b039092169190911790555b8060c001516001600160801b031683602001516001600160801b0316146110f25760c0810151600480546001600160801b0319166001600160801b039092169190911790555b8a1561114257608081015160015560a08101516001600160801b03161561113d5760a0810151600380546001600160801b031981166001600160801b03918216909301169190911790555b611188565b608081015160025560a08101516001600160801b0316156111885760a0810151600380546001600160801b03808216600160801b92839004821690940116029190911790555b8115158b1515146111a157602081015181518b036111ae565b80600001518a0381602001515b90965094508a156112e75760008512156111f0576111f07f00000000000000000000000000000000000000000000000000000000000000008d87600003613b86565b60006111fa613cd4565b9050336001600160a01b031663fa461e3388888c8c6040518563ffffffff1660e01b815260040180858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b15801561127e57600080fd5b505af1158015611292573d6000803e3d6000fd5b5050505061129e613cd4565b6112a88289613e0d565b11156112e1576040805162461bcd60e51b815260206004820152600360248201526249494160e81b604482015290519081900360640190fd5b50611411565b600086121561131e5761131e7f00000000000000000000000000000000000000000000000000000000000000008d88600003613b86565b6000611328613e1d565b9050336001600160a01b031663fa461e3388888c8c6040518563ffffffff1660e01b815260040180858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b1580156113ac57600080fd5b505af11580156113c0573d6000803e3d6000fd5b505050506113cc613e1d565b6113d68288613e0d565b111561140f576040805162461bcd60e51b815260206004820152600360248201526249494160e81b604482015290519081900360640190fd5b505b60408082015160c083015160608085015184518b8152602081018b90526001600160a01b03948516818701526001600160801b039093169183019190915260020b60808201529151908e169133917fc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca679181900360a00190a350506000805460ff60f01b1916600160f01b17905550919890975095505050505050565b6004546001600160801b031681565b6003546001600160801b0380821691600160801b90041682565b60088161ffff81106114e757600080fd5b015463ffffffff81169150640100000000810460060b90600160581b81046001600160a01b031690600160f81b900460ff1684565b600054600160f01b900460ff16611560576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b19169055611575612bf0565b60008054600160d81b900461ffff169061159160088385613eb5565b6000805461ffff808416600160d81b810261ffff60d81b19909316929092179092559192508316146115fe576040805161ffff80851682528316602082015281517fac49e518f90a358f652e4400164f05a5d8f7e35e7747279bc3a93dbf584e125a929181900390910190a15b50506000805460ff60f01b1916600160f01b17905550565b6000546001600160a01b03811690600160a01b810460020b9061ffff600160b81b8204811691600160c81b8104821691600160d81b8204169060ff600160e81b8204811691600160f01b90041687565b600080548190600160f01b900460ff166116ad576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b191690556001600160801b0385166116cd57600080fd5b60008061171b60405180608001604052808c6001600160a01b031681526020018b60020b81526020018a60020b81526020016117118a6001600160801b0316613f58565b600f0b9052613f69565b9250925050819350809250600080600086111561173d5761173a613cd4565b91505b841561174e5761174b613e1d565b90505b336001600160a01b031663d348799787878b8b6040518563ffffffff1660e01b815260040180858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b1580156117d057600080fd5b505af11580156117e4573d6000803e3d6000fd5b50505050600086111561183b576117f9613cd4565b6118038388613e0d565b111561183b576040805162461bcd60e51b815260206004820152600260248201526104d360f41b604482015290519081900360640190fd5b841561188b57611849613e1d565b6118538287613e0d565b111561188b576040805162461bcd60e51b81526020600482015260026024820152614d3160f01b604482015290519081900360640190fd5b8960020b8b60020b8d6001600160a01b03167f7a53080ba414158be7ec69b987b5fb7d07dee101fe85488f0853ae16239d0bde338d8b8b60405180856001600160a01b03168152602001846001600160801b0316815260200183815260200182815260200194505050505060405180910390a450506000805460ff60f01b1916600160f01b17905550919890975095505050505050565b60025481565b600054600160f01b900460ff1661196c576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b19169055611981612bf0565b6004546001600160801b0316806119c3576040805162461bcd60e51b81526020600482015260016024820152601360fa1b604482015290519081900360640190fd5b60006119f8867f000000000000000000000000000000000000000000000000000000000000000062ffffff16620f42406141a9565b90506000611a2f867f000000000000000000000000000000000000000000000000000000000000000062ffffff16620f42406141a9565b90506000611a3b613cd4565b90506000611a47613e1d565b90508815611a7a57611a7a7f00000000000000000000000000000000000000000000000000000000000000008b8b613b86565b8715611aab57611aab7f00000000000000000000000000000000000000000000000000000000000000008b8a613b86565b336001600160a01b031663e9cbafb085858a8a6040518563ffffffff1660e01b815260040180858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b158015611b2d57600080fd5b505af1158015611b41573d6000803e3d6000fd5b505050506000611b4f613cd4565b90506000611b5b613e1d565b905081611b688588613e0d565b1115611ba0576040805162461bcd60e51b8152602060048201526002602482015261046360f41b604482015290519081900360640190fd5b80611bab8487613e0d565b1115611be3576040805162461bcd60e51b8152602060048201526002602482015261463160f01b604482015290519081900360640190fd5b8382038382038115611c725760008054600160e81b9004600f16908115611c16578160ff168481611c1057fe5b04611c19565b60005b90506001600160801b03811615611c4c57600380546001600160801b038082168401166001600160801b03199091161790555b611c66818503600160801b8d6001600160801b03166132d9565b60018054909101905550505b8015611cfd5760008054600160e81b900460041c600f16908115611ca2578160ff168381611c9c57fe5b04611ca5565b60005b90506001600160801b03811615611cd757600380546001600160801b03600160801b8083048216850182160291161790555b611cf1818403600160801b8d6001600160801b03166132d9565b60028054909101905550505b8d6001600160a01b0316336001600160a01b03167fbdbdb71d7860376ba52b25a5028beea23581364a40522f6bcfb86bb1f2dca6338f8f86866040518085815260200184815260200183815260200182815260200194505050505060405180910390a350506000805460ff60f01b1916600160f01b179055505050505050505050505050565b600080548190600160f01b900460ff16611dca576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b19168155611de460073389896141e3565b60038101549091506001600160801b0390811690861611611e055784611e14565b60038101546001600160801b03165b60038201549093506001600160801b03600160801b909104811690851611611e3c5783611e52565b6003810154600160801b90046001600160801b03165b91506001600160801b03831615611eb7576003810180546001600160801b031981166001600160801b03918216869003821617909155611eb7907f0000000000000000000000000000000000000000000000000000000000000000908a908616613b86565b6001600160801b03821615611f1d576003810180546001600160801b03600160801b808304821686900382160291811691909117909155611f1d907f0000000000000000000000000000000000000000000000000000000000000000908a908516613b86565b604080516001600160a01b038a1681526001600160801b0380861660208301528416818301529051600288810b92908a900b9133917f70935338e69775456a85ddef226c395fb668b63fa0115f5f20610b388e6ca9c0919081900360600190a4506000805460ff60f01b1916600160f01b17905590969095509350505050565b60076020526000908152604090208054600182015460028301546003909301546001600160801b0392831693919281811691600160801b90041685565b60066020526000908152604090205481565b7f000000000000000000000000000000000000000000000000000000000000000081565b600054600160f01b900460ff16612054576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b1916905560408051638da5cb5b60e01b815290516001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691638da5cb5b916004808301926020929190829003018186803b1580156120c157600080fd5b505afa1580156120d5573d6000803e3d6000fd5b505050506040513d60208110156120eb57600080fd5b50516001600160a01b0316331461210157600080fd5b60ff82161580612124575060048260ff16101580156121245750600a8260ff1611155b801561214e575060ff8116158061214e575060048160ff161015801561214e5750600a8160ff1611155b61215757600080fd5b60008054610ff0600484901b16840160ff908116600160e81b9081027fffff00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff841617909355919004167f973d8d92bb299f4af6ce49b52a8adb85ae46b9f214c4c4fc06ac77401237b1336010826040805160ff9390920683168252600f600486901c16602083015286831682820152918516606082015290519081900360800190a150506000805460ff60f01b1916600160f01b17905550565b600080548190600160f01b900460ff16612256576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b1916905560408051638da5cb5b60e01b815290516001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691638da5cb5b916004808301926020929190829003018186803b1580156122c357600080fd5b505afa1580156122d7573d6000803e3d6000fd5b505050506040513d60208110156122ed57600080fd5b50516001600160a01b0316331461230357600080fd5b6003546001600160801b039081169085161161231f578361232c565b6003546001600160801b03165b6003549092506001600160801b03600160801b9091048116908416116123525782612366565b600354600160801b90046001600160801b03165b90506001600160801b038216156123e7576003546001600160801b038381169116141561239557600019909101905b600380546001600160801b031981166001600160801b039182168590038216179091556123e7907f00000000000000000000000000000000000000000000000000000000000000009087908516613b86565b6001600160801b0381161561246d576003546001600160801b03828116600160801b90920416141561241857600019015b600380546001600160801b03600160801b80830482168590038216029181169190911790915561246d907f00000000000000000000000000000000000000000000000000000000000000009087908416613b86565b604080516001600160801b0380851682528316602082015281516001600160a01b0388169233927f596b573906218d3411850b26a6b437d6c4522fdb43d2d2386263f86d50b8b151929081900390910190a36000805460ff60f01b1916600160f01b1790559094909350915050565b6060806124e7612bf0565b61255e6124f2612c27565b858580806020026020016040519081016040528093929190818152602001838360200280828437600092018290525054600454600896959450600160a01b820460020b935061ffff600160b81b8304811693506001600160801b0390911691600160c81b900416614247565b915091509250929050565b600080548190600160f01b900460ff166125b0576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b1916815560408051608081018252338152600288810b602083015287900b918101919091528190819061260990606081016125fc6001600160801b038a16613f58565b600003600f0b9052613f69565b925092509250816000039450806000039350600085118061262a5750600084115b15612669576003830180546001600160801b038082168089018216600160801b93849004831689019092169092029091176001600160801b0319161790555b604080516001600160801b0388168152602081018790528082018690529051600289810b92908b900b9133917f0c396cd989a39f4459b5fa1aed6a9a8dcdbc45908acfd67e028cd568da98982c919081900360600190a450506000805460ff60f01b1916600160f01b179055509094909350915050565b60008060006126ed612bf0565b6126f785856143a1565b600285810b810b60009081526005602052604080822087840b90930b825281206003830154600681900b9367010000000000000082046001600160a01b0316928492600160d81b810463ffffffff169284929091600160f81b900460ff168061275f57600080fd5b6003820154600681900b985067010000000000000081046001600160a01b03169650600160d81b810463ffffffff169450600160f81b900460ff16806127a457600080fd5b50506040805160e0810182526000546001600160a01b0381168252600160a01b8104600290810b810b810b6020840181905261ffff600160b81b8404811695850195909552600160c81b830485166060850152600160d81b8304909416608084015260ff600160e81b8304811660a0850152600160f01b909204909116151560c08301529093508e810b91900b1215905061284d575093909403965090039350900390506128d0565b8a60020b816020015160020b12156128c1576000612869612c27565b602083015160408401516004546060860151939450600093849361289f936008938893879392916001600160801b031690613389565b9a9003989098039b5050949096039290920396509091030392506128d0915050565b50949093039650039350900390505b9250925092565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b60015481565b60056020526000908152604090208054600182015460028301546003909301546001600160801b03831693600160801b909304600f0b9290600681900b9067010000000000000081046001600160a01b031690600160d81b810463ffffffff1690600160f81b900460ff1688565b6000546001600160a01b031615612a1e576040805162461bcd60e51b8152602060048201526002602482015261414960f01b604482015290519081900360640190fd5b6000612a29826136a5565b9050600080612a41612a39612c27565b60089061446a565b6040805160e0810182526001600160a01b038816808252600288810b6020808501829052600085870181905261ffff898116606088018190529089166080880181905260a08801839052600160c0909801979097528154600160f01b73ffffffffffffffffffffffffffffffffffffffff19909116871762ffffff60a01b1916600160a01b62ffffff9787900b9790971696909602959095177fffffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffff16600160c81b9091021761ffff60d81b1916600160d81b909602959095177fff0000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1692909217909355835191825281019190915281519395509193507f98636036cb66a9c19a37435efc1e90142190214e8abeb821bdba3f2990dd4c9592918290030190a150505050565b60008082600281900b620d89e71981612b9957fe5b05029050600083600281900b620d89e881612bb057fe5b0502905060008460020b83830360020b81612bc757fe5b0560010190508062ffffff166001600160801b03801681612be457fe5b0493505050505b919050565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614612c2557600080fd5b565b4290565b60008060008460020b8660020b81612c3f57fe5b05905060008660020b128015612c6657508460020b8660020b81612c5f57fe5b0760020b15155b15612c7057600019015b8315612ce557600080612c82836144b6565b600182810b810b600090815260208d9052604090205460ff83169190911b80016000190190811680151597509294509092509085612cc757888360ff16860302612cda565b88612cd1826144c8565b840360ff168603025b965050505050612d63565b600080612cf4836001016144b6565b91509150600060018260ff166001901b031990506000818b60008660010b60010b8152602001908152602001600020541690508060001415955085612d4657888360ff0360ff16866001010102612d5c565b8883612d5183614568565b0360ff168660010101025b9650505050505b5094509492505050565b60008060008360020b12612d84578260020b612d8c565b8260020b6000035b9050620d89e8811115612dca576040805162461bcd60e51b81526020600482015260016024820152601560fa1b604482015290519081900360640190fd5b600060018216612dde57600160801b612df0565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff1690506002821615612e24576ffff97272373d413259a46990580e213a0260801c5b6004821615612e43576ffff2e50f5f656932ef12357cf3c7fdcc0260801c5b6008821615612e62576fffe5caca7e10e4e61c3624eaa0941cd00260801c5b6010821615612e81576fffcb9843d60f6159c9db58835c9266440260801c5b6020821615612ea0576fff973b41fa98c081472e6896dfb254c00260801c5b6040821615612ebf576fff2ea16466c96a3843ec78b326b528610260801c5b6080821615612ede576ffe5dee046a99a2a811c461f1969c30530260801c5b610100821615612efe576ffcbe86c7900a88aedcffc83b479aa3a40260801c5b610200821615612f1e576ff987a7253ac413176f2b074cf7815e540260801c5b610400821615612f3e576ff3392b0822b70005940c7a398e4b70f30260801c5b610800821615612f5e576fe7159475a2c29b7443b29c7fa6e889d90260801c5b611000821615612f7e576fd097f3bdfd2022b8845ad8f792aa58250260801c5b612000821615612f9e576fa9f746462d870fdf8a65dc1f90e061e50260801c5b614000821615612fbe576f70d869a156d2a1b890bb3df62baf32f70260801c5b618000821615612fde576f31be135f97d08fd981231505542fcfa60260801c5b62010000821615612fff576f09aa508b5b7a84e1c677de54f3e99bc90260801c5b6202000082161561301f576e5d6af8dedb81196699c329225ee6040260801c5b6204000082161561303e576d2216e584f5fa1ea926041bedfe980260801c5b6208000082161561305b576b048a170391f7dc42444e8fa20260801c5b60008460020b131561307657806000198161307257fe5b0490505b64010000000081061561308a57600161308d565b60005b60ff16602082901c0192505050919050565b60008080806001600160a01b03808916908a1610158187128015906131245760006130d88989620f42400362ffffff16620f42406132d9565b9050826130f1576130ec8c8c8c6001614652565b6130fe565b6130fe8b8d8c60016146cd565b955085811061310f578a965061311e565b61311b8c8b838661478a565b96505b5061316e565b8161313b576131368b8b8b60006146cd565b613148565b6131488a8c8b6000614652565b935083886000031061315c5789955061316e565b61316b8b8a8a600003856147d6565b95505b6001600160a01b038a81169087161482156131d15780801561318d5750815b6131a35761319e878d8c60016146cd565b6131a5565b855b95508080156131b2575081155b6131c8576131c3878d8c6000614652565b6131ca565b845b945061321b565b8080156131db5750815b6131f1576131ec8c888c6001614652565b6131f3565b855b9550808015613200575081155b613216576132118c888c60006146cd565b613218565b845b94505b8115801561322b57508860000385115b15613237578860000394505b81801561325657508a6001600160a01b0316876001600160a01b031614155b15613265578589039350613282565b61327f868962ffffff168a620f42400362ffffff166141a9565b93505b50505095509550955095915050565b6000600160ff1b82106132a357600080fd5b5090565b808203828113156000831215146132bd57600080fd5b92915050565b818101828112156000831215146132bd57600080fd5b600080806000198587098686029250828110908390030390508061330f576000841161330457600080fd5b508290049050613382565b80841161331b57600080fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150505b9392505050565b60008063ffffffff8716613430576000898661ffff1661ffff81106133aa57fe5b60408051608081018252919092015463ffffffff8082168084526401000000008304600690810b810b900b6020850152600160581b83046001600160a01b031694840194909452600160f81b90910460ff16151560608301529092508a161461341c57613419818a8988614822565b90505b806020015181604001519250925050613510565b8688036000806134458c8c858c8c8c8c6148d2565b91509150816000015163ffffffff168363ffffffff161415613477578160200151826040015194509450505050613510565b805163ffffffff8481169116141561349f578060200151816040015194509450505050613510565b8151815160208085015190840151918390039286039163ffffffff80841692908516910360060b816134cd57fe5b05028460200151018263ffffffff168263ffffffff1686604001518660400151036001600160a01b031602816134ff57fe5b048560400151019650965050505050505b97509795505050505050565b600295860b860b60009081526020979097526040909620600181018054909503909455938301805490920390915560038201805463ffffffff600160d81b6001600160a01b036701000000000000008085048216909603169094027fffffffffff0000000000000000000000000000000000000000ffffffffffffff90921691909117600681810b90960390950b66ffffffffffffff1666ffffffffffffff199095169490941782810485169095039093160263ffffffff60d81b1990931692909217905554600160801b9004600f0b90565b60008082600f0b121561365457826001600160801b03168260000384039150816001600160801b03161061364f576040805162461bcd60e51b81526020600482015260026024820152614c5360f01b604482015290519081900360640190fd5b6132bd565b826001600160801b03168284019150816001600160801b031610156132bd576040805162461bcd60e51b81526020600482015260026024820152614c4160f01b604482015290519081900360640190fd5b60006401000276a36001600160a01b038316108015906136e1575073fffd8963efd1fc6a506488495d951d5263988d266001600160a01b038316105b613716576040805162461bcd60e51b81526020600482015260016024820152602960f91b604482015290519081900360640190fd5b77ffffffffffffffffffffffffffffffffffffffff00000000602083901b166001600160801b03811160071b81811c67ffffffffffffffff811160061b90811c63ffffffff811160051b90811c61ffff811160041b90811c60ff8111600390811b91821c600f811160021b90811c918211600190811b92831c979088119617909417909217179091171717608081106137b757607f810383901c91506137c1565b80607f0383901b91505b908002607f81811c60ff83811c9190911c800280831c81831c1c800280841c81841c1c800280851c81851c1c800280861c81861c1c800280871c81871c1c800280881c81881c1c800280891c81891c1c8002808a1c818a1c1c8002808b1c818b1c1c8002808c1c818c1c1c8002808d1c818d1c1c8002808e1c9c81901c9c909c1c80029c8d901c9e9d607f198f0160401b60c09190911c678000000000000000161760c19b909b1c674000000000000000169a909a1760c29990991c672000000000000000169890981760c39790971c671000000000000000169690961760c49590951c670800000000000000169490941760c59390931c670400000000000000169290921760c69190911c670200000000000000161760c79190911c670100000000000000161760c89190911c6680000000000000161760c99190911c6640000000000000161760ca9190911c6620000000000000161760cb9190911c6610000000000000161760cc9190911c6608000000000000161760cd9190911c66040000000000001617693627a301d71055774c8581026f028f6481ab7f045a5af012a19d003aa9198101608090811d906fdb2df09e81959a81455e260799a0632f8301901d600281810b9083900b146139c257886001600160a01b03166139a682612d6d565b6001600160a01b031611156139bb57816139bd565b805b6139c4565b815b9998505050505050505050565b6000806000898961ffff1661ffff81106139e757fe5b60408051608081018252919092015463ffffffff8082168084526401000000008304600690810b810b900b6020850152600160581b83046001600160a01b031694840194909452600160f81b90910460ff161515606083015290925089161415613a575788859250925050613510565b8461ffff168461ffff16118015613a7857506001850361ffff168961ffff16145b15613a8557839150613a89565b8491505b8161ffff168960010161ffff1681613a9d57fe5b069250613aac81898989614822565b8a8461ffff1661ffff8110613abd57fe5b825191018054602084015160408501516060909501511515600160f81b027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6001600160a01b03909616600160581b027fff0000000000000000000000000000000000000000ffffffffffffffffffffff60069390930b66ffffffffffffff16640100000000026affffffffffffff000000001963ffffffff90971663ffffffff199095169490941795909516929092171692909217929092161790555097509795505050505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1781529251825160009485949389169392918291908083835b60208310613c025780518252601f199092019160209182019101613be3565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114613c64576040519150601f19603f3d011682016040523d82523d6000602084013e613c69565b606091505b5091509150818015613c97575080511580613c975750808060200190516020811015613c9457600080fd5b50515b613ccd576040805162461bcd60e51b81526020600482015260026024820152612a2360f11b604482015290519081900360640190fd5b5050505050565b604080513060248083019190915282518083039091018152604490910182526020810180516001600160e01b03166370a0823160e01b17815291518151600093849384936001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001693919290918291908083835b60208310613d6d5780518252601f199092019160209182019101613d4e565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114613dcd576040519150601f19603f3d011682016040523d82523d6000602084013e613dd2565b606091505b5091509150818015613de657506020815110155b613def57600080fd5b808060200190516020811015613e0457600080fd5b50519250505090565b808201828110156132bd57600080fd5b604080513060248083019190915282518083039091018152604490910182526020810180516001600160e01b03166370a0823160e01b17815291518151600093849384936001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016939192909182919080838360208310613d6d5780518252601f199092019160209182019101613d4e565b6000808361ffff1611613ef3576040805162461bcd60e51b81526020600482015260016024820152604960f81b604482015290519081900360640190fd5b8261ffff168261ffff1611613f09575081613382565b825b8261ffff168161ffff161015613f4f576001858261ffff1661ffff8110613f2e57fe5b01805463ffffffff191663ffffffff92909216919091179055600101613f0b565b50909392505050565b80600f81900b8114612beb57600080fd5b6000806000613f76612bf0565b613f88846020015185604001516143a1565b6040805160e0810182526000546001600160a01b0381168252600160a01b8104600290810b810b900b602080840182905261ffff600160b81b8404811685870152600160c81b84048116606080870191909152600160d81b8504909116608086015260ff600160e81b8504811660a0870152600160f01b909404909316151560c08501528851908901519489015192890151939461402c9491939092909190614acf565b93508460600151600f0b6000146141a157846020015160020b816020015160020b12156140815761407a6140638660200151612d6d565b6140708760400151612d6d565b8760600151614c84565b92506141a1565b846040015160020b816020015160020b12156141775760045460408201516001600160801b03909116906140d3906140b7612c27565b60208501516060860151608087015160089493929187916139d1565b6000805461ffff60c81b1916600160c81b61ffff938416021761ffff60b81b1916600160b81b939092169290920217905581516040870151614123919061411990612d6d565b8860600151614c84565b93506141416141358760200151612d6d565b83516060890151614cc8565b92506141518187606001516135ef565b600480546001600160801b0319166001600160801b0392909216919091179055506141a1565b61419e6141878660200151612d6d565b6141948760400151612d6d565b8760600151614cc8565b91505b509193909250565b60006141b68484846132d9565b9050600082806141c257fe5b84860911156133825760001981106141d957600080fd5b6001019392505050565b6040805160609490941b6bffffffffffffffffffffffff1916602080860191909152600293840b60e890811b60348701529290930b90911b60378401528051808403601a018152603a90930181528251928201929092206000908152929052902090565b60608060008361ffff1611614287576040805162461bcd60e51b81526020600482015260016024820152604960f81b604482015290519081900360640190fd5b865167ffffffffffffffff8111801561429f57600080fd5b506040519080825280602002602001820160405280156142c9578160200160208202803683370190505b509150865167ffffffffffffffff811180156142e457600080fd5b5060405190808252806020026020018201604052801561430e578160200160208202803683370190505b50905060005b87518110156143945761433f8a8a8a848151811061432e57fe5b60200260200101518a8a8a8a613389565b84838151811061434b57fe5b6020026020010184848151811061435e57fe5b60200260200101826001600160a01b03166001600160a01b03168152508260060b60060b81525050508080600101915050614314565b5097509795505050505050565b8060020b8260020b126143e1576040805162461bcd60e51b8152602060048201526003602482015262544c5560e81b604482015290519081900360640190fd5b620d89e719600283900b1215614424576040805162461bcd60e51b8152602060048201526003602482015262544c4d60e81b604482015290519081900360640190fd5b620d89e8600282900b1315614466576040805162461bcd60e51b815260206004820152600360248201526254554d60e81b604482015290519081900360640190fd5b5050565b6040805160808101825263ffffffff9283168082526000602083018190529282019290925260016060909101819052835463ffffffff1916909117909116600160f81b17909155908190565b60020b600881901d9161010090910790565b60008082116144d657600080fd5b600160801b82106144e957608091821c91015b68010000000000000000821061450157604091821c91015b640100000000821061451557602091821c91015b62010000821061452757601091821c91015b610100821061453857600891821c91015b6010821061454857600491821c91015b6004821061455857600291821c91015b60028210612beb57600101919050565b600080821161457657600080fd5b5060ff6001600160801b0382161561459157607f1901614599565b608082901c91505b67ffffffffffffffff8216156145b257603f19016145ba565b604082901c91505b63ffffffff8216156145cf57601f19016145d7565b602082901c91505b61ffff8216156145ea57600f19016145f2565b601082901c91505b60ff821615614604576007190161460c565b600882901c91505b600f82161561461e5760031901614626565b600482901c91505b60038216156146385760011901614640565b600282901c91505b6001821615612beb5760001901919050565b6000836001600160a01b0316856001600160a01b03161115614672579293925b8161469f5761469a836001600160801b03168686036001600160a01b0316600160601b6132d9565b6146c2565b6146c2836001600160801b03168686036001600160a01b0316600160601b6141a9565b90505b949350505050565b6000836001600160a01b0316856001600160a01b031611156146ed579293925b7bffffffffffffffffffffffffffffffff000000000000000000000000606084901b166001600160a01b03868603811690871661472957600080fd5b8361475957866001600160a01b031661474c8383896001600160a01b03166132d9565b8161475357fe5b0461477f565b61477f6147708383896001600160a01b03166141a9565b886001600160a01b0316614cf7565b979650505050505050565b600080856001600160a01b0316116147a157600080fd5b6000846001600160801b0316116147b757600080fd5b816147c95761469a8585856001614d02565b6146c28585856001614de3565b600080856001600160a01b0316116147ed57600080fd5b6000846001600160801b03161161480357600080fd5b816148155761469a8585856000614de3565b6146c28585856000614d02565b61482a61564a565b600085600001518503905060405180608001604052808663ffffffff1681526020018263ffffffff168660020b0288602001510160060b81526020016000856001600160801b03161161487e576001614880565b845b6001600160801b031673ffffffff00000000000000000000000000000000608085901b16816148ab57fe5b048860400151016001600160a01b0316815260200160011515815250915050949350505050565b6148da61564a565b6148e261564a565b888561ffff1661ffff81106148f357fe5b60408051608081018252919092015463ffffffff81168083526401000000008204600690810b810b900b6020840152600160581b82046001600160a01b031693830193909352600160f81b900460ff1615156060820152925061495890899089614ed8565b15614990578663ffffffff16826000015163ffffffff16141561497a57613510565b8161498783898988614822565b91509150613510565b888361ffff168660010161ffff16816149a557fe5b0661ffff1661ffff81106149b557fe5b60408051608081018252929091015463ffffffff811683526401000000008104600690810b810b900b60208401526001600160a01b03600160581b8204169183019190915260ff600160f81b90910416151560608201819052909250614a6c57604080516080810182528a5463ffffffff811682526401000000008104600690810b810b900b6020830152600160581b81046001600160a01b031692820192909252600160f81b90910460ff161515606082015291505b614a7b88836000015189614ed8565b614ab2576040805162461bcd60e51b815260206004820152600360248201526213d31160ea1b604482015290519081900360640190fd5b614abf8989898887614f9b565b9150915097509795505050505050565b6000614ade60078787876141e3565b60015460025491925090600080600f87900b15614c24576000614aff612c27565b6000805460045492935090918291614b499160089186918591600160a01b810460020b9161ffff600160b81b83048116926001600160801b0390921691600160c81b900416613389565b9092509050614b8360058d8b8d8b8b87898b60007f000000000000000000000000000000000000000000000000000000000000000061513b565b9450614bba60058c8b8d8b8b87898b60017f000000000000000000000000000000000000000000000000000000000000000061513b565b93508415614bee57614bee60068d7f0000000000000000000000000000000000000000000000000000000000000000615325565b8315614c2057614c2060068c7f0000000000000000000000000000000000000000000000000000000000000000615325565b5050505b600080614c3660058c8c8b8a8a61538b565b9092509050614c47878a8484615437565b600089600f0b1215614c75578315614c6457614c6460058c6155cc565b8215614c7557614c7560058b6155cc565b50505050505095945050505050565b60008082600f0b12614caa57614ca5614ca085858560016146cd565b613291565b6146c5565b614cbd614ca085858560000360006146cd565b600003949350505050565b60008082600f0b12614ce457614ca5614ca08585856001614652565b614cbd614ca08585856000036000614652565b808204910615150190565b60008115614d755760006001600160a01b03841115614d3857614d3384600160601b876001600160801b03166132d9565b614d50565b6001600160801b038516606085901b81614d4e57fe5b045b9050614d6d614d686001600160a01b03881683613e0d565b6155f8565b9150506146c5565b60006001600160a01b03841115614da357614d9e84600160601b876001600160801b03166141a9565b614dba565b614dba606085901b6001600160801b038716614cf7565b905080866001600160a01b031611614dd157600080fd5b6001600160a01b0386160390506146c5565b600082614df15750836146c5565b7bffffffffffffffffffffffffffffffff000000000000000000000000606085901b168215614e91576001600160a01b03861684810290858281614e3157fe5b041415614e6257818101828110614e6057614e5683896001600160a01b0316836141a9565b93505050506146c5565b505b614e8882614e83878a6001600160a01b03168681614e7c57fe5b0490613e0d565b614cf7565b925050506146c5565b6001600160a01b03861684810290858281614ea857fe5b04148015614eb557508082115b614ebe57600080fd5b808203614e56614d68846001600160a01b038b16846141a9565b60008363ffffffff168363ffffffff1611158015614f0257508363ffffffff168263ffffffff1611155b15614f1e578163ffffffff168363ffffffff1611159050613382565b60008463ffffffff168463ffffffff1611614f46578363ffffffff1664010000000001614f4e565b8363ffffffff165b64ffffffffff16905060008563ffffffff168463ffffffff1611614f7f578363ffffffff1664010000000001614f87565b8363ffffffff165b64ffffffffff169091111595945050505050565b614fa361564a565b614fab61564a565b60008361ffff168560010161ffff1681614fc157fe5b0661ffff169050600060018561ffff16830103905060005b506002818301048961ffff87168281614fee57fe5b0661ffff8110614ffa57fe5b60408051608081018252929091015463ffffffff811683526401000000008104600690810b810b900b60208401526001600160a01b03600160581b8204169183019190915260ff600160f81b9091041615156060820181905290955061506557806001019250614fd9565b898661ffff16826001018161507657fe5b0661ffff811061508257fe5b60408051608081018252929091015463ffffffff811683526401000000008104600690810b810b900b60208401526001600160a01b03600160581b8204169183019190915260ff600160f81b909104161515606082015285519094506000906150ed908b908b614ed8565b905080801561510657506151068a8a8760000151614ed8565b15615111575061512e565b8061512157600182039250615128565b8160010193505b50614fd9565b5050509550959350505050565b60028a810b900b600090815260208c90526040812080546001600160801b031682615166828d6135ef565b9050846001600160801b0316816001600160801b031611156151b4576040805162461bcd60e51b81526020600482015260026024820152614c4f60f01b604482015290519081900360640190fd5b6001600160801b03828116159082161581141594501561528a578c60020b8e60020b1361525a57600183018b9055600283018a90556003830180547fffffffffff0000000000000000000000000000000000000000ffffffffffffff166701000000000000006001600160a01b038c16021766ffffffffffffff191666ffffffffffffff60068b900b161763ffffffff60d81b1916600160d81b63ffffffff8a16021790555b6003830180547effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16600160f81b1790555b82546001600160801b0319166001600160801b038216178355856152d35782546152ce906152c990600160801b9004600f90810b810b908f900b6132c3565b613f58565b6152f4565b82546152f4906152c990600160801b9004600f90810b810b908f900b6132a7565b8354600f9190910b6001600160801b03908116600160801b0291161790925550909c9b505050505050505050505050565b8060020b8260020b8161533457fe5b0760020b1561534257600080fd5b60008061535d8360020b8560020b8161535757fe5b056144b6565b600191820b820b60009081526020979097526040909620805460ff9097169190911b90951890945550505050565b600285810b80820b60009081526020899052604080822088850b850b83529082209193849391929184918291908a900b126153d1575050600182015460028301546153e4565b8360010154880391508360020154870390505b6000808b60020b8b60020b121561540657505060018301546002840154615419565b84600101548a0391508460020154890390505b92909803979097039b96909503949094039850939650505050505050565b6040805160a08101825285546001600160801b0390811682526001870154602083015260028701549282019290925260038601548083166060830152600160801b900490911660808201526000600f85900b6154d65781516001600160801b03166154ce576040805162461bcd60e51b815260206004820152600260248201526104e560f41b604482015290519081900360640190fd5b5080516154e5565b81516154e290866135ef565b90505b60006155098360200151860384600001516001600160801b0316600160801b6132d9565b9050600061552f8460400151860385600001516001600160801b0316600160801b6132d9565b905086600f0b6000146155565787546001600160801b0319166001600160801b0384161788555b60018801869055600288018590556001600160801b03821615158061558457506000816001600160801b0316115b156155c2576003880180546001600160801b031981166001600160801b039182168501821617808216600160801b9182900483168501909216021790555b5050505050505050565b600290810b810b6000908152602092909252604082208281556001810183905590810182905560030155565b806001600160a01b0381168114612beb57600080fd5b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c081019190915290565b6040805160808101825260008082526020820181905291810182905260608101919091529056fea164736f6c6343000706000a
608060405234801561001057600080fd5b50600436106101ae5760003560e01c806370cf754a116100ee578063c45a015511610097578063ddca3f4311610071578063ddca3f4314610800578063f305839914610820578063f30dba9314610828578063f637731d146108aa576101ae565b8063c45a0155146107d1578063d0c93a7c146107d9578063d21220a7146107f8576101ae565b8063883bdbfd116100c8578063883bdbfd14610633578063a34123a71461073c578063a38807f214610776576101ae565b806370cf754a146105c65780638206a4d1146105ce57806385b66729146105f6576101ae565b80633850c7bd1161015b578063490e6cbc11610135578063490e6cbc146104705780634f1eb3d8146104fc578063514ea4bf1461054d5780635339c296146105a6576101ae565b80633850c7bd1461035b5780633c8a7d8d146103b45780634614131914610456576101ae565b80631ad8b03b1161018c5780631ad8b03b146102aa578063252c09d7146102e157806332148f6714610338576101ae565b80630dfe1681146101b3578063128acb08146101d75780631a68650214610286575b600080fd5b6101bb6108d0565b604080516001600160a01b039092168252519081900360200190f35b61026d600480360360a08110156101ed57600080fd5b6001600160a01b0382358116926020810135151592604082013592606083013516919081019060a08101608082013564010000000081111561022e57600080fd5b82018360208201111561024057600080fd5b8035906020019184600183028401116401000000008311171561026257600080fd5b5090925090506108f4565b6040805192835260208301919091528051918290030190f35b61028e6114ad565b604080516001600160801b039092168252519081900360200190f35b6102b26114bc565b60405180836001600160801b03168152602001826001600160801b031681526020019250505060405180910390f35b6102fe600480360360208110156102f757600080fd5b50356114d6565b6040805163ffffffff909516855260069390930b60208501526001600160a01b039091168383015215156060830152519081900360800190f35b6103596004803603602081101561034e57600080fd5b503561ffff1661151c565b005b610363611616565b604080516001600160a01b03909816885260029690960b602088015261ffff9485168787015292841660608701529216608085015260ff90911660a0840152151560c0830152519081900360e00190f35b61026d600480360360a08110156103ca57600080fd5b6001600160a01b03823516916020810135600290810b92604083013590910b916001600160801b036060820135169181019060a08101608082013564010000000081111561041757600080fd5b82018360208201111561042957600080fd5b8035906020019184600183028401116401000000008311171561044b57600080fd5b509092509050611666565b61045e611922565b60408051918252519081900360200190f35b6103596004803603608081101561048657600080fd5b6001600160a01b0382351691602081013591604082013591908101906080810160608201356401000000008111156104bd57600080fd5b8201836020820111156104cf57600080fd5b803590602001918460018302840111640100000000831117156104f157600080fd5b509092509050611928565b6102b2600480360360a081101561051257600080fd5b506001600160a01b03813516906020810135600290810b91604081013590910b906001600160801b0360608201358116916080013516611d83565b61056a6004803603602081101561056357600080fd5b5035611f9d565b604080516001600160801b0396871681526020810195909552848101939093529084166060840152909216608082015290519081900360a00190f35b61045e600480360360208110156105bc57600080fd5b503560010b611fda565b61028e611fec565b610359600480360360408110156105e457600080fd5b5060ff81358116916020013516612010565b6102b26004803603606081101561060c57600080fd5b506001600160a01b03813516906001600160801b036020820135811691604001351661220f565b6106a36004803603602081101561064957600080fd5b81019060208101813564010000000081111561066457600080fd5b82018360208201111561067657600080fd5b8035906020019184602083028401116401000000008311171561069857600080fd5b5090925090506124dc565b604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b838110156106e75781810151838201526020016106cf565b50505050905001838103825284818151815260200191508051906020019060200280838360005b8381101561072657818101518382015260200161070e565b5050505090500194505050505060405180910390f35b61026d6004803603606081101561075257600080fd5b508035600290810b91602081013590910b90604001356001600160801b0316612569565b6107a06004803603604081101561078c57600080fd5b508035600290810b9160200135900b6126e0565b6040805160069490940b84526001600160a01b03909216602084015263ffffffff1682820152519081900360600190f35b6101bb6128d7565b6107e16128fb565b6040805160029290920b8252519081900360200190f35b6101bb61291f565b610808612943565b6040805162ffffff9092168252519081900360200190f35b61045e612967565b6108486004803603602081101561083e57600080fd5b503560020b61296d565b604080516001600160801b039099168952600f9790970b602089015287870195909552606087019390935260069190910b60808601526001600160a01b031660a085015263ffffffff1660c0840152151560e083015251908190036101000190f35b610359600480360360208110156108c057600080fd5b50356001600160a01b03166129db565b7f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4881565b6000806108ff612bf0565b85610936576040805162461bcd60e51b8152602060048201526002602482015261415360f01b604482015290519081900360640190fd5b6040805160e0810182526000546001600160a01b0381168252600160a01b8104600290810b810b900b602083015261ffff600160b81b8204811693830193909352600160c81b810483166060830152600160d81b8104909216608082015260ff600160e81b8304811660a0830152600160f01b909204909116151560c082018190526109ef576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b87610a3a5780600001516001600160a01b0316866001600160a01b0316118015610a35575073fffd8963efd1fc6a506488495d951d5263988d266001600160a01b038716105b610a6c565b80600001516001600160a01b0316866001600160a01b0316108015610a6c57506401000276a36001600160a01b038716115b610aa3576040805162461bcd60e51b815260206004820152600360248201526214d41360ea1b604482015290519081900360640190fd5b6000805460ff60f01b191681556040805160c08101909152808a610ad25760048460a0015160ff16901c610ae5565b60108460a0015160ff1681610ae357fe5b065b60ff1681526004546001600160801b03166020820152604001610b06612c27565b63ffffffff168152602001600060060b815260200160006001600160a01b031681526020016000151581525090506000808913905060006040518060e001604052808b81526020016000815260200185600001516001600160a01b03168152602001856020015160020b81526020018c610b8257600254610b86565b6001545b815260200160006001600160801b0316815260200184602001516001600160801b031681525090505b805115801590610bd55750886001600160a01b031681604001516001600160a01b031614155b15610f9f57610be261560e565b60408201516001600160a01b031681526060820151610c25906006907f000000000000000000000000000000000000000000000000000000000000003c8f612c2b565b15156040830152600290810b810b60208301819052620d89e719910b1215610c5657620d89e7196020820152610c75565b6020810151620d89e860029190910b1315610c7557620d89e860208201525b610c828160200151612d6d565b6001600160a01b031660608201526040820151610d13908d610cbc578b6001600160a01b031683606001516001600160a01b031611610cd6565b8b6001600160a01b031683606001516001600160a01b0316105b610ce4578260600151610ce6565b8b5b60c085015185517f0000000000000000000000000000000000000000000000000000000000000bb861309f565b60c085015260a084015260808301526001600160a01b031660408301528215610d7557610d498160c00151826080015101613291565b825103825260a0810151610d6b90610d6090613291565b6020840151906132a7565b6020830152610db0565b610d828160a00151613291565b825101825260c08101516080820151610daa91610d9f9101613291565b6020840151906132c3565b60208301525b835160ff1615610df6576000846000015160ff168260c0015181610dd057fe5b60c0840180519290910491829003905260a0840180519091016001600160801b03169052505b60c08201516001600160801b031615610e3557610e298160c00151600160801b8460c001516001600160801b03166132d9565b60808301805190910190525b80606001516001600160a01b031682604001516001600160a01b03161415610f5e57806040015115610f35578360a00151610ebf57610e9d846040015160008760200151886040015188602001518a606001516008613389909695949392919063ffffffff16565b6001600160a01b03166080860152600690810b900b6060850152600160a08501525b6000610f0b82602001518e610ed657600154610edc565b84608001515b8f610eeb578560800151610eef565b6002545b608089015160608a015160408b0151600595949392919061351c565b90508c15610f17576000035b610f258360c00151826135ef565b6001600160801b031660c0840152505b8b610f44578060200151610f4d565b60018160200151035b600290810b900b6060830152610f99565b80600001516001600160a01b031682604001516001600160a01b031614610f9957610f8c82604001516136a5565b600290810b900b60608301525b50610baf565b836020015160020b816060015160020b1461107a57600080610fed86604001518660400151886020015188602001518a606001518b6080015160086139d1909695949392919063ffffffff16565b604085015160608601516000805461ffff60c81b1916600160c81b61ffff958616021761ffff60b81b1916600160b81b95909416949094029290921762ffffff60a01b1916600160a01b62ffffff60029490940b93909316929092029190911773ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03909116179055506110ac9050565b60408101516000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b039092169190911790555b8060c001516001600160801b031683602001516001600160801b0316146110f25760c0810151600480546001600160801b0319166001600160801b039092169190911790555b8a1561114257608081015160015560a08101516001600160801b03161561113d5760a0810151600380546001600160801b031981166001600160801b03918216909301169190911790555b611188565b608081015160025560a08101516001600160801b0316156111885760a0810151600380546001600160801b03808216600160801b92839004821690940116029190911790555b8115158b1515146111a157602081015181518b036111ae565b80600001518a0381602001515b90965094508a156112e75760008512156111f0576111f07f000000000000000000000000def1ca1fb7fbcdc777520aa7f396b4e015f497ab8d87600003613b86565b60006111fa613cd4565b9050336001600160a01b031663fa461e3388888c8c6040518563ffffffff1660e01b815260040180858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b15801561127e57600080fd5b505af1158015611292573d6000803e3d6000fd5b5050505061129e613cd4565b6112a88289613e0d565b11156112e1576040805162461bcd60e51b815260206004820152600360248201526249494160e81b604482015290519081900360640190fd5b50611411565b600086121561131e5761131e7f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb488d88600003613b86565b6000611328613e1d565b9050336001600160a01b031663fa461e3388888c8c6040518563ffffffff1660e01b815260040180858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b1580156113ac57600080fd5b505af11580156113c0573d6000803e3d6000fd5b505050506113cc613e1d565b6113d68288613e0d565b111561140f576040805162461bcd60e51b815260206004820152600360248201526249494160e81b604482015290519081900360640190fd5b505b60408082015160c083015160608085015184518b8152602081018b90526001600160a01b03948516818701526001600160801b039093169183019190915260020b60808201529151908e169133917fc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca679181900360a00190a350506000805460ff60f01b1916600160f01b17905550919890975095505050505050565b6004546001600160801b031681565b6003546001600160801b0380821691600160801b90041682565b60088161ffff81106114e757600080fd5b015463ffffffff81169150640100000000810460060b90600160581b81046001600160a01b031690600160f81b900460ff1684565b600054600160f01b900460ff16611560576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b19169055611575612bf0565b60008054600160d81b900461ffff169061159160088385613eb5565b6000805461ffff808416600160d81b810261ffff60d81b19909316929092179092559192508316146115fe576040805161ffff80851682528316602082015281517fac49e518f90a358f652e4400164f05a5d8f7e35e7747279bc3a93dbf584e125a929181900390910190a15b50506000805460ff60f01b1916600160f01b17905550565b6000546001600160a01b03811690600160a01b810460020b9061ffff600160b81b8204811691600160c81b8104821691600160d81b8204169060ff600160e81b8204811691600160f01b90041687565b600080548190600160f01b900460ff166116ad576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b191690556001600160801b0385166116cd57600080fd5b60008061171b60405180608001604052808c6001600160a01b031681526020018b60020b81526020018a60020b81526020016117118a6001600160801b0316613f58565b600f0b9052613f69565b9250925050819350809250600080600086111561173d5761173a613cd4565b91505b841561174e5761174b613e1d565b90505b336001600160a01b031663d348799787878b8b6040518563ffffffff1660e01b815260040180858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b1580156117d057600080fd5b505af11580156117e4573d6000803e3d6000fd5b50505050600086111561183b576117f9613cd4565b6118038388613e0d565b111561183b576040805162461bcd60e51b815260206004820152600260248201526104d360f41b604482015290519081900360640190fd5b841561188b57611849613e1d565b6118538287613e0d565b111561188b576040805162461bcd60e51b81526020600482015260026024820152614d3160f01b604482015290519081900360640190fd5b8960020b8b60020b8d6001600160a01b03167f7a53080ba414158be7ec69b987b5fb7d07dee101fe85488f0853ae16239d0bde338d8b8b60405180856001600160a01b03168152602001846001600160801b0316815260200183815260200182815260200194505050505060405180910390a450506000805460ff60f01b1916600160f01b17905550919890975095505050505050565b60025481565b600054600160f01b900460ff1661196c576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b19169055611981612bf0565b6004546001600160801b0316806119c3576040805162461bcd60e51b81526020600482015260016024820152601360fa1b604482015290519081900360640190fd5b60006119f8867f0000000000000000000000000000000000000000000000000000000000000bb862ffffff16620f42406141a9565b90506000611a2f867f0000000000000000000000000000000000000000000000000000000000000bb862ffffff16620f42406141a9565b90506000611a3b613cd4565b90506000611a47613e1d565b90508815611a7a57611a7a7f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb488b8b613b86565b8715611aab57611aab7f000000000000000000000000def1ca1fb7fbcdc777520aa7f396b4e015f497ab8b8a613b86565b336001600160a01b031663e9cbafb085858a8a6040518563ffffffff1660e01b815260040180858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b158015611b2d57600080fd5b505af1158015611b41573d6000803e3d6000fd5b505050506000611b4f613cd4565b90506000611b5b613e1d565b905081611b688588613e0d565b1115611ba0576040805162461bcd60e51b8152602060048201526002602482015261046360f41b604482015290519081900360640190fd5b80611bab8487613e0d565b1115611be3576040805162461bcd60e51b8152602060048201526002602482015261463160f01b604482015290519081900360640190fd5b8382038382038115611c725760008054600160e81b9004600f16908115611c16578160ff168481611c1057fe5b04611c19565b60005b90506001600160801b03811615611c4c57600380546001600160801b038082168401166001600160801b03199091161790555b611c66818503600160801b8d6001600160801b03166132d9565b60018054909101905550505b8015611cfd5760008054600160e81b900460041c600f16908115611ca2578160ff168381611c9c57fe5b04611ca5565b60005b90506001600160801b03811615611cd757600380546001600160801b03600160801b8083048216850182160291161790555b611cf1818403600160801b8d6001600160801b03166132d9565b60028054909101905550505b8d6001600160a01b0316336001600160a01b03167fbdbdb71d7860376ba52b25a5028beea23581364a40522f6bcfb86bb1f2dca6338f8f86866040518085815260200184815260200183815260200182815260200194505050505060405180910390a350506000805460ff60f01b1916600160f01b179055505050505050505050505050565b600080548190600160f01b900460ff16611dca576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b19168155611de460073389896141e3565b60038101549091506001600160801b0390811690861611611e055784611e14565b60038101546001600160801b03165b60038201549093506001600160801b03600160801b909104811690851611611e3c5783611e52565b6003810154600160801b90046001600160801b03165b91506001600160801b03831615611eb7576003810180546001600160801b031981166001600160801b03918216869003821617909155611eb7907f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48908a908616613b86565b6001600160801b03821615611f1d576003810180546001600160801b03600160801b808304821686900382160291811691909117909155611f1d907f000000000000000000000000def1ca1fb7fbcdc777520aa7f396b4e015f497ab908a908516613b86565b604080516001600160a01b038a1681526001600160801b0380861660208301528416818301529051600288810b92908a900b9133917f70935338e69775456a85ddef226c395fb668b63fa0115f5f20610b388e6ca9c0919081900360600190a4506000805460ff60f01b1916600160f01b17905590969095509350505050565b60076020526000908152604090208054600182015460028301546003909301546001600160801b0392831693919281811691600160801b90041685565b60066020526000908152604090205481565b7f0000000000000000000000000000000000023746e6a58dcb13d4af821b93f06281565b600054600160f01b900460ff16612054576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b1916905560408051638da5cb5b60e01b815290516001600160a01b037f0000000000000000000000001f98431c8ad98523631ae4a59f267346ea31f9841691638da5cb5b916004808301926020929190829003018186803b1580156120c157600080fd5b505afa1580156120d5573d6000803e3d6000fd5b505050506040513d60208110156120eb57600080fd5b50516001600160a01b0316331461210157600080fd5b60ff82161580612124575060048260ff16101580156121245750600a8260ff1611155b801561214e575060ff8116158061214e575060048160ff161015801561214e5750600a8160ff1611155b61215757600080fd5b60008054610ff0600484901b16840160ff908116600160e81b9081027fffff00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff841617909355919004167f973d8d92bb299f4af6ce49b52a8adb85ae46b9f214c4c4fc06ac77401237b1336010826040805160ff9390920683168252600f600486901c16602083015286831682820152918516606082015290519081900360800190a150506000805460ff60f01b1916600160f01b17905550565b600080548190600160f01b900460ff16612256576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b1916905560408051638da5cb5b60e01b815290516001600160a01b037f0000000000000000000000001f98431c8ad98523631ae4a59f267346ea31f9841691638da5cb5b916004808301926020929190829003018186803b1580156122c357600080fd5b505afa1580156122d7573d6000803e3d6000fd5b505050506040513d60208110156122ed57600080fd5b50516001600160a01b0316331461230357600080fd5b6003546001600160801b039081169085161161231f578361232c565b6003546001600160801b03165b6003549092506001600160801b03600160801b9091048116908416116123525782612366565b600354600160801b90046001600160801b03165b90506001600160801b038216156123e7576003546001600160801b038381169116141561239557600019909101905b600380546001600160801b031981166001600160801b039182168590038216179091556123e7907f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb489087908516613b86565b6001600160801b0381161561246d576003546001600160801b03828116600160801b90920416141561241857600019015b600380546001600160801b03600160801b80830482168590038216029181169190911790915561246d907f000000000000000000000000def1ca1fb7fbcdc777520aa7f396b4e015f497ab9087908416613b86565b604080516001600160801b0380851682528316602082015281516001600160a01b0388169233927f596b573906218d3411850b26a6b437d6c4522fdb43d2d2386263f86d50b8b151929081900390910190a36000805460ff60f01b1916600160f01b1790559094909350915050565b6060806124e7612bf0565b61255e6124f2612c27565b858580806020026020016040519081016040528093929190818152602001838360200280828437600092018290525054600454600896959450600160a01b820460020b935061ffff600160b81b8304811693506001600160801b0390911691600160c81b900416614247565b915091509250929050565b600080548190600160f01b900460ff166125b0576040805162461bcd60e51b81526020600482015260036024820152624c4f4b60e81b604482015290519081900360640190fd5b6000805460ff60f01b1916815560408051608081018252338152600288810b602083015287900b918101919091528190819061260990606081016125fc6001600160801b038a16613f58565b600003600f0b9052613f69565b925092509250816000039450806000039350600085118061262a5750600084115b15612669576003830180546001600160801b038082168089018216600160801b93849004831689019092169092029091176001600160801b0319161790555b604080516001600160801b0388168152602081018790528082018690529051600289810b92908b900b9133917f0c396cd989a39f4459b5fa1aed6a9a8dcdbc45908acfd67e028cd568da98982c919081900360600190a450506000805460ff60f01b1916600160f01b179055509094909350915050565b60008060006126ed612bf0565b6126f785856143a1565b600285810b810b60009081526005602052604080822087840b90930b825281206003830154600681900b9367010000000000000082046001600160a01b0316928492600160d81b810463ffffffff169284929091600160f81b900460ff168061275f57600080fd5b6003820154600681900b985067010000000000000081046001600160a01b03169650600160d81b810463ffffffff169450600160f81b900460ff16806127a457600080fd5b50506040805160e0810182526000546001600160a01b0381168252600160a01b8104600290810b810b810b6020840181905261ffff600160b81b8404811695850195909552600160c81b830485166060850152600160d81b8304909416608084015260ff600160e81b8304811660a0850152600160f01b909204909116151560c08301529093508e810b91900b1215905061284d575093909403965090039350900390506128d0565b8a60020b816020015160020b12156128c1576000612869612c27565b602083015160408401516004546060860151939450600093849361289f936008938893879392916001600160801b031690613389565b9a9003989098039b5050949096039290920396509091030392506128d0915050565b50949093039650039350900390505b9250925092565b7f0000000000000000000000001f98431c8ad98523631ae4a59f267346ea31f98481565b7f000000000000000000000000000000000000000000000000000000000000003c81565b7f000000000000000000000000def1ca1fb7fbcdc777520aa7f396b4e015f497ab81565b7f0000000000000000000000000000000000000000000000000000000000000bb881565b60015481565b60056020526000908152604090208054600182015460028301546003909301546001600160801b03831693600160801b909304600f0b9290600681900b9067010000000000000081046001600160a01b031690600160d81b810463ffffffff1690600160f81b900460ff1688565b6000546001600160a01b031615612a1e576040805162461bcd60e51b8152602060048201526002602482015261414960f01b604482015290519081900360640190fd5b6000612a29826136a5565b9050600080612a41612a39612c27565b60089061446a565b6040805160e0810182526001600160a01b038816808252600288810b6020808501829052600085870181905261ffff898116606088018190529089166080880181905260a08801839052600160c0909801979097528154600160f01b73ffffffffffffffffffffffffffffffffffffffff19909116871762ffffff60a01b1916600160a01b62ffffff9787900b9790971696909602959095177fffffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffff16600160c81b9091021761ffff60d81b1916600160d81b909602959095177fff0000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1692909217909355835191825281019190915281519395509193507f98636036cb66a9c19a37435efc1e90142190214e8abeb821bdba3f2990dd4c9592918290030190a150505050565b60008082600281900b620d89e71981612b9957fe5b05029050600083600281900b620d89e881612bb057fe5b0502905060008460020b83830360020b81612bc757fe5b0560010190508062ffffff166001600160801b03801681612be457fe5b0493505050505b919050565b306001600160a01b037f000000000000000000000000674da545a40cb9c1aeeb8127c331154ebd0519811614612c2557600080fd5b565b4290565b60008060008460020b8660020b81612c3f57fe5b05905060008660020b128015612c6657508460020b8660020b81612c5f57fe5b0760020b15155b15612c7057600019015b8315612ce557600080612c82836144b6565b600182810b810b600090815260208d9052604090205460ff83169190911b80016000190190811680151597509294509092509085612cc757888360ff16860302612cda565b88612cd1826144c8565b840360ff168603025b965050505050612d63565b600080612cf4836001016144b6565b91509150600060018260ff166001901b031990506000818b60008660010b60010b8152602001908152602001600020541690508060001415955085612d4657888360ff0360ff16866001010102612d5c565b8883612d5183614568565b0360ff168660010101025b9650505050505b5094509492505050565b60008060008360020b12612d84578260020b612d8c565b8260020b6000035b9050620d89e8811115612dca576040805162461bcd60e51b81526020600482015260016024820152601560fa1b604482015290519081900360640190fd5b600060018216612dde57600160801b612df0565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff1690506002821615612e24576ffff97272373d413259a46990580e213a0260801c5b6004821615612e43576ffff2e50f5f656932ef12357cf3c7fdcc0260801c5b6008821615612e62576fffe5caca7e10e4e61c3624eaa0941cd00260801c5b6010821615612e81576fffcb9843d60f6159c9db58835c9266440260801c5b6020821615612ea0576fff973b41fa98c081472e6896dfb254c00260801c5b6040821615612ebf576fff2ea16466c96a3843ec78b326b528610260801c5b6080821615612ede576ffe5dee046a99a2a811c461f1969c30530260801c5b610100821615612efe576ffcbe86c7900a88aedcffc83b479aa3a40260801c5b610200821615612f1e576ff987a7253ac413176f2b074cf7815e540260801c5b610400821615612f3e576ff3392b0822b70005940c7a398e4b70f30260801c5b610800821615612f5e576fe7159475a2c29b7443b29c7fa6e889d90260801c5b611000821615612f7e576fd097f3bdfd2022b8845ad8f792aa58250260801c5b612000821615612f9e576fa9f746462d870fdf8a65dc1f90e061e50260801c5b614000821615612fbe576f70d869a156d2a1b890bb3df62baf32f70260801c5b618000821615612fde576f31be135f97d08fd981231505542fcfa60260801c5b62010000821615612fff576f09aa508b5b7a84e1c677de54f3e99bc90260801c5b6202000082161561301f576e5d6af8dedb81196699c329225ee6040260801c5b6204000082161561303e576d2216e584f5fa1ea926041bedfe980260801c5b6208000082161561305b576b048a170391f7dc42444e8fa20260801c5b60008460020b131561307657806000198161307257fe5b0490505b64010000000081061561308a57600161308d565b60005b60ff16602082901c0192505050919050565b60008080806001600160a01b03808916908a1610158187128015906131245760006130d88989620f42400362ffffff16620f42406132d9565b9050826130f1576130ec8c8c8c6001614652565b6130fe565b6130fe8b8d8c60016146cd565b955085811061310f578a965061311e565b61311b8c8b838661478a565b96505b5061316e565b8161313b576131368b8b8b60006146cd565b613148565b6131488a8c8b6000614652565b935083886000031061315c5789955061316e565b61316b8b8a8a600003856147d6565b95505b6001600160a01b038a81169087161482156131d15780801561318d5750815b6131a35761319e878d8c60016146cd565b6131a5565b855b95508080156131b2575081155b6131c8576131c3878d8c6000614652565b6131ca565b845b945061321b565b8080156131db5750815b6131f1576131ec8c888c6001614652565b6131f3565b855b9550808015613200575081155b613216576132118c888c60006146cd565b613218565b845b94505b8115801561322b57508860000385115b15613237578860000394505b81801561325657508a6001600160a01b0316876001600160a01b031614155b15613265578589039350613282565b61327f868962ffffff168a620f42400362ffffff166141a9565b93505b50505095509550955095915050565b6000600160ff1b82106132a357600080fd5b5090565b808203828113156000831215146132bd57600080fd5b92915050565b818101828112156000831215146132bd57600080fd5b600080806000198587098686029250828110908390030390508061330f576000841161330457600080fd5b508290049050613382565b80841161331b57600080fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150505b9392505050565b60008063ffffffff8716613430576000898661ffff1661ffff81106133aa57fe5b60408051608081018252919092015463ffffffff8082168084526401000000008304600690810b810b900b6020850152600160581b83046001600160a01b031694840194909452600160f81b90910460ff16151560608301529092508a161461341c57613419818a8988614822565b90505b806020015181604001519250925050613510565b8688036000806134458c8c858c8c8c8c6148d2565b91509150816000015163ffffffff168363ffffffff161415613477578160200151826040015194509450505050613510565b805163ffffffff8481169116141561349f578060200151816040015194509450505050613510565b8151815160208085015190840151918390039286039163ffffffff80841692908516910360060b816134cd57fe5b05028460200151018263ffffffff168263ffffffff1686604001518660400151036001600160a01b031602816134ff57fe5b048560400151019650965050505050505b97509795505050505050565b600295860b860b60009081526020979097526040909620600181018054909503909455938301805490920390915560038201805463ffffffff600160d81b6001600160a01b036701000000000000008085048216909603169094027fffffffffff0000000000000000000000000000000000000000ffffffffffffff90921691909117600681810b90960390950b66ffffffffffffff1666ffffffffffffff199095169490941782810485169095039093160263ffffffff60d81b1990931692909217905554600160801b9004600f0b90565b60008082600f0b121561365457826001600160801b03168260000384039150816001600160801b03161061364f576040805162461bcd60e51b81526020600482015260026024820152614c5360f01b604482015290519081900360640190fd5b6132bd565b826001600160801b03168284019150816001600160801b031610156132bd576040805162461bcd60e51b81526020600482015260026024820152614c4160f01b604482015290519081900360640190fd5b60006401000276a36001600160a01b038316108015906136e1575073fffd8963efd1fc6a506488495d951d5263988d266001600160a01b038316105b613716576040805162461bcd60e51b81526020600482015260016024820152602960f91b604482015290519081900360640190fd5b77ffffffffffffffffffffffffffffffffffffffff00000000602083901b166001600160801b03811160071b81811c67ffffffffffffffff811160061b90811c63ffffffff811160051b90811c61ffff811160041b90811c60ff8111600390811b91821c600f811160021b90811c918211600190811b92831c979088119617909417909217179091171717608081106137b757607f810383901c91506137c1565b80607f0383901b91505b908002607f81811c60ff83811c9190911c800280831c81831c1c800280841c81841c1c800280851c81851c1c800280861c81861c1c800280871c81871c1c800280881c81881c1c800280891c81891c1c8002808a1c818a1c1c8002808b1c818b1c1c8002808c1c818c1c1c8002808d1c818d1c1c8002808e1c9c81901c9c909c1c80029c8d901c9e9d607f198f0160401b60c09190911c678000000000000000161760c19b909b1c674000000000000000169a909a1760c29990991c672000000000000000169890981760c39790971c671000000000000000169690961760c49590951c670800000000000000169490941760c59390931c670400000000000000169290921760c69190911c670200000000000000161760c79190911c670100000000000000161760c89190911c6680000000000000161760c99190911c6640000000000000161760ca9190911c6620000000000000161760cb9190911c6610000000000000161760cc9190911c6608000000000000161760cd9190911c66040000000000001617693627a301d71055774c8581026f028f6481ab7f045a5af012a19d003aa9198101608090811d906fdb2df09e81959a81455e260799a0632f8301901d600281810b9083900b146139c257886001600160a01b03166139a682612d6d565b6001600160a01b031611156139bb57816139bd565b805b6139c4565b815b9998505050505050505050565b6000806000898961ffff1661ffff81106139e757fe5b60408051608081018252919092015463ffffffff8082168084526401000000008304600690810b810b900b6020850152600160581b83046001600160a01b031694840194909452600160f81b90910460ff161515606083015290925089161415613a575788859250925050613510565b8461ffff168461ffff16118015613a7857506001850361ffff168961ffff16145b15613a8557839150613a89565b8491505b8161ffff168960010161ffff1681613a9d57fe5b069250613aac81898989614822565b8a8461ffff1661ffff8110613abd57fe5b825191018054602084015160408501516060909501511515600160f81b027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6001600160a01b03909616600160581b027fff0000000000000000000000000000000000000000ffffffffffffffffffffff60069390930b66ffffffffffffff16640100000000026affffffffffffff000000001963ffffffff90971663ffffffff199095169490941795909516929092171692909217929092161790555097509795505050505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1781529251825160009485949389169392918291908083835b60208310613c025780518252601f199092019160209182019101613be3565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114613c64576040519150601f19603f3d011682016040523d82523d6000602084013e613c69565b606091505b5091509150818015613c97575080511580613c975750808060200190516020811015613c9457600080fd5b50515b613ccd576040805162461bcd60e51b81526020600482015260026024820152612a2360f11b604482015290519081900360640190fd5b5050505050565b604080513060248083019190915282518083039091018152604490910182526020810180516001600160e01b03166370a0823160e01b17815291518151600093849384936001600160a01b037f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb481693919290918291908083835b60208310613d6d5780518252601f199092019160209182019101613d4e565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114613dcd576040519150601f19603f3d011682016040523d82523d6000602084013e613dd2565b606091505b5091509150818015613de657506020815110155b613def57600080fd5b808060200190516020811015613e0457600080fd5b50519250505090565b808201828110156132bd57600080fd5b604080513060248083019190915282518083039091018152604490910182526020810180516001600160e01b03166370a0823160e01b17815291518151600093849384936001600160a01b037f000000000000000000000000def1ca1fb7fbcdc777520aa7f396b4e015f497ab16939192909182919080838360208310613d6d5780518252601f199092019160209182019101613d4e565b6000808361ffff1611613ef3576040805162461bcd60e51b81526020600482015260016024820152604960f81b604482015290519081900360640190fd5b8261ffff168261ffff1611613f09575081613382565b825b8261ffff168161ffff161015613f4f576001858261ffff1661ffff8110613f2e57fe5b01805463ffffffff191663ffffffff92909216919091179055600101613f0b565b50909392505050565b80600f81900b8114612beb57600080fd5b6000806000613f76612bf0565b613f88846020015185604001516143a1565b6040805160e0810182526000546001600160a01b0381168252600160a01b8104600290810b810b900b602080840182905261ffff600160b81b8404811685870152600160c81b84048116606080870191909152600160d81b8504909116608086015260ff600160e81b8504811660a0870152600160f01b909404909316151560c08501528851908901519489015192890151939461402c9491939092909190614acf565b93508460600151600f0b6000146141a157846020015160020b816020015160020b12156140815761407a6140638660200151612d6d565b6140708760400151612d6d565b8760600151614c84565b92506141a1565b846040015160020b816020015160020b12156141775760045460408201516001600160801b03909116906140d3906140b7612c27565b60208501516060860151608087015160089493929187916139d1565b6000805461ffff60c81b1916600160c81b61ffff938416021761ffff60b81b1916600160b81b939092169290920217905581516040870151614123919061411990612d6d565b8860600151614c84565b93506141416141358760200151612d6d565b83516060890151614cc8565b92506141518187606001516135ef565b600480546001600160801b0319166001600160801b0392909216919091179055506141a1565b61419e6141878660200151612d6d565b6141948760400151612d6d565b8760600151614cc8565b91505b509193909250565b60006141b68484846132d9565b9050600082806141c257fe5b84860911156133825760001981106141d957600080fd5b6001019392505050565b6040805160609490941b6bffffffffffffffffffffffff1916602080860191909152600293840b60e890811b60348701529290930b90911b60378401528051808403601a018152603a90930181528251928201929092206000908152929052902090565b60608060008361ffff1611614287576040805162461bcd60e51b81526020600482015260016024820152604960f81b604482015290519081900360640190fd5b865167ffffffffffffffff8111801561429f57600080fd5b506040519080825280602002602001820160405280156142c9578160200160208202803683370190505b509150865167ffffffffffffffff811180156142e457600080fd5b5060405190808252806020026020018201604052801561430e578160200160208202803683370190505b50905060005b87518110156143945761433f8a8a8a848151811061432e57fe5b60200260200101518a8a8a8a613389565b84838151811061434b57fe5b6020026020010184848151811061435e57fe5b60200260200101826001600160a01b03166001600160a01b03168152508260060b60060b81525050508080600101915050614314565b5097509795505050505050565b8060020b8260020b126143e1576040805162461bcd60e51b8152602060048201526003602482015262544c5560e81b604482015290519081900360640190fd5b620d89e719600283900b1215614424576040805162461bcd60e51b8152602060048201526003602482015262544c4d60e81b604482015290519081900360640190fd5b620d89e8600282900b1315614466576040805162461bcd60e51b815260206004820152600360248201526254554d60e81b604482015290519081900360640190fd5b5050565b6040805160808101825263ffffffff9283168082526000602083018190529282019290925260016060909101819052835463ffffffff1916909117909116600160f81b17909155908190565b60020b600881901d9161010090910790565b60008082116144d657600080fd5b600160801b82106144e957608091821c91015b68010000000000000000821061450157604091821c91015b640100000000821061451557602091821c91015b62010000821061452757601091821c91015b610100821061453857600891821c91015b6010821061454857600491821c91015b6004821061455857600291821c91015b60028210612beb57600101919050565b600080821161457657600080fd5b5060ff6001600160801b0382161561459157607f1901614599565b608082901c91505b67ffffffffffffffff8216156145b257603f19016145ba565b604082901c91505b63ffffffff8216156145cf57601f19016145d7565b602082901c91505b61ffff8216156145ea57600f19016145f2565b601082901c91505b60ff821615614604576007190161460c565b600882901c91505b600f82161561461e5760031901614626565b600482901c91505b60038216156146385760011901614640565b600282901c91505b6001821615612beb5760001901919050565b6000836001600160a01b0316856001600160a01b03161115614672579293925b8161469f5761469a836001600160801b03168686036001600160a01b0316600160601b6132d9565b6146c2565b6146c2836001600160801b03168686036001600160a01b0316600160601b6141a9565b90505b949350505050565b6000836001600160a01b0316856001600160a01b031611156146ed579293925b7bffffffffffffffffffffffffffffffff000000000000000000000000606084901b166001600160a01b03868603811690871661472957600080fd5b8361475957866001600160a01b031661474c8383896001600160a01b03166132d9565b8161475357fe5b0461477f565b61477f6147708383896001600160a01b03166141a9565b886001600160a01b0316614cf7565b979650505050505050565b600080856001600160a01b0316116147a157600080fd5b6000846001600160801b0316116147b757600080fd5b816147c95761469a8585856001614d02565b6146c28585856001614de3565b600080856001600160a01b0316116147ed57600080fd5b6000846001600160801b03161161480357600080fd5b816148155761469a8585856000614de3565b6146c28585856000614d02565b61482a61564a565b600085600001518503905060405180608001604052808663ffffffff1681526020018263ffffffff168660020b0288602001510160060b81526020016000856001600160801b03161161487e576001614880565b845b6001600160801b031673ffffffff00000000000000000000000000000000608085901b16816148ab57fe5b048860400151016001600160a01b0316815260200160011515815250915050949350505050565b6148da61564a565b6148e261564a565b888561ffff1661ffff81106148f357fe5b60408051608081018252919092015463ffffffff81168083526401000000008204600690810b810b900b6020840152600160581b82046001600160a01b031693830193909352600160f81b900460ff1615156060820152925061495890899089614ed8565b15614990578663ffffffff16826000015163ffffffff16141561497a57613510565b8161498783898988614822565b91509150613510565b888361ffff168660010161ffff16816149a557fe5b0661ffff1661ffff81106149b557fe5b60408051608081018252929091015463ffffffff811683526401000000008104600690810b810b900b60208401526001600160a01b03600160581b8204169183019190915260ff600160f81b90910416151560608201819052909250614a6c57604080516080810182528a5463ffffffff811682526401000000008104600690810b810b900b6020830152600160581b81046001600160a01b031692820192909252600160f81b90910460ff161515606082015291505b614a7b88836000015189614ed8565b614ab2576040805162461bcd60e51b815260206004820152600360248201526213d31160ea1b604482015290519081900360640190fd5b614abf8989898887614f9b565b9150915097509795505050505050565b6000614ade60078787876141e3565b60015460025491925090600080600f87900b15614c24576000614aff612c27565b6000805460045492935090918291614b499160089186918591600160a01b810460020b9161ffff600160b81b83048116926001600160801b0390921691600160c81b900416613389565b9092509050614b8360058d8b8d8b8b87898b60007f0000000000000000000000000000000000023746e6a58dcb13d4af821b93f06261513b565b9450614bba60058c8b8d8b8b87898b60017f0000000000000000000000000000000000023746e6a58dcb13d4af821b93f06261513b565b93508415614bee57614bee60068d7f000000000000000000000000000000000000000000000000000000000000003c615325565b8315614c2057614c2060068c7f000000000000000000000000000000000000000000000000000000000000003c615325565b5050505b600080614c3660058c8c8b8a8a61538b565b9092509050614c47878a8484615437565b600089600f0b1215614c75578315614c6457614c6460058c6155cc565b8215614c7557614c7560058b6155cc565b50505050505095945050505050565b60008082600f0b12614caa57614ca5614ca085858560016146cd565b613291565b6146c5565b614cbd614ca085858560000360006146cd565b600003949350505050565b60008082600f0b12614ce457614ca5614ca08585856001614652565b614cbd614ca08585856000036000614652565b808204910615150190565b60008115614d755760006001600160a01b03841115614d3857614d3384600160601b876001600160801b03166132d9565b614d50565b6001600160801b038516606085901b81614d4e57fe5b045b9050614d6d614d686001600160a01b03881683613e0d565b6155f8565b9150506146c5565b60006001600160a01b03841115614da357614d9e84600160601b876001600160801b03166141a9565b614dba565b614dba606085901b6001600160801b038716614cf7565b905080866001600160a01b031611614dd157600080fd5b6001600160a01b0386160390506146c5565b600082614df15750836146c5565b7bffffffffffffffffffffffffffffffff000000000000000000000000606085901b168215614e91576001600160a01b03861684810290858281614e3157fe5b041415614e6257818101828110614e6057614e5683896001600160a01b0316836141a9565b93505050506146c5565b505b614e8882614e83878a6001600160a01b03168681614e7c57fe5b0490613e0d565b614cf7565b925050506146c5565b6001600160a01b03861684810290858281614ea857fe5b04148015614eb557508082115b614ebe57600080fd5b808203614e56614d68846001600160a01b038b16846141a9565b60008363ffffffff168363ffffffff1611158015614f0257508363ffffffff168263ffffffff1611155b15614f1e578163ffffffff168363ffffffff1611159050613382565b60008463ffffffff168463ffffffff1611614f46578363ffffffff1664010000000001614f4e565b8363ffffffff165b64ffffffffff16905060008563ffffffff168463ffffffff1611614f7f578363ffffffff1664010000000001614f87565b8363ffffffff165b64ffffffffff169091111595945050505050565b614fa361564a565b614fab61564a565b60008361ffff168560010161ffff1681614fc157fe5b0661ffff169050600060018561ffff16830103905060005b506002818301048961ffff87168281614fee57fe5b0661ffff8110614ffa57fe5b60408051608081018252929091015463ffffffff811683526401000000008104600690810b810b900b60208401526001600160a01b03600160581b8204169183019190915260ff600160f81b9091041615156060820181905290955061506557806001019250614fd9565b898661ffff16826001018161507657fe5b0661ffff811061508257fe5b60408051608081018252929091015463ffffffff811683526401000000008104600690810b810b900b60208401526001600160a01b03600160581b8204169183019190915260ff600160f81b909104161515606082015285519094506000906150ed908b908b614ed8565b905080801561510657506151068a8a8760000151614ed8565b15615111575061512e565b8061512157600182039250615128565b8160010193505b50614fd9565b5050509550959350505050565b60028a810b900b600090815260208c90526040812080546001600160801b031682615166828d6135ef565b9050846001600160801b0316816001600160801b031611156151b4576040805162461bcd60e51b81526020600482015260026024820152614c4f60f01b604482015290519081900360640190fd5b6001600160801b03828116159082161581141594501561528a578c60020b8e60020b1361525a57600183018b9055600283018a90556003830180547fffffffffff0000000000000000000000000000000000000000ffffffffffffff166701000000000000006001600160a01b038c16021766ffffffffffffff191666ffffffffffffff60068b900b161763ffffffff60d81b1916600160d81b63ffffffff8a16021790555b6003830180547effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16600160f81b1790555b82546001600160801b0319166001600160801b038216178355856152d35782546152ce906152c990600160801b9004600f90810b810b908f900b6132c3565b613f58565b6152f4565b82546152f4906152c990600160801b9004600f90810b810b908f900b6132a7565b8354600f9190910b6001600160801b03908116600160801b0291161790925550909c9b505050505050505050505050565b8060020b8260020b8161533457fe5b0760020b1561534257600080fd5b60008061535d8360020b8560020b8161535757fe5b056144b6565b600191820b820b60009081526020979097526040909620805460ff9097169190911b90951890945550505050565b600285810b80820b60009081526020899052604080822088850b850b83529082209193849391929184918291908a900b126153d1575050600182015460028301546153e4565b8360010154880391508360020154870390505b6000808b60020b8b60020b121561540657505060018301546002840154615419565b84600101548a0391508460020154890390505b92909803979097039b96909503949094039850939650505050505050565b6040805160a08101825285546001600160801b0390811682526001870154602083015260028701549282019290925260038601548083166060830152600160801b900490911660808201526000600f85900b6154d65781516001600160801b03166154ce576040805162461bcd60e51b815260206004820152600260248201526104e560f41b604482015290519081900360640190fd5b5080516154e5565b81516154e290866135ef565b90505b60006155098360200151860384600001516001600160801b0316600160801b6132d9565b9050600061552f8460400151860385600001516001600160801b0316600160801b6132d9565b905086600f0b6000146155565787546001600160801b0319166001600160801b0384161788555b60018801869055600288018590556001600160801b03821615158061558457506000816001600160801b0316115b156155c2576003880180546001600160801b031981166001600160801b039182168501821617808216600160801b9182900483168501909216021790555b5050505050505050565b600290810b810b6000908152602092909252604082208281556001810183905590810182905560030155565b806001600160a01b0381168114612beb57600080fd5b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c081019190915290565b6040805160808101825260008082526020820181905291810182905260608101919091529056fea164736f6c6343000706000a
{{ "language": "Solidity", "sources": { "contracts/UniswapV3Pool.sol": { "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity =0.7.6;\n\nimport './interfaces/IUniswapV3Pool.sol';\n\nimport './NoDelegateCall.sol';\n\nimport './libraries/LowGasSafeMath.sol';\nimport './libraries/SafeCast.sol';\nimport './libraries/Tick.sol';\nimport './libraries/TickBitmap.sol';\nimport './libraries/Position.sol';\nimport './libraries/Oracle.sol';\n\nimport './libraries/FullMath.sol';\nimport './libraries/FixedPoint128.sol';\nimport './libraries/TransferHelper.sol';\nimport './libraries/TickMath.sol';\nimport './libraries/LiquidityMath.sol';\nimport './libraries/SqrtPriceMath.sol';\nimport './libraries/SwapMath.sol';\n\nimport './interfaces/IUniswapV3PoolDeployer.sol';\nimport './interfaces/IUniswapV3Factory.sol';\nimport './interfaces/IERC20Minimal.sol';\nimport './interfaces/callback/IUniswapV3MintCallback.sol';\nimport './interfaces/callback/IUniswapV3SwapCallback.sol';\nimport './interfaces/callback/IUniswapV3FlashCallback.sol';\n\ncontract UniswapV3Pool is IUniswapV3Pool, NoDelegateCall {\n using LowGasSafeMath for uint256;\n using LowGasSafeMath for int256;\n using SafeCast for uint256;\n using SafeCast for int256;\n using Tick for mapping(int24 => Tick.Info);\n using TickBitmap for mapping(int16 => uint256);\n using Position for mapping(bytes32 => Position.Info);\n using Position for Position.Info;\n using Oracle for Oracle.Observation[65535];\n\n /// @inheritdoc IUniswapV3PoolImmutables\n address public immutable override factory;\n /// @inheritdoc IUniswapV3PoolImmutables\n address public immutable override token0;\n /// @inheritdoc IUniswapV3PoolImmutables\n address public immutable override token1;\n /// @inheritdoc IUniswapV3PoolImmutables\n uint24 public immutable override fee;\n\n /// @inheritdoc IUniswapV3PoolImmutables\n int24 public immutable override tickSpacing;\n\n /// @inheritdoc IUniswapV3PoolImmutables\n uint128 public immutable override maxLiquidityPerTick;\n\n struct Slot0 {\n // the current price\n uint160 sqrtPriceX96;\n // the current tick\n int24 tick;\n // the most-recently updated index of the observations array\n uint16 observationIndex;\n // the current maximum number of observations that are being stored\n uint16 observationCardinality;\n // the next maximum number of observations to store, triggered in observations.write\n uint16 observationCardinalityNext;\n // the current protocol fee as a percentage of the swap fee taken on withdrawal\n // represented as an integer denominator (1/x)%\n uint8 feeProtocol;\n // whether the pool is locked\n bool unlocked;\n }\n /// @inheritdoc IUniswapV3PoolState\n Slot0 public override slot0;\n\n /// @inheritdoc IUniswapV3PoolState\n uint256 public override feeGrowthGlobal0X128;\n /// @inheritdoc IUniswapV3PoolState\n uint256 public override feeGrowthGlobal1X128;\n\n // accumulated protocol fees in token0/token1 units\n struct ProtocolFees {\n uint128 token0;\n uint128 token1;\n }\n /// @inheritdoc IUniswapV3PoolState\n ProtocolFees public override protocolFees;\n\n /// @inheritdoc IUniswapV3PoolState\n uint128 public override liquidity;\n\n /// @inheritdoc IUniswapV3PoolState\n mapping(int24 => Tick.Info) public override ticks;\n /// @inheritdoc IUniswapV3PoolState\n mapping(int16 => uint256) public override tickBitmap;\n /// @inheritdoc IUniswapV3PoolState\n mapping(bytes32 => Position.Info) public override positions;\n /// @inheritdoc IUniswapV3PoolState\n Oracle.Observation[65535] public override observations;\n\n /// @dev Mutually exclusive reentrancy protection into the pool to/from a method. This method also prevents entrance\n /// to a function before the pool is initialized. The reentrancy guard is required throughout the contract because\n /// we use balance checks to determine the payment status of interactions such as mint, swap and flash.\n modifier lock() {\n require(slot0.unlocked, 'LOK');\n slot0.unlocked = false;\n _;\n slot0.unlocked = true;\n }\n\n /// @dev Prevents calling a function from anyone except the address returned by IUniswapV3Factory#owner()\n modifier onlyFactoryOwner() {\n require(msg.sender == IUniswapV3Factory(factory).owner());\n _;\n }\n\n constructor() {\n int24 _tickSpacing;\n (factory, token0, token1, fee, _tickSpacing) = IUniswapV3PoolDeployer(msg.sender).parameters();\n tickSpacing = _tickSpacing;\n\n maxLiquidityPerTick = Tick.tickSpacingToMaxLiquidityPerTick(_tickSpacing);\n }\n\n /// @dev Common checks for valid tick inputs.\n function checkTicks(int24 tickLower, int24 tickUpper) private pure {\n require(tickLower < tickUpper, 'TLU');\n require(tickLower >= TickMath.MIN_TICK, 'TLM');\n require(tickUpper <= TickMath.MAX_TICK, 'TUM');\n }\n\n /// @dev Returns the block timestamp truncated to 32 bits, i.e. mod 2**32. This method is overridden in tests.\n function _blockTimestamp() internal view virtual returns (uint32) {\n return uint32(block.timestamp); // truncation is desired\n }\n\n /// @dev Get the pool's balance of token0\n /// @dev This function is gas optimized to avoid a redundant extcodesize check in addition to the returndatasize\n /// check\n function balance0() private view returns (uint256) {\n (bool success, bytes memory data) =\n token0.staticcall(abi.encodeWithSelector(IERC20Minimal.balanceOf.selector, address(this)));\n require(success && data.length >= 32);\n return abi.decode(data, (uint256));\n }\n\n /// @dev Get the pool's balance of token1\n /// @dev This function is gas optimized to avoid a redundant extcodesize check in addition to the returndatasize\n /// check\n function balance1() private view returns (uint256) {\n (bool success, bytes memory data) =\n token1.staticcall(abi.encodeWithSelector(IERC20Minimal.balanceOf.selector, address(this)));\n require(success && data.length >= 32);\n return abi.decode(data, (uint256));\n }\n\n /// @inheritdoc IUniswapV3PoolDerivedState\n function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)\n external\n view\n override\n noDelegateCall\n returns (\n int56 tickCumulativeInside,\n uint160 secondsPerLiquidityInsideX128,\n uint32 secondsInside\n )\n {\n checkTicks(tickLower, tickUpper);\n\n int56 tickCumulativeLower;\n int56 tickCumulativeUpper;\n uint160 secondsPerLiquidityOutsideLowerX128;\n uint160 secondsPerLiquidityOutsideUpperX128;\n uint32 secondsOutsideLower;\n uint32 secondsOutsideUpper;\n\n {\n Tick.Info storage lower = ticks[tickLower];\n Tick.Info storage upper = ticks[tickUpper];\n bool initializedLower;\n (tickCumulativeLower, secondsPerLiquidityOutsideLowerX128, secondsOutsideLower, initializedLower) = (\n lower.tickCumulativeOutside,\n lower.secondsPerLiquidityOutsideX128,\n lower.secondsOutside,\n lower.initialized\n );\n require(initializedLower);\n\n bool initializedUpper;\n (tickCumulativeUpper, secondsPerLiquidityOutsideUpperX128, secondsOutsideUpper, initializedUpper) = (\n upper.tickCumulativeOutside,\n upper.secondsPerLiquidityOutsideX128,\n upper.secondsOutside,\n upper.initialized\n );\n require(initializedUpper);\n }\n\n Slot0 memory _slot0 = slot0;\n\n if (_slot0.tick < tickLower) {\n return (\n tickCumulativeLower - tickCumulativeUpper,\n secondsPerLiquidityOutsideLowerX128 - secondsPerLiquidityOutsideUpperX128,\n secondsOutsideLower - secondsOutsideUpper\n );\n } else if (_slot0.tick < tickUpper) {\n uint32 time = _blockTimestamp();\n (int56 tickCumulative, uint160 secondsPerLiquidityCumulativeX128) =\n observations.observeSingle(\n time,\n 0,\n _slot0.tick,\n _slot0.observationIndex,\n liquidity,\n _slot0.observationCardinality\n );\n return (\n tickCumulative - tickCumulativeLower - tickCumulativeUpper,\n secondsPerLiquidityCumulativeX128 -\n secondsPerLiquidityOutsideLowerX128 -\n secondsPerLiquidityOutsideUpperX128,\n time - secondsOutsideLower - secondsOutsideUpper\n );\n } else {\n return (\n tickCumulativeUpper - tickCumulativeLower,\n secondsPerLiquidityOutsideUpperX128 - secondsPerLiquidityOutsideLowerX128,\n secondsOutsideUpper - secondsOutsideLower\n );\n }\n }\n\n /// @inheritdoc IUniswapV3PoolDerivedState\n function observe(uint32[] calldata secondsAgos)\n external\n view\n override\n noDelegateCall\n returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s)\n {\n return\n observations.observe(\n _blockTimestamp(),\n secondsAgos,\n slot0.tick,\n slot0.observationIndex,\n liquidity,\n slot0.observationCardinality\n );\n }\n\n /// @inheritdoc IUniswapV3PoolActions\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext)\n external\n override\n lock\n noDelegateCall\n {\n uint16 observationCardinalityNextOld = slot0.observationCardinalityNext; // for the event\n uint16 observationCardinalityNextNew =\n observations.grow(observationCardinalityNextOld, observationCardinalityNext);\n slot0.observationCardinalityNext = observationCardinalityNextNew;\n if (observationCardinalityNextOld != observationCardinalityNextNew)\n emit IncreaseObservationCardinalityNext(observationCardinalityNextOld, observationCardinalityNextNew);\n }\n\n /// @inheritdoc IUniswapV3PoolActions\n /// @dev not locked because it initializes unlocked\n function initialize(uint160 sqrtPriceX96) external override {\n require(slot0.sqrtPriceX96 == 0, 'AI');\n\n int24 tick = TickMath.getTickAtSqrtRatio(sqrtPriceX96);\n\n (uint16 cardinality, uint16 cardinalityNext) = observations.initialize(_blockTimestamp());\n\n slot0 = Slot0({\n sqrtPriceX96: sqrtPriceX96,\n tick: tick,\n observationIndex: 0,\n observationCardinality: cardinality,\n observationCardinalityNext: cardinalityNext,\n feeProtocol: 0,\n unlocked: true\n });\n\n emit Initialize(sqrtPriceX96, tick);\n }\n\n struct ModifyPositionParams {\n // the address that owns the position\n address owner;\n // the lower and upper tick of the position\n int24 tickLower;\n int24 tickUpper;\n // any change in liquidity\n int128 liquidityDelta;\n }\n\n /// @dev Effect some changes to a position\n /// @param params the position details and the change to the position's liquidity to effect\n /// @return position a storage pointer referencing the position with the given owner and tick range\n /// @return amount0 the amount of token0 owed to the pool, negative if the pool should pay the recipient\n /// @return amount1 the amount of token1 owed to the pool, negative if the pool should pay the recipient\n function _modifyPosition(ModifyPositionParams memory params)\n private\n noDelegateCall\n returns (\n Position.Info storage position,\n int256 amount0,\n int256 amount1\n )\n {\n checkTicks(params.tickLower, params.tickUpper);\n\n Slot0 memory _slot0 = slot0; // SLOAD for gas optimization\n\n position = _updatePosition(\n params.owner,\n params.tickLower,\n params.tickUpper,\n params.liquidityDelta,\n _slot0.tick\n );\n\n if (params.liquidityDelta != 0) {\n if (_slot0.tick < params.tickLower) {\n // current tick is below the passed range; liquidity can only become in range by crossing from left to\n // right, when we'll need _more_ token0 (it's becoming more valuable) so user must provide it\n amount0 = SqrtPriceMath.getAmount0Delta(\n TickMath.getSqrtRatioAtTick(params.tickLower),\n TickMath.getSqrtRatioAtTick(params.tickUpper),\n params.liquidityDelta\n );\n } else if (_slot0.tick < params.tickUpper) {\n // current tick is inside the passed range\n uint128 liquidityBefore = liquidity; // SLOAD for gas optimization\n\n // write an oracle entry\n (slot0.observationIndex, slot0.observationCardinality) = observations.write(\n _slot0.observationIndex,\n _blockTimestamp(),\n _slot0.tick,\n liquidityBefore,\n _slot0.observationCardinality,\n _slot0.observationCardinalityNext\n );\n\n amount0 = SqrtPriceMath.getAmount0Delta(\n _slot0.sqrtPriceX96,\n TickMath.getSqrtRatioAtTick(params.tickUpper),\n params.liquidityDelta\n );\n amount1 = SqrtPriceMath.getAmount1Delta(\n TickMath.getSqrtRatioAtTick(params.tickLower),\n _slot0.sqrtPriceX96,\n params.liquidityDelta\n );\n\n liquidity = LiquidityMath.addDelta(liquidityBefore, params.liquidityDelta);\n } else {\n // current tick is above the passed range; liquidity can only become in range by crossing from right to\n // left, when we'll need _more_ token1 (it's becoming more valuable) so user must provide it\n amount1 = SqrtPriceMath.getAmount1Delta(\n TickMath.getSqrtRatioAtTick(params.tickLower),\n TickMath.getSqrtRatioAtTick(params.tickUpper),\n params.liquidityDelta\n );\n }\n }\n }\n\n /// @dev Gets and updates a position with the given liquidity delta\n /// @param owner the owner of the position\n /// @param tickLower the lower tick of the position's tick range\n /// @param tickUpper the upper tick of the position's tick range\n /// @param tick the current tick, passed to avoid sloads\n function _updatePosition(\n address owner,\n int24 tickLower,\n int24 tickUpper,\n int128 liquidityDelta,\n int24 tick\n ) private returns (Position.Info storage position) {\n position = positions.get(owner, tickLower, tickUpper);\n\n uint256 _feeGrowthGlobal0X128 = feeGrowthGlobal0X128; // SLOAD for gas optimization\n uint256 _feeGrowthGlobal1X128 = feeGrowthGlobal1X128; // SLOAD for gas optimization\n\n // if we need to update the ticks, do it\n bool flippedLower;\n bool flippedUpper;\n if (liquidityDelta != 0) {\n uint32 time = _blockTimestamp();\n (int56 tickCumulative, uint160 secondsPerLiquidityCumulativeX128) =\n observations.observeSingle(\n time,\n 0,\n slot0.tick,\n slot0.observationIndex,\n liquidity,\n slot0.observationCardinality\n );\n\n flippedLower = ticks.update(\n tickLower,\n tick,\n liquidityDelta,\n _feeGrowthGlobal0X128,\n _feeGrowthGlobal1X128,\n secondsPerLiquidityCumulativeX128,\n tickCumulative,\n time,\n false,\n maxLiquidityPerTick\n );\n flippedUpper = ticks.update(\n tickUpper,\n tick,\n liquidityDelta,\n _feeGrowthGlobal0X128,\n _feeGrowthGlobal1X128,\n secondsPerLiquidityCumulativeX128,\n tickCumulative,\n time,\n true,\n maxLiquidityPerTick\n );\n\n if (flippedLower) {\n tickBitmap.flipTick(tickLower, tickSpacing);\n }\n if (flippedUpper) {\n tickBitmap.flipTick(tickUpper, tickSpacing);\n }\n }\n\n (uint256 feeGrowthInside0X128, uint256 feeGrowthInside1X128) =\n ticks.getFeeGrowthInside(tickLower, tickUpper, tick, _feeGrowthGlobal0X128, _feeGrowthGlobal1X128);\n\n position.update(liquidityDelta, feeGrowthInside0X128, feeGrowthInside1X128);\n\n // clear any tick data that is no longer needed\n if (liquidityDelta < 0) {\n if (flippedLower) {\n ticks.clear(tickLower);\n }\n if (flippedUpper) {\n ticks.clear(tickUpper);\n }\n }\n }\n\n /// @inheritdoc IUniswapV3PoolActions\n /// @dev noDelegateCall is applied indirectly via _modifyPosition\n function mint(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount,\n bytes calldata data\n ) external override lock returns (uint256 amount0, uint256 amount1) {\n require(amount > 0);\n (, int256 amount0Int, int256 amount1Int) =\n _modifyPosition(\n ModifyPositionParams({\n owner: recipient,\n tickLower: tickLower,\n tickUpper: tickUpper,\n liquidityDelta: int256(amount).toInt128()\n })\n );\n\n amount0 = uint256(amount0Int);\n amount1 = uint256(amount1Int);\n\n uint256 balance0Before;\n uint256 balance1Before;\n if (amount0 > 0) balance0Before = balance0();\n if (amount1 > 0) balance1Before = balance1();\n IUniswapV3MintCallback(msg.sender).uniswapV3MintCallback(amount0, amount1, data);\n if (amount0 > 0) require(balance0Before.add(amount0) <= balance0(), 'M0');\n if (amount1 > 0) require(balance1Before.add(amount1) <= balance1(), 'M1');\n\n emit Mint(msg.sender, recipient, tickLower, tickUpper, amount, amount0, amount1);\n }\n\n /// @inheritdoc IUniswapV3PoolActions\n function collect(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external override lock returns (uint128 amount0, uint128 amount1) {\n // we don't need to checkTicks here, because invalid positions will never have non-zero tokensOwed{0,1}\n Position.Info storage position = positions.get(msg.sender, tickLower, tickUpper);\n\n amount0 = amount0Requested > position.tokensOwed0 ? position.tokensOwed0 : amount0Requested;\n amount1 = amount1Requested > position.tokensOwed1 ? position.tokensOwed1 : amount1Requested;\n\n if (amount0 > 0) {\n position.tokensOwed0 -= amount0;\n TransferHelper.safeTransfer(token0, recipient, amount0);\n }\n if (amount1 > 0) {\n position.tokensOwed1 -= amount1;\n TransferHelper.safeTransfer(token1, recipient, amount1);\n }\n\n emit Collect(msg.sender, recipient, tickLower, tickUpper, amount0, amount1);\n }\n\n /// @inheritdoc IUniswapV3PoolActions\n /// @dev noDelegateCall is applied indirectly via _modifyPosition\n function burn(\n int24 tickLower,\n int24 tickUpper,\n uint128 amount\n ) external override lock returns (uint256 amount0, uint256 amount1) {\n (Position.Info storage position, int256 amount0Int, int256 amount1Int) =\n _modifyPosition(\n ModifyPositionParams({\n owner: msg.sender,\n tickLower: tickLower,\n tickUpper: tickUpper,\n liquidityDelta: -int256(amount).toInt128()\n })\n );\n\n amount0 = uint256(-amount0Int);\n amount1 = uint256(-amount1Int);\n\n if (amount0 > 0 || amount1 > 0) {\n (position.tokensOwed0, position.tokensOwed1) = (\n position.tokensOwed0 + uint128(amount0),\n position.tokensOwed1 + uint128(amount1)\n );\n }\n\n emit Burn(msg.sender, tickLower, tickUpper, amount, amount0, amount1);\n }\n\n struct SwapCache {\n // the protocol fee for the input token\n uint8 feeProtocol;\n // liquidity at the beginning of the swap\n uint128 liquidityStart;\n // the timestamp of the current block\n uint32 blockTimestamp;\n // the current value of the tick accumulator, computed only if we cross an initialized tick\n int56 tickCumulative;\n // the current value of seconds per liquidity accumulator, computed only if we cross an initialized tick\n uint160 secondsPerLiquidityCumulativeX128;\n // whether we've computed and cached the above two accumulators\n bool computedLatestObservation;\n }\n\n // the top level state of the swap, the results of which are recorded in storage at the end\n struct SwapState {\n // the amount remaining to be swapped in/out of the input/output asset\n int256 amountSpecifiedRemaining;\n // the amount already swapped out/in of the output/input asset\n int256 amountCalculated;\n // current sqrt(price)\n uint160 sqrtPriceX96;\n // the tick associated with the current price\n int24 tick;\n // the global fee growth of the input token\n uint256 feeGrowthGlobalX128;\n // amount of input token paid as protocol fee\n uint128 protocolFee;\n // the current liquidity in range\n uint128 liquidity;\n }\n\n struct StepComputations {\n // the price at the beginning of the step\n uint160 sqrtPriceStartX96;\n // the next tick to swap to from the current tick in the swap direction\n int24 tickNext;\n // whether tickNext is initialized or not\n bool initialized;\n // sqrt(price) for the next tick (1/0)\n uint160 sqrtPriceNextX96;\n // how much is being swapped in in this step\n uint256 amountIn;\n // how much is being swapped out\n uint256 amountOut;\n // how much fee is being paid in\n uint256 feeAmount;\n }\n\n /// @inheritdoc IUniswapV3PoolActions\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external override noDelegateCall returns (int256 amount0, int256 amount1) {\n require(amountSpecified != 0, 'AS');\n\n Slot0 memory slot0Start = slot0;\n\n require(slot0Start.unlocked, 'LOK');\n require(\n zeroForOne\n ? sqrtPriceLimitX96 < slot0Start.sqrtPriceX96 && sqrtPriceLimitX96 > TickMath.MIN_SQRT_RATIO\n : sqrtPriceLimitX96 > slot0Start.sqrtPriceX96 && sqrtPriceLimitX96 < TickMath.MAX_SQRT_RATIO,\n 'SPL'\n );\n\n slot0.unlocked = false;\n\n SwapCache memory cache =\n SwapCache({\n liquidityStart: liquidity,\n blockTimestamp: _blockTimestamp(),\n feeProtocol: zeroForOne ? (slot0Start.feeProtocol % 16) : (slot0Start.feeProtocol >> 4),\n secondsPerLiquidityCumulativeX128: 0,\n tickCumulative: 0,\n computedLatestObservation: false\n });\n\n bool exactInput = amountSpecified > 0;\n\n SwapState memory state =\n SwapState({\n amountSpecifiedRemaining: amountSpecified,\n amountCalculated: 0,\n sqrtPriceX96: slot0Start.sqrtPriceX96,\n tick: slot0Start.tick,\n feeGrowthGlobalX128: zeroForOne ? feeGrowthGlobal0X128 : feeGrowthGlobal1X128,\n protocolFee: 0,\n liquidity: cache.liquidityStart\n });\n\n // continue swapping as long as we haven't used the entire input/output and haven't reached the price limit\n while (state.amountSpecifiedRemaining != 0 && state.sqrtPriceX96 != sqrtPriceLimitX96) {\n StepComputations memory step;\n\n step.sqrtPriceStartX96 = state.sqrtPriceX96;\n\n (step.tickNext, step.initialized) = tickBitmap.nextInitializedTickWithinOneWord(\n state.tick,\n tickSpacing,\n zeroForOne\n );\n\n // ensure that we do not overshoot the min/max tick, as the tick bitmap is not aware of these bounds\n if (step.tickNext < TickMath.MIN_TICK) {\n step.tickNext = TickMath.MIN_TICK;\n } else if (step.tickNext > TickMath.MAX_TICK) {\n step.tickNext = TickMath.MAX_TICK;\n }\n\n // get the price for the next tick\n step.sqrtPriceNextX96 = TickMath.getSqrtRatioAtTick(step.tickNext);\n\n // compute values to swap to the target tick, price limit, or point where input/output amount is exhausted\n (state.sqrtPriceX96, step.amountIn, step.amountOut, step.feeAmount) = SwapMath.computeSwapStep(\n state.sqrtPriceX96,\n (zeroForOne ? step.sqrtPriceNextX96 < sqrtPriceLimitX96 : step.sqrtPriceNextX96 > sqrtPriceLimitX96)\n ? sqrtPriceLimitX96\n : step.sqrtPriceNextX96,\n state.liquidity,\n state.amountSpecifiedRemaining,\n fee\n );\n\n if (exactInput) {\n state.amountSpecifiedRemaining -= (step.amountIn + step.feeAmount).toInt256();\n state.amountCalculated = state.amountCalculated.sub(step.amountOut.toInt256());\n } else {\n state.amountSpecifiedRemaining += step.amountOut.toInt256();\n state.amountCalculated = state.amountCalculated.add((step.amountIn + step.feeAmount).toInt256());\n }\n\n // if the protocol fee is on, calculate how much is owed, decrement feeAmount, and increment protocolFee\n if (cache.feeProtocol > 0) {\n uint256 delta = step.feeAmount / cache.feeProtocol;\n step.feeAmount -= delta;\n state.protocolFee += uint128(delta);\n }\n\n // update global fee tracker\n if (state.liquidity > 0)\n state.feeGrowthGlobalX128 += FullMath.mulDiv(step.feeAmount, FixedPoint128.Q128, state.liquidity);\n\n // shift tick if we reached the next price\n if (state.sqrtPriceX96 == step.sqrtPriceNextX96) {\n // if the tick is initialized, run the tick transition\n if (step.initialized) {\n // check for the placeholder value, which we replace with the actual value the first time the swap\n // crosses an initialized tick\n if (!cache.computedLatestObservation) {\n (cache.tickCumulative, cache.secondsPerLiquidityCumulativeX128) = observations.observeSingle(\n cache.blockTimestamp,\n 0,\n slot0Start.tick,\n slot0Start.observationIndex,\n cache.liquidityStart,\n slot0Start.observationCardinality\n );\n cache.computedLatestObservation = true;\n }\n int128 liquidityNet =\n ticks.cross(\n step.tickNext,\n (zeroForOne ? state.feeGrowthGlobalX128 : feeGrowthGlobal0X128),\n (zeroForOne ? feeGrowthGlobal1X128 : state.feeGrowthGlobalX128),\n cache.secondsPerLiquidityCumulativeX128,\n cache.tickCumulative,\n cache.blockTimestamp\n );\n // if we're moving leftward, we interpret liquidityNet as the opposite sign\n // safe because liquidityNet cannot be type(int128).min\n if (zeroForOne) liquidityNet = -liquidityNet;\n\n state.liquidity = LiquidityMath.addDelta(state.liquidity, liquidityNet);\n }\n\n state.tick = zeroForOne ? step.tickNext - 1 : step.tickNext;\n } else if (state.sqrtPriceX96 != step.sqrtPriceStartX96) {\n // recompute unless we're on a lower tick boundary (i.e. already transitioned ticks), and haven't moved\n state.tick = TickMath.getTickAtSqrtRatio(state.sqrtPriceX96);\n }\n }\n\n // update tick and write an oracle entry if the tick change\n if (state.tick != slot0Start.tick) {\n (uint16 observationIndex, uint16 observationCardinality) =\n observations.write(\n slot0Start.observationIndex,\n cache.blockTimestamp,\n slot0Start.tick,\n cache.liquidityStart,\n slot0Start.observationCardinality,\n slot0Start.observationCardinalityNext\n );\n (slot0.sqrtPriceX96, slot0.tick, slot0.observationIndex, slot0.observationCardinality) = (\n state.sqrtPriceX96,\n state.tick,\n observationIndex,\n observationCardinality\n );\n } else {\n // otherwise just update the price\n slot0.sqrtPriceX96 = state.sqrtPriceX96;\n }\n\n // update liquidity if it changed\n if (cache.liquidityStart != state.liquidity) liquidity = state.liquidity;\n\n // update fee growth global and, if necessary, protocol fees\n // overflow is acceptable, protocol has to withdraw before it hits type(uint128).max fees\n if (zeroForOne) {\n feeGrowthGlobal0X128 = state.feeGrowthGlobalX128;\n if (state.protocolFee > 0) protocolFees.token0 += state.protocolFee;\n } else {\n feeGrowthGlobal1X128 = state.feeGrowthGlobalX128;\n if (state.protocolFee > 0) protocolFees.token1 += state.protocolFee;\n }\n\n (amount0, amount1) = zeroForOne == exactInput\n ? (amountSpecified - state.amountSpecifiedRemaining, state.amountCalculated)\n : (state.amountCalculated, amountSpecified - state.amountSpecifiedRemaining);\n\n // do the transfers and collect payment\n if (zeroForOne) {\n if (amount1 < 0) TransferHelper.safeTransfer(token1, recipient, uint256(-amount1));\n\n uint256 balance0Before = balance0();\n IUniswapV3SwapCallback(msg.sender).uniswapV3SwapCallback(amount0, amount1, data);\n require(balance0Before.add(uint256(amount0)) <= balance0(), 'IIA');\n } else {\n if (amount0 < 0) TransferHelper.safeTransfer(token0, recipient, uint256(-amount0));\n\n uint256 balance1Before = balance1();\n IUniswapV3SwapCallback(msg.sender).uniswapV3SwapCallback(amount0, amount1, data);\n require(balance1Before.add(uint256(amount1)) <= balance1(), 'IIA');\n }\n\n emit Swap(msg.sender, recipient, amount0, amount1, state.sqrtPriceX96, state.liquidity, state.tick);\n slot0.unlocked = true;\n }\n\n /// @inheritdoc IUniswapV3PoolActions\n function flash(\n address recipient,\n uint256 amount0,\n uint256 amount1,\n bytes calldata data\n ) external override lock noDelegateCall {\n uint128 _liquidity = liquidity;\n require(_liquidity > 0, 'L');\n\n uint256 fee0 = FullMath.mulDivRoundingUp(amount0, fee, 1e6);\n uint256 fee1 = FullMath.mulDivRoundingUp(amount1, fee, 1e6);\n uint256 balance0Before = balance0();\n uint256 balance1Before = balance1();\n\n if (amount0 > 0) TransferHelper.safeTransfer(token0, recipient, amount0);\n if (amount1 > 0) TransferHelper.safeTransfer(token1, recipient, amount1);\n\n IUniswapV3FlashCallback(msg.sender).uniswapV3FlashCallback(fee0, fee1, data);\n\n uint256 balance0After = balance0();\n uint256 balance1After = balance1();\n\n require(balance0Before.add(fee0) <= balance0After, 'F0');\n require(balance1Before.add(fee1) <= balance1After, 'F1');\n\n // sub is safe because we know balanceAfter is gt balanceBefore by at least fee\n uint256 paid0 = balance0After - balance0Before;\n uint256 paid1 = balance1After - balance1Before;\n\n if (paid0 > 0) {\n uint8 feeProtocol0 = slot0.feeProtocol % 16;\n uint256 fees0 = feeProtocol0 == 0 ? 0 : paid0 / feeProtocol0;\n if (uint128(fees0) > 0) protocolFees.token0 += uint128(fees0);\n feeGrowthGlobal0X128 += FullMath.mulDiv(paid0 - fees0, FixedPoint128.Q128, _liquidity);\n }\n if (paid1 > 0) {\n uint8 feeProtocol1 = slot0.feeProtocol >> 4;\n uint256 fees1 = feeProtocol1 == 0 ? 0 : paid1 / feeProtocol1;\n if (uint128(fees1) > 0) protocolFees.token1 += uint128(fees1);\n feeGrowthGlobal1X128 += FullMath.mulDiv(paid1 - fees1, FixedPoint128.Q128, _liquidity);\n }\n\n emit Flash(msg.sender, recipient, amount0, amount1, paid0, paid1);\n }\n\n /// @inheritdoc IUniswapV3PoolOwnerActions\n function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external override lock onlyFactoryOwner {\n require(\n (feeProtocol0 == 0 || (feeProtocol0 >= 4 && feeProtocol0 <= 10)) &&\n (feeProtocol1 == 0 || (feeProtocol1 >= 4 && feeProtocol1 <= 10))\n );\n uint8 feeProtocolOld = slot0.feeProtocol;\n slot0.feeProtocol = feeProtocol0 + (feeProtocol1 << 4);\n emit SetFeeProtocol(feeProtocolOld % 16, feeProtocolOld >> 4, feeProtocol0, feeProtocol1);\n }\n\n /// @inheritdoc IUniswapV3PoolOwnerActions\n function collectProtocol(\n address recipient,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external override lock onlyFactoryOwner returns (uint128 amount0, uint128 amount1) {\n amount0 = amount0Requested > protocolFees.token0 ? protocolFees.token0 : amount0Requested;\n amount1 = amount1Requested > protocolFees.token1 ? protocolFees.token1 : amount1Requested;\n\n if (amount0 > 0) {\n if (amount0 == protocolFees.token0) amount0--; // ensure that the slot is not cleared, for gas savings\n protocolFees.token0 -= amount0;\n TransferHelper.safeTransfer(token0, recipient, amount0);\n }\n if (amount1 > 0) {\n if (amount1 == protocolFees.token1) amount1--; // ensure that the slot is not cleared, for gas savings\n protocolFees.token1 -= amount1;\n TransferHelper.safeTransfer(token1, recipient, amount1);\n }\n\n emit CollectProtocol(msg.sender, recipient, amount0, amount1);\n }\n}\n" }, "contracts/interfaces/IUniswapV3Pool.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\nimport './pool/IUniswapV3PoolImmutables.sol';\nimport './pool/IUniswapV3PoolState.sol';\nimport './pool/IUniswapV3PoolDerivedState.sol';\nimport './pool/IUniswapV3PoolActions.sol';\nimport './pool/IUniswapV3PoolOwnerActions.sol';\nimport './pool/IUniswapV3PoolEvents.sol';\n\n/// @title The interface for a Uniswap V3 Pool\n/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform\n/// to the ERC20 specification\n/// @dev The pool interface is broken up into many smaller pieces\ninterface IUniswapV3Pool is\n IUniswapV3PoolImmutables,\n IUniswapV3PoolState,\n IUniswapV3PoolDerivedState,\n IUniswapV3PoolActions,\n IUniswapV3PoolOwnerActions,\n IUniswapV3PoolEvents\n{\n\n}\n" }, "contracts/NoDelegateCall.sol": { "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity =0.7.6;\n\n/// @title Prevents delegatecall to a contract\n/// @notice Base contract that provides a modifier for preventing delegatecall to methods in a child contract\nabstract contract NoDelegateCall {\n /// @dev The original address of this contract\n address private immutable original;\n\n constructor() {\n // Immutables are computed in the init code of the contract, and then inlined into the deployed bytecode.\n // In other words, this variable won't change when it's checked at runtime.\n original = address(this);\n }\n\n /// @dev Private method is used instead of inlining into modifier because modifiers are copied into each method,\n /// and the use of immutable means the address bytes are copied in every place the modifier is used.\n function checkNotDelegateCall() private view {\n require(address(this) == original);\n }\n\n /// @notice Prevents delegatecall into the modified method\n modifier noDelegateCall() {\n checkNotDelegateCall();\n _;\n }\n}\n" }, "contracts/libraries/LowGasSafeMath.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.7.0;\n\n/// @title Optimized overflow and underflow safe math operations\n/// @notice Contains methods for doing math operations that revert on overflow or underflow for minimal gas cost\nlibrary LowGasSafeMath {\n /// @notice Returns x + y, reverts if sum overflows uint256\n /// @param x The augend\n /// @param y The addend\n /// @return z The sum of x and y\n function add(uint256 x, uint256 y) internal pure returns (uint256 z) {\n require((z = x + y) >= x);\n }\n\n /// @notice Returns x - y, reverts if underflows\n /// @param x The minuend\n /// @param y The subtrahend\n /// @return z The difference of x and y\n function sub(uint256 x, uint256 y) internal pure returns (uint256 z) {\n require((z = x - y) <= x);\n }\n\n /// @notice Returns x * y, reverts if overflows\n /// @param x The multiplicand\n /// @param y The multiplier\n /// @return z The product of x and y\n function mul(uint256 x, uint256 y) internal pure returns (uint256 z) {\n require(x == 0 || (z = x * y) / x == y);\n }\n\n /// @notice Returns x + y, reverts if overflows or underflows\n /// @param x The augend\n /// @param y The addend\n /// @return z The sum of x and y\n function add(int256 x, int256 y) internal pure returns (int256 z) {\n require((z = x + y) >= x == (y >= 0));\n }\n\n /// @notice Returns x - y, reverts if overflows or underflows\n /// @param x The minuend\n /// @param y The subtrahend\n /// @return z The difference of x and y\n function sub(int256 x, int256 y) internal pure returns (int256 z) {\n require((z = x - y) <= x == (y >= 0));\n }\n}\n" }, "contracts/libraries/SafeCast.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Safe casting methods\n/// @notice Contains methods for safely casting between types\nlibrary SafeCast {\n /// @notice Cast a uint256 to a uint160, revert on overflow\n /// @param y The uint256 to be downcasted\n /// @return z The downcasted integer, now type uint160\n function toUint160(uint256 y) internal pure returns (uint160 z) {\n require((z = uint160(y)) == y);\n }\n\n /// @notice Cast a int256 to a int128, revert on overflow or underflow\n /// @param y The int256 to be downcasted\n /// @return z The downcasted integer, now type int128\n function toInt128(int256 y) internal pure returns (int128 z) {\n require((z = int128(y)) == y);\n }\n\n /// @notice Cast a uint256 to a int256, revert on overflow\n /// @param y The uint256 to be casted\n /// @return z The casted integer, now type int256\n function toInt256(uint256 y) internal pure returns (int256 z) {\n require(y < 2**255);\n z = int256(y);\n }\n}\n" }, "contracts/libraries/Tick.sol": { "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity >=0.5.0;\n\nimport './LowGasSafeMath.sol';\nimport './SafeCast.sol';\n\nimport './TickMath.sol';\nimport './LiquidityMath.sol';\n\n/// @title Tick\n/// @notice Contains functions for managing tick processes and relevant calculations\nlibrary Tick {\n using LowGasSafeMath for int256;\n using SafeCast for int256;\n\n // info stored for each initialized individual tick\n struct Info {\n // the total position liquidity that references this tick\n uint128 liquidityGross;\n // amount of net liquidity added (subtracted) when tick is crossed from left to right (right to left),\n int128 liquidityNet;\n // fee growth per unit of liquidity on the _other_ side of this tick (relative to the current tick)\n // only has relative meaning, not absolute — the value depends on when the tick is initialized\n uint256 feeGrowthOutside0X128;\n uint256 feeGrowthOutside1X128;\n // the cumulative tick value on the other side of the tick\n int56 tickCumulativeOutside;\n // the seconds per unit of liquidity on the _other_ side of this tick (relative to the current tick)\n // only has relative meaning, not absolute — the value depends on when the tick is initialized\n uint160 secondsPerLiquidityOutsideX128;\n // the seconds spent on the other side of the tick (relative to the current tick)\n // only has relative meaning, not absolute — the value depends on when the tick is initialized\n uint32 secondsOutside;\n // true iff the tick is initialized, i.e. the value is exactly equivalent to the expression liquidityGross != 0\n // these 8 bits are set to prevent fresh sstores when crossing newly initialized ticks\n bool initialized;\n }\n\n /// @notice Derives max liquidity per tick from given tick spacing\n /// @dev Executed within the pool constructor\n /// @param tickSpacing The amount of required tick separation, realized in multiples of `tickSpacing`\n /// e.g., a tickSpacing of 3 requires ticks to be initialized every 3rd tick i.e., ..., -6, -3, 0, 3, 6, ...\n /// @return The max liquidity per tick\n function tickSpacingToMaxLiquidityPerTick(int24 tickSpacing) internal pure returns (uint128) {\n int24 minTick = (TickMath.MIN_TICK / tickSpacing) * tickSpacing;\n int24 maxTick = (TickMath.MAX_TICK / tickSpacing) * tickSpacing;\n uint24 numTicks = uint24((maxTick - minTick) / tickSpacing) + 1;\n return type(uint128).max / numTicks;\n }\n\n /// @notice Retrieves fee growth data\n /// @param self The mapping containing all tick information for initialized ticks\n /// @param tickLower The lower tick boundary of the position\n /// @param tickUpper The upper tick boundary of the position\n /// @param tickCurrent The current tick\n /// @param feeGrowthGlobal0X128 The all-time global fee growth, per unit of liquidity, in token0\n /// @param feeGrowthGlobal1X128 The all-time global fee growth, per unit of liquidity, in token1\n /// @return feeGrowthInside0X128 The all-time fee growth in token0, per unit of liquidity, inside the position's tick boundaries\n /// @return feeGrowthInside1X128 The all-time fee growth in token1, per unit of liquidity, inside the position's tick boundaries\n function getFeeGrowthInside(\n mapping(int24 => Tick.Info) storage self,\n int24 tickLower,\n int24 tickUpper,\n int24 tickCurrent,\n uint256 feeGrowthGlobal0X128,\n uint256 feeGrowthGlobal1X128\n ) internal view returns (uint256 feeGrowthInside0X128, uint256 feeGrowthInside1X128) {\n Info storage lower = self[tickLower];\n Info storage upper = self[tickUpper];\n\n // calculate fee growth below\n uint256 feeGrowthBelow0X128;\n uint256 feeGrowthBelow1X128;\n if (tickCurrent >= tickLower) {\n feeGrowthBelow0X128 = lower.feeGrowthOutside0X128;\n feeGrowthBelow1X128 = lower.feeGrowthOutside1X128;\n } else {\n feeGrowthBelow0X128 = feeGrowthGlobal0X128 - lower.feeGrowthOutside0X128;\n feeGrowthBelow1X128 = feeGrowthGlobal1X128 - lower.feeGrowthOutside1X128;\n }\n\n // calculate fee growth above\n uint256 feeGrowthAbove0X128;\n uint256 feeGrowthAbove1X128;\n if (tickCurrent < tickUpper) {\n feeGrowthAbove0X128 = upper.feeGrowthOutside0X128;\n feeGrowthAbove1X128 = upper.feeGrowthOutside1X128;\n } else {\n feeGrowthAbove0X128 = feeGrowthGlobal0X128 - upper.feeGrowthOutside0X128;\n feeGrowthAbove1X128 = feeGrowthGlobal1X128 - upper.feeGrowthOutside1X128;\n }\n\n feeGrowthInside0X128 = feeGrowthGlobal0X128 - feeGrowthBelow0X128 - feeGrowthAbove0X128;\n feeGrowthInside1X128 = feeGrowthGlobal1X128 - feeGrowthBelow1X128 - feeGrowthAbove1X128;\n }\n\n /// @notice Updates a tick and returns true if the tick was flipped from initialized to uninitialized, or vice versa\n /// @param self The mapping containing all tick information for initialized ticks\n /// @param tick The tick that will be updated\n /// @param tickCurrent The current tick\n /// @param liquidityDelta A new amount of liquidity to be added (subtracted) when tick is crossed from left to right (right to left)\n /// @param feeGrowthGlobal0X128 The all-time global fee growth, per unit of liquidity, in token0\n /// @param feeGrowthGlobal1X128 The all-time global fee growth, per unit of liquidity, in token1\n /// @param secondsPerLiquidityCumulativeX128 The all-time seconds per max(1, liquidity) of the pool\n /// @param time The current block timestamp cast to a uint32\n /// @param upper true for updating a position's upper tick, or false for updating a position's lower tick\n /// @param maxLiquidity The maximum liquidity allocation for a single tick\n /// @return flipped Whether the tick was flipped from initialized to uninitialized, or vice versa\n function update(\n mapping(int24 => Tick.Info) storage self,\n int24 tick,\n int24 tickCurrent,\n int128 liquidityDelta,\n uint256 feeGrowthGlobal0X128,\n uint256 feeGrowthGlobal1X128,\n uint160 secondsPerLiquidityCumulativeX128,\n int56 tickCumulative,\n uint32 time,\n bool upper,\n uint128 maxLiquidity\n ) internal returns (bool flipped) {\n Tick.Info storage info = self[tick];\n\n uint128 liquidityGrossBefore = info.liquidityGross;\n uint128 liquidityGrossAfter = LiquidityMath.addDelta(liquidityGrossBefore, liquidityDelta);\n\n require(liquidityGrossAfter <= maxLiquidity, 'LO');\n\n flipped = (liquidityGrossAfter == 0) != (liquidityGrossBefore == 0);\n\n if (liquidityGrossBefore == 0) {\n // by convention, we assume that all growth before a tick was initialized happened _below_ the tick\n if (tick <= tickCurrent) {\n info.feeGrowthOutside0X128 = feeGrowthGlobal0X128;\n info.feeGrowthOutside1X128 = feeGrowthGlobal1X128;\n info.secondsPerLiquidityOutsideX128 = secondsPerLiquidityCumulativeX128;\n info.tickCumulativeOutside = tickCumulative;\n info.secondsOutside = time;\n }\n info.initialized = true;\n }\n\n info.liquidityGross = liquidityGrossAfter;\n\n // when the lower (upper) tick is crossed left to right (right to left), liquidity must be added (removed)\n info.liquidityNet = upper\n ? int256(info.liquidityNet).sub(liquidityDelta).toInt128()\n : int256(info.liquidityNet).add(liquidityDelta).toInt128();\n }\n\n /// @notice Clears tick data\n /// @param self The mapping containing all initialized tick information for initialized ticks\n /// @param tick The tick that will be cleared\n function clear(mapping(int24 => Tick.Info) storage self, int24 tick) internal {\n delete self[tick];\n }\n\n /// @notice Transitions to next tick as needed by price movement\n /// @param self The mapping containing all tick information for initialized ticks\n /// @param tick The destination tick of the transition\n /// @param feeGrowthGlobal0X128 The all-time global fee growth, per unit of liquidity, in token0\n /// @param feeGrowthGlobal1X128 The all-time global fee growth, per unit of liquidity, in token1\n /// @param secondsPerLiquidityCumulativeX128 The current seconds per liquidity\n /// @param time The current block.timestamp\n /// @return liquidityNet The amount of liquidity added (subtracted) when tick is crossed from left to right (right to left)\n function cross(\n mapping(int24 => Tick.Info) storage self,\n int24 tick,\n uint256 feeGrowthGlobal0X128,\n uint256 feeGrowthGlobal1X128,\n uint160 secondsPerLiquidityCumulativeX128,\n int56 tickCumulative,\n uint32 time\n ) internal returns (int128 liquidityNet) {\n Tick.Info storage info = self[tick];\n info.feeGrowthOutside0X128 = feeGrowthGlobal0X128 - info.feeGrowthOutside0X128;\n info.feeGrowthOutside1X128 = feeGrowthGlobal1X128 - info.feeGrowthOutside1X128;\n info.secondsPerLiquidityOutsideX128 = secondsPerLiquidityCumulativeX128 - info.secondsPerLiquidityOutsideX128;\n info.tickCumulativeOutside = tickCumulative - info.tickCumulativeOutside;\n info.secondsOutside = time - info.secondsOutside;\n liquidityNet = info.liquidityNet;\n }\n}\n" }, "contracts/libraries/TickBitmap.sol": { "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity >=0.5.0;\n\nimport './BitMath.sol';\n\n/// @title Packed tick initialized state library\n/// @notice Stores a packed mapping of tick index to its initialized state\n/// @dev The mapping uses int16 for keys since ticks are represented as int24 and there are 256 (2^8) values per word.\nlibrary TickBitmap {\n /// @notice Computes the position in the mapping where the initialized bit for a tick lives\n /// @param tick The tick for which to compute the position\n /// @return wordPos The key in the mapping containing the word in which the bit is stored\n /// @return bitPos The bit position in the word where the flag is stored\n function position(int24 tick) private pure returns (int16 wordPos, uint8 bitPos) {\n wordPos = int16(tick >> 8);\n bitPos = uint8(tick % 256);\n }\n\n /// @notice Flips the initialized state for a given tick from false to true, or vice versa\n /// @param self The mapping in which to flip the tick\n /// @param tick The tick to flip\n /// @param tickSpacing The spacing between usable ticks\n function flipTick(\n mapping(int16 => uint256) storage self,\n int24 tick,\n int24 tickSpacing\n ) internal {\n require(tick % tickSpacing == 0); // ensure that the tick is spaced\n (int16 wordPos, uint8 bitPos) = position(tick / tickSpacing);\n uint256 mask = 1 << bitPos;\n self[wordPos] ^= mask;\n }\n\n /// @notice Returns the next initialized tick contained in the same word (or adjacent word) as the tick that is either\n /// to the left (less than or equal to) or right (greater than) of the given tick\n /// @param self The mapping in which to compute the next initialized tick\n /// @param tick The starting tick\n /// @param tickSpacing The spacing between usable ticks\n /// @param lte Whether to search for the next initialized tick to the left (less than or equal to the starting tick)\n /// @return next The next initialized or uninitialized tick up to 256 ticks away from the current tick\n /// @return initialized Whether the next tick is initialized, as the function only searches within up to 256 ticks\n function nextInitializedTickWithinOneWord(\n mapping(int16 => uint256) storage self,\n int24 tick,\n int24 tickSpacing,\n bool lte\n ) internal view returns (int24 next, bool initialized) {\n int24 compressed = tick / tickSpacing;\n if (tick < 0 && tick % tickSpacing != 0) compressed--; // round towards negative infinity\n\n if (lte) {\n (int16 wordPos, uint8 bitPos) = position(compressed);\n // all the 1s at or to the right of the current bitPos\n uint256 mask = (1 << bitPos) - 1 + (1 << bitPos);\n uint256 masked = self[wordPos] & mask;\n\n // if there are no initialized ticks to the right of or at the current tick, return rightmost in the word\n initialized = masked != 0;\n // overflow/underflow is possible, but prevented externally by limiting both tickSpacing and tick\n next = initialized\n ? (compressed - int24(bitPos - BitMath.mostSignificantBit(masked))) * tickSpacing\n : (compressed - int24(bitPos)) * tickSpacing;\n } else {\n // start from the word of the next tick, since the current tick state doesn't matter\n (int16 wordPos, uint8 bitPos) = position(compressed + 1);\n // all the 1s at or to the left of the bitPos\n uint256 mask = ~((1 << bitPos) - 1);\n uint256 masked = self[wordPos] & mask;\n\n // if there are no initialized ticks to the left of the current tick, return leftmost in the word\n initialized = masked != 0;\n // overflow/underflow is possible, but prevented externally by limiting both tickSpacing and tick\n next = initialized\n ? (compressed + 1 + int24(BitMath.leastSignificantBit(masked) - bitPos)) * tickSpacing\n : (compressed + 1 + int24(type(uint8).max - bitPos)) * tickSpacing;\n }\n }\n}\n" }, "contracts/libraries/Position.sol": { "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity >=0.5.0;\n\nimport './FullMath.sol';\nimport './FixedPoint128.sol';\nimport './LiquidityMath.sol';\n\n/// @title Position\n/// @notice Positions represent an owner address' liquidity between a lower and upper tick boundary\n/// @dev Positions store additional state for tracking fees owed to the position\nlibrary Position {\n // info stored for each user's position\n struct Info {\n // the amount of liquidity owned by this position\n uint128 liquidity;\n // fee growth per unit of liquidity as of the last update to liquidity or fees owed\n uint256 feeGrowthInside0LastX128;\n uint256 feeGrowthInside1LastX128;\n // the fees owed to the position owner in token0/token1\n uint128 tokensOwed0;\n uint128 tokensOwed1;\n }\n\n /// @notice Returns the Info struct of a position, given an owner and position boundaries\n /// @param self The mapping containing all user positions\n /// @param owner The address of the position owner\n /// @param tickLower The lower tick boundary of the position\n /// @param tickUpper The upper tick boundary of the position\n /// @return position The position info struct of the given owners' position\n function get(\n mapping(bytes32 => Info) storage self,\n address owner,\n int24 tickLower,\n int24 tickUpper\n ) internal view returns (Position.Info storage position) {\n position = self[keccak256(abi.encodePacked(owner, tickLower, tickUpper))];\n }\n\n /// @notice Credits accumulated fees to a user's position\n /// @param self The individual position to update\n /// @param liquidityDelta The change in pool liquidity as a result of the position update\n /// @param feeGrowthInside0X128 The all-time fee growth in token0, per unit of liquidity, inside the position's tick boundaries\n /// @param feeGrowthInside1X128 The all-time fee growth in token1, per unit of liquidity, inside the position's tick boundaries\n function update(\n Info storage self,\n int128 liquidityDelta,\n uint256 feeGrowthInside0X128,\n uint256 feeGrowthInside1X128\n ) internal {\n Info memory _self = self;\n\n uint128 liquidityNext;\n if (liquidityDelta == 0) {\n require(_self.liquidity > 0, 'NP'); // disallow pokes for 0 liquidity positions\n liquidityNext = _self.liquidity;\n } else {\n liquidityNext = LiquidityMath.addDelta(_self.liquidity, liquidityDelta);\n }\n\n // calculate accumulated fees\n uint128 tokensOwed0 =\n uint128(\n FullMath.mulDiv(\n feeGrowthInside0X128 - _self.feeGrowthInside0LastX128,\n _self.liquidity,\n FixedPoint128.Q128\n )\n );\n uint128 tokensOwed1 =\n uint128(\n FullMath.mulDiv(\n feeGrowthInside1X128 - _self.feeGrowthInside1LastX128,\n _self.liquidity,\n FixedPoint128.Q128\n )\n );\n\n // update the position\n if (liquidityDelta != 0) self.liquidity = liquidityNext;\n self.feeGrowthInside0LastX128 = feeGrowthInside0X128;\n self.feeGrowthInside1LastX128 = feeGrowthInside1X128;\n if (tokensOwed0 > 0 || tokensOwed1 > 0) {\n // overflow is acceptable, have to withdraw before you hit type(uint128).max fees\n self.tokensOwed0 += tokensOwed0;\n self.tokensOwed1 += tokensOwed1;\n }\n }\n}\n" }, "contracts/libraries/Oracle.sol": { "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity >=0.5.0;\n\n/// @title Oracle\n/// @notice Provides price and liquidity data useful for a wide variety of system designs\n/// @dev Instances of stored oracle data, \"observations\", are collected in the oracle array\n/// Every pool is initialized with an oracle array length of 1. Anyone can pay the SSTOREs to increase the\n/// maximum length of the oracle array. New slots will be added when the array is fully populated.\n/// Observations are overwritten when the full length of the oracle array is populated.\n/// The most recent observation is available, independent of the length of the oracle array, by passing 0 to observe()\nlibrary Oracle {\n struct Observation {\n // the block timestamp of the observation\n uint32 blockTimestamp;\n // the tick accumulator, i.e. tick * time elapsed since the pool was first initialized\n int56 tickCumulative;\n // the seconds per liquidity, i.e. seconds elapsed / max(1, liquidity) since the pool was first initialized\n uint160 secondsPerLiquidityCumulativeX128;\n // whether or not the observation is initialized\n bool initialized;\n }\n\n /// @notice Transforms a previous observation into a new observation, given the passage of time and the current tick and liquidity values\n /// @dev blockTimestamp _must_ be chronologically equal to or greater than last.blockTimestamp, safe for 0 or 1 overflows\n /// @param last The specified observation to be transformed\n /// @param blockTimestamp The timestamp of the new observation\n /// @param tick The active tick at the time of the new observation\n /// @param liquidity The total in-range liquidity at the time of the new observation\n /// @return Observation The newly populated observation\n function transform(\n Observation memory last,\n uint32 blockTimestamp,\n int24 tick,\n uint128 liquidity\n ) private pure returns (Observation memory) {\n uint32 delta = blockTimestamp - last.blockTimestamp;\n return\n Observation({\n blockTimestamp: blockTimestamp,\n tickCumulative: last.tickCumulative + int56(tick) * delta,\n secondsPerLiquidityCumulativeX128: last.secondsPerLiquidityCumulativeX128 +\n ((uint160(delta) << 128) / (liquidity > 0 ? liquidity : 1)),\n initialized: true\n });\n }\n\n /// @notice Initialize the oracle array by writing the first slot. Called once for the lifecycle of the observations array\n /// @param self The stored oracle array\n /// @param time The time of the oracle initialization, via block.timestamp truncated to uint32\n /// @return cardinality The number of populated elements in the oracle array\n /// @return cardinalityNext The new length of the oracle array, independent of population\n function initialize(Observation[65535] storage self, uint32 time)\n internal\n returns (uint16 cardinality, uint16 cardinalityNext)\n {\n self[0] = Observation({\n blockTimestamp: time,\n tickCumulative: 0,\n secondsPerLiquidityCumulativeX128: 0,\n initialized: true\n });\n return (1, 1);\n }\n\n /// @notice Writes an oracle observation to the array\n /// @dev Writable at most once per block. Index represents the most recently written element. cardinality and index must be tracked externally.\n /// If the index is at the end of the allowable array length (according to cardinality), and the next cardinality\n /// is greater than the current one, cardinality may be increased. This restriction is created to preserve ordering.\n /// @param self The stored oracle array\n /// @param index The index of the observation that was most recently written to the observations array\n /// @param blockTimestamp The timestamp of the new observation\n /// @param tick The active tick at the time of the new observation\n /// @param liquidity The total in-range liquidity at the time of the new observation\n /// @param cardinality The number of populated elements in the oracle array\n /// @param cardinalityNext The new length of the oracle array, independent of population\n /// @return indexUpdated The new index of the most recently written element in the oracle array\n /// @return cardinalityUpdated The new cardinality of the oracle array\n function write(\n Observation[65535] storage self,\n uint16 index,\n uint32 blockTimestamp,\n int24 tick,\n uint128 liquidity,\n uint16 cardinality,\n uint16 cardinalityNext\n ) internal returns (uint16 indexUpdated, uint16 cardinalityUpdated) {\n Observation memory last = self[index];\n\n // early return if we've already written an observation this block\n if (last.blockTimestamp == blockTimestamp) return (index, cardinality);\n\n // if the conditions are right, we can bump the cardinality\n if (cardinalityNext > cardinality && index == (cardinality - 1)) {\n cardinalityUpdated = cardinalityNext;\n } else {\n cardinalityUpdated = cardinality;\n }\n\n indexUpdated = (index + 1) % cardinalityUpdated;\n self[indexUpdated] = transform(last, blockTimestamp, tick, liquidity);\n }\n\n /// @notice Prepares the oracle array to store up to `next` observations\n /// @param self The stored oracle array\n /// @param current The current next cardinality of the oracle array\n /// @param next The proposed next cardinality which will be populated in the oracle array\n /// @return next The next cardinality which will be populated in the oracle array\n function grow(\n Observation[65535] storage self,\n uint16 current,\n uint16 next\n ) internal returns (uint16) {\n require(current > 0, 'I');\n // no-op if the passed next value isn't greater than the current next value\n if (next <= current) return current;\n // store in each slot to prevent fresh SSTOREs in swaps\n // this data will not be used because the initialized boolean is still false\n for (uint16 i = current; i < next; i++) self[i].blockTimestamp = 1;\n return next;\n }\n\n /// @notice comparator for 32-bit timestamps\n /// @dev safe for 0 or 1 overflows, a and b _must_ be chronologically before or equal to time\n /// @param time A timestamp truncated to 32 bits\n /// @param a A comparison timestamp from which to determine the relative position of `time`\n /// @param b From which to determine the relative position of `time`\n /// @return bool Whether `a` is chronologically <= `b`\n function lte(\n uint32 time,\n uint32 a,\n uint32 b\n ) private pure returns (bool) {\n // if there hasn't been overflow, no need to adjust\n if (a <= time && b <= time) return a <= b;\n\n uint256 aAdjusted = a > time ? a : a + 2**32;\n uint256 bAdjusted = b > time ? b : b + 2**32;\n\n return aAdjusted <= bAdjusted;\n }\n\n /// @notice Fetches the observations beforeOrAt and atOrAfter a target, i.e. where [beforeOrAt, atOrAfter] is satisfied.\n /// The result may be the same observation, or adjacent observations.\n /// @dev The answer must be contained in the array, used when the target is located within the stored observation\n /// boundaries: older than the most recent observation and younger, or the same age as, the oldest observation\n /// @param self The stored oracle array\n /// @param time The current block.timestamp\n /// @param target The timestamp at which the reserved observation should be for\n /// @param index The index of the observation that was most recently written to the observations array\n /// @param cardinality The number of populated elements in the oracle array\n /// @return beforeOrAt The observation recorded before, or at, the target\n /// @return atOrAfter The observation recorded at, or after, the target\n function binarySearch(\n Observation[65535] storage self,\n uint32 time,\n uint32 target,\n uint16 index,\n uint16 cardinality\n ) private view returns (Observation memory beforeOrAt, Observation memory atOrAfter) {\n uint256 l = (index + 1) % cardinality; // oldest observation\n uint256 r = l + cardinality - 1; // newest observation\n uint256 i;\n while (true) {\n i = (l + r) / 2;\n\n beforeOrAt = self[i % cardinality];\n\n // we've landed on an uninitialized tick, keep searching higher (more recently)\n if (!beforeOrAt.initialized) {\n l = i + 1;\n continue;\n }\n\n atOrAfter = self[(i + 1) % cardinality];\n\n bool targetAtOrAfter = lte(time, beforeOrAt.blockTimestamp, target);\n\n // check if we've found the answer!\n if (targetAtOrAfter && lte(time, target, atOrAfter.blockTimestamp)) break;\n\n if (!targetAtOrAfter) r = i - 1;\n else l = i + 1;\n }\n }\n\n /// @notice Fetches the observations beforeOrAt and atOrAfter a given target, i.e. where [beforeOrAt, atOrAfter] is satisfied\n /// @dev Assumes there is at least 1 initialized observation.\n /// Used by observeSingle() to compute the counterfactual accumulator values as of a given block timestamp.\n /// @param self The stored oracle array\n /// @param time The current block.timestamp\n /// @param target The timestamp at which the reserved observation should be for\n /// @param tick The active tick at the time of the returned or simulated observation\n /// @param index The index of the observation that was most recently written to the observations array\n /// @param liquidity The total pool liquidity at the time of the call\n /// @param cardinality The number of populated elements in the oracle array\n /// @return beforeOrAt The observation which occurred at, or before, the given timestamp\n /// @return atOrAfter The observation which occurred at, or after, the given timestamp\n function getSurroundingObservations(\n Observation[65535] storage self,\n uint32 time,\n uint32 target,\n int24 tick,\n uint16 index,\n uint128 liquidity,\n uint16 cardinality\n ) private view returns (Observation memory beforeOrAt, Observation memory atOrAfter) {\n // optimistically set before to the newest observation\n beforeOrAt = self[index];\n\n // if the target is chronologically at or after the newest observation, we can early return\n if (lte(time, beforeOrAt.blockTimestamp, target)) {\n if (beforeOrAt.blockTimestamp == target) {\n // if newest observation equals target, we're in the same block, so we can ignore atOrAfter\n return (beforeOrAt, atOrAfter);\n } else {\n // otherwise, we need to transform\n return (beforeOrAt, transform(beforeOrAt, target, tick, liquidity));\n }\n }\n\n // now, set before to the oldest observation\n beforeOrAt = self[(index + 1) % cardinality];\n if (!beforeOrAt.initialized) beforeOrAt = self[0];\n\n // ensure that the target is chronologically at or after the oldest observation\n require(lte(time, beforeOrAt.blockTimestamp, target), 'OLD');\n\n // if we've reached this point, we have to binary search\n return binarySearch(self, time, target, index, cardinality);\n }\n\n /// @dev Reverts if an observation at or before the desired observation timestamp does not exist.\n /// 0 may be passed as `secondsAgo' to return the current cumulative values.\n /// If called with a timestamp falling between two observations, returns the counterfactual accumulator values\n /// at exactly the timestamp between the two observations.\n /// @param self The stored oracle array\n /// @param time The current block timestamp\n /// @param secondsAgo The amount of time to look back, in seconds, at which point to return an observation\n /// @param tick The current tick\n /// @param index The index of the observation that was most recently written to the observations array\n /// @param liquidity The current in-range pool liquidity\n /// @param cardinality The number of populated elements in the oracle array\n /// @return tickCumulative The tick * time elapsed since the pool was first initialized, as of `secondsAgo`\n /// @return secondsPerLiquidityCumulativeX128 The time elapsed / max(1, liquidity) since the pool was first initialized, as of `secondsAgo`\n function observeSingle(\n Observation[65535] storage self,\n uint32 time,\n uint32 secondsAgo,\n int24 tick,\n uint16 index,\n uint128 liquidity,\n uint16 cardinality\n ) internal view returns (int56 tickCumulative, uint160 secondsPerLiquidityCumulativeX128) {\n if (secondsAgo == 0) {\n Observation memory last = self[index];\n if (last.blockTimestamp != time) last = transform(last, time, tick, liquidity);\n return (last.tickCumulative, last.secondsPerLiquidityCumulativeX128);\n }\n\n uint32 target = time - secondsAgo;\n\n (Observation memory beforeOrAt, Observation memory atOrAfter) =\n getSurroundingObservations(self, time, target, tick, index, liquidity, cardinality);\n\n if (target == beforeOrAt.blockTimestamp) {\n // we're at the left boundary\n return (beforeOrAt.tickCumulative, beforeOrAt.secondsPerLiquidityCumulativeX128);\n } else if (target == atOrAfter.blockTimestamp) {\n // we're at the right boundary\n return (atOrAfter.tickCumulative, atOrAfter.secondsPerLiquidityCumulativeX128);\n } else {\n // we're in the middle\n uint32 observationTimeDelta = atOrAfter.blockTimestamp - beforeOrAt.blockTimestamp;\n uint32 targetDelta = target - beforeOrAt.blockTimestamp;\n return (\n beforeOrAt.tickCumulative +\n ((atOrAfter.tickCumulative - beforeOrAt.tickCumulative) / observationTimeDelta) *\n targetDelta,\n beforeOrAt.secondsPerLiquidityCumulativeX128 +\n uint160(\n (uint256(\n atOrAfter.secondsPerLiquidityCumulativeX128 - beforeOrAt.secondsPerLiquidityCumulativeX128\n ) * targetDelta) / observationTimeDelta\n )\n );\n }\n }\n\n /// @notice Returns the accumulator values as of each time seconds ago from the given time in the array of `secondsAgos`\n /// @dev Reverts if `secondsAgos` > oldest observation\n /// @param self The stored oracle array\n /// @param time The current block.timestamp\n /// @param secondsAgos Each amount of time to look back, in seconds, at which point to return an observation\n /// @param tick The current tick\n /// @param index The index of the observation that was most recently written to the observations array\n /// @param liquidity The current in-range pool liquidity\n /// @param cardinality The number of populated elements in the oracle array\n /// @return tickCumulatives The tick * time elapsed since the pool was first initialized, as of each `secondsAgo`\n /// @return secondsPerLiquidityCumulativeX128s The cumulative seconds / max(1, liquidity) since the pool was first initialized, as of each `secondsAgo`\n function observe(\n Observation[65535] storage self,\n uint32 time,\n uint32[] memory secondsAgos,\n int24 tick,\n uint16 index,\n uint128 liquidity,\n uint16 cardinality\n ) internal view returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s) {\n require(cardinality > 0, 'I');\n\n tickCumulatives = new int56[](secondsAgos.length);\n secondsPerLiquidityCumulativeX128s = new uint160[](secondsAgos.length);\n for (uint256 i = 0; i < secondsAgos.length; i++) {\n (tickCumulatives[i], secondsPerLiquidityCumulativeX128s[i]) = observeSingle(\n self,\n time,\n secondsAgos[i],\n tick,\n index,\n liquidity,\n cardinality\n );\n }\n }\n}\n" }, "contracts/libraries/FullMath.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.4.0;\n\n/// @title Contains 512-bit math functions\n/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision\n/// @dev Handles \"phantom overflow\" i.e., allows multiplication and division where an intermediate value overflows 256 bits\nlibrary FullMath {\n /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv\n function mulDiv(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n // 512-bit multiply [prod1 prod0] = a * b\n // Compute the product mod 2**256 and mod 2**256 - 1\n // then use the Chinese Remainder Theorem to reconstruct\n // the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2**256 + prod0\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(a, b, not(0))\n prod0 := mul(a, b)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division\n if (prod1 == 0) {\n require(denominator > 0);\n assembly {\n result := div(prod0, denominator)\n }\n return result;\n }\n\n // Make sure the result is less than 2**256.\n // Also prevents denominator == 0\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0]\n // Compute remainder using mulmod\n uint256 remainder;\n assembly {\n remainder := mulmod(a, b, denominator)\n }\n // Subtract 256 bit number from 512 bit number\n assembly {\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator\n // Compute largest power of two divisor of denominator.\n // Always >= 1.\n uint256 twos = -denominator & denominator;\n // Divide denominator by power of two\n assembly {\n denominator := div(denominator, twos)\n }\n\n // Divide [prod1 prod0] by the factors of two\n assembly {\n prod0 := div(prod0, twos)\n }\n // Shift in bits from prod1 into prod0. For this we need\n // to flip `twos` such that it is 2**256 / twos.\n // If twos is zero, then it becomes one\n assembly {\n twos := add(div(sub(0, twos), twos), 1)\n }\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2**256\n // Now that denominator is an odd number, it has an inverse\n // modulo 2**256 such that denominator * inv = 1 mod 2**256.\n // Compute the inverse by starting with a seed that is correct\n // correct for four bits. That is, denominator * inv = 1 mod 2**4\n uint256 inv = (3 * denominator) ^ 2;\n // Now use Newton-Raphson iteration to improve the precision.\n // Thanks to Hensel's lifting lemma, this also works in modular\n // arithmetic, doubling the correct bits in each step.\n inv *= 2 - denominator * inv; // inverse mod 2**8\n inv *= 2 - denominator * inv; // inverse mod 2**16\n inv *= 2 - denominator * inv; // inverse mod 2**32\n inv *= 2 - denominator * inv; // inverse mod 2**64\n inv *= 2 - denominator * inv; // inverse mod 2**128\n inv *= 2 - denominator * inv; // inverse mod 2**256\n\n // Because the division is now exact we can divide by multiplying\n // with the modular inverse of denominator. This will give us the\n // correct result modulo 2**256. Since the precoditions guarantee\n // that the outcome is less than 2**256, this is the final result.\n // We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inv;\n return result;\n }\n\n /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n /// @param a The multiplicand\n /// @param b The multiplier\n /// @param denominator The divisor\n /// @return result The 256-bit result\n function mulDivRoundingUp(\n uint256 a,\n uint256 b,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n result = mulDiv(a, b, denominator);\n if (mulmod(a, b, denominator) > 0) {\n require(result < type(uint256).max);\n result++;\n }\n }\n}\n" }, "contracts/libraries/FixedPoint128.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.4.0;\n\n/// @title FixedPoint128\n/// @notice A library for handling binary fixed point numbers, see https://en.wikipedia.org/wiki/Q_(number_format)\nlibrary FixedPoint128 {\n uint256 internal constant Q128 = 0x100000000000000000000000000000000;\n}\n" }, "contracts/libraries/TransferHelper.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.6.0;\n\nimport '../interfaces/IERC20Minimal.sol';\n\n/// @title TransferHelper\n/// @notice Contains helper methods for interacting with ERC20 tokens that do not consistently return true/false\nlibrary TransferHelper {\n /// @notice Transfers tokens from msg.sender to a recipient\n /// @dev Calls transfer on token contract, errors with TF if transfer fails\n /// @param token The contract address of the token which will be transferred\n /// @param to The recipient of the transfer\n /// @param value The value of the transfer\n function safeTransfer(\n address token,\n address to,\n uint256 value\n ) internal {\n (bool success, bytes memory data) =\n token.call(abi.encodeWithSelector(IERC20Minimal.transfer.selector, to, value));\n require(success && (data.length == 0 || abi.decode(data, (bool))), 'TF');\n }\n}\n" }, "contracts/libraries/TickMath.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Math library for computing sqrt prices from ticks and vice versa\n/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports\n/// prices between 2**-128 and 2**128\nlibrary TickMath {\n /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128\n int24 internal constant MIN_TICK = -887272;\n /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128\n int24 internal constant MAX_TICK = -MIN_TICK;\n\n /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)\n uint160 internal constant MIN_SQRT_RATIO = 4295128739;\n /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)\n uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;\n\n /// @notice Calculates sqrt(1.0001^tick) * 2^96\n /// @dev Throws if |tick| > max tick\n /// @param tick The input tick for the above formula\n /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)\n /// at the given tick\n function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {\n uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));\n require(absTick <= uint256(MAX_TICK), 'T');\n\n uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;\n if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;\n if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;\n if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;\n if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;\n if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;\n if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;\n if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;\n if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;\n if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;\n if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;\n if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;\n if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;\n if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;\n if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;\n if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;\n if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;\n if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;\n if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;\n if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;\n\n if (tick > 0) ratio = type(uint256).max / ratio;\n\n // this divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.\n // we then downcast because we know the result always fits within 160 bits due to our tick input constraint\n // we round up in the division so getTickAtSqrtRatio of the output price is always consistent\n sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));\n }\n\n /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio\n /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may\n /// ever return.\n /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96\n /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio\n function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {\n // second inequality must be < because the price can never reach the price at the max tick\n require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R');\n uint256 ratio = uint256(sqrtPriceX96) << 32;\n\n uint256 r = ratio;\n uint256 msb = 0;\n\n assembly {\n let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(5, gt(r, 0xFFFFFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(4, gt(r, 0xFFFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(3, gt(r, 0xFF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(2, gt(r, 0xF))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := shl(1, gt(r, 0x3))\n msb := or(msb, f)\n r := shr(f, r)\n }\n assembly {\n let f := gt(r, 0x1)\n msb := or(msb, f)\n }\n\n if (msb >= 128) r = ratio >> (msb - 127);\n else r = ratio << (127 - msb);\n\n int256 log_2 = (int256(msb) - 128) << 64;\n\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(63, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(62, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(61, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(60, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(59, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(58, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(57, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(56, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(55, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(54, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(53, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(52, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(51, f))\n r := shr(f, r)\n }\n assembly {\n r := shr(127, mul(r, r))\n let f := shr(128, r)\n log_2 := or(log_2, shl(50, f))\n }\n\n int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number\n\n int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);\n int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);\n\n tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;\n }\n}\n" }, "contracts/libraries/LiquidityMath.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Math library for liquidity\nlibrary LiquidityMath {\n /// @notice Add a signed liquidity delta to liquidity and revert if it overflows or underflows\n /// @param x The liquidity before change\n /// @param y The delta by which liquidity should be changed\n /// @return z The liquidity delta\n function addDelta(uint128 x, int128 y) internal pure returns (uint128 z) {\n if (y < 0) {\n require((z = x - uint128(-y)) < x, 'LS');\n } else {\n require((z = x + uint128(y)) >= x, 'LA');\n }\n }\n}\n" }, "contracts/libraries/SqrtPriceMath.sol": { "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity >=0.5.0;\n\nimport './LowGasSafeMath.sol';\nimport './SafeCast.sol';\n\nimport './FullMath.sol';\nimport './UnsafeMath.sol';\nimport './FixedPoint96.sol';\n\n/// @title Functions based on Q64.96 sqrt price and liquidity\n/// @notice Contains the math that uses square root of price as a Q64.96 and liquidity to compute deltas\nlibrary SqrtPriceMath {\n using LowGasSafeMath for uint256;\n using SafeCast for uint256;\n\n /// @notice Gets the next sqrt price given a delta of token0\n /// @dev Always rounds up, because in the exact output case (increasing price) we need to move the price at least\n /// far enough to get the desired output amount, and in the exact input case (decreasing price) we need to move the\n /// price less in order to not send too much output.\n /// The most precise formula for this is liquidity * sqrtPX96 / (liquidity +- amount * sqrtPX96),\n /// if this is impossible because of overflow, we calculate liquidity / (liquidity / sqrtPX96 +- amount).\n /// @param sqrtPX96 The starting price, i.e. before accounting for the token0 delta\n /// @param liquidity The amount of usable liquidity\n /// @param amount How much of token0 to add or remove from virtual reserves\n /// @param add Whether to add or remove the amount of token0\n /// @return The price after adding or removing amount, depending on add\n function getNextSqrtPriceFromAmount0RoundingUp(\n uint160 sqrtPX96,\n uint128 liquidity,\n uint256 amount,\n bool add\n ) internal pure returns (uint160) {\n // we short circuit amount == 0 because the result is otherwise not guaranteed to equal the input price\n if (amount == 0) return sqrtPX96;\n uint256 numerator1 = uint256(liquidity) << FixedPoint96.RESOLUTION;\n\n if (add) {\n uint256 product;\n if ((product = amount * sqrtPX96) / amount == sqrtPX96) {\n uint256 denominator = numerator1 + product;\n if (denominator >= numerator1)\n // always fits in 160 bits\n return uint160(FullMath.mulDivRoundingUp(numerator1, sqrtPX96, denominator));\n }\n\n return uint160(UnsafeMath.divRoundingUp(numerator1, (numerator1 / sqrtPX96).add(amount)));\n } else {\n uint256 product;\n // if the product overflows, we know the denominator underflows\n // in addition, we must check that the denominator does not underflow\n require((product = amount * sqrtPX96) / amount == sqrtPX96 && numerator1 > product);\n uint256 denominator = numerator1 - product;\n return FullMath.mulDivRoundingUp(numerator1, sqrtPX96, denominator).toUint160();\n }\n }\n\n /// @notice Gets the next sqrt price given a delta of token1\n /// @dev Always rounds down, because in the exact output case (decreasing price) we need to move the price at least\n /// far enough to get the desired output amount, and in the exact input case (increasing price) we need to move the\n /// price less in order to not send too much output.\n /// The formula we compute is within <1 wei of the lossless version: sqrtPX96 +- amount / liquidity\n /// @param sqrtPX96 The starting price, i.e., before accounting for the token1 delta\n /// @param liquidity The amount of usable liquidity\n /// @param amount How much of token1 to add, or remove, from virtual reserves\n /// @param add Whether to add, or remove, the amount of token1\n /// @return The price after adding or removing `amount`\n function getNextSqrtPriceFromAmount1RoundingDown(\n uint160 sqrtPX96,\n uint128 liquidity,\n uint256 amount,\n bool add\n ) internal pure returns (uint160) {\n // if we're adding (subtracting), rounding down requires rounding the quotient down (up)\n // in both cases, avoid a mulDiv for most inputs\n if (add) {\n uint256 quotient =\n (\n amount <= type(uint160).max\n ? (amount << FixedPoint96.RESOLUTION) / liquidity\n : FullMath.mulDiv(amount, FixedPoint96.Q96, liquidity)\n );\n\n return uint256(sqrtPX96).add(quotient).toUint160();\n } else {\n uint256 quotient =\n (\n amount <= type(uint160).max\n ? UnsafeMath.divRoundingUp(amount << FixedPoint96.RESOLUTION, liquidity)\n : FullMath.mulDivRoundingUp(amount, FixedPoint96.Q96, liquidity)\n );\n\n require(sqrtPX96 > quotient);\n // always fits 160 bits\n return uint160(sqrtPX96 - quotient);\n }\n }\n\n /// @notice Gets the next sqrt price given an input amount of token0 or token1\n /// @dev Throws if price or liquidity are 0, or if the next price is out of bounds\n /// @param sqrtPX96 The starting price, i.e., before accounting for the input amount\n /// @param liquidity The amount of usable liquidity\n /// @param amountIn How much of token0, or token1, is being swapped in\n /// @param zeroForOne Whether the amount in is token0 or token1\n /// @return sqrtQX96 The price after adding the input amount to token0 or token1\n function getNextSqrtPriceFromInput(\n uint160 sqrtPX96,\n uint128 liquidity,\n uint256 amountIn,\n bool zeroForOne\n ) internal pure returns (uint160 sqrtQX96) {\n require(sqrtPX96 > 0);\n require(liquidity > 0);\n\n // round to make sure that we don't pass the target price\n return\n zeroForOne\n ? getNextSqrtPriceFromAmount0RoundingUp(sqrtPX96, liquidity, amountIn, true)\n : getNextSqrtPriceFromAmount1RoundingDown(sqrtPX96, liquidity, amountIn, true);\n }\n\n /// @notice Gets the next sqrt price given an output amount of token0 or token1\n /// @dev Throws if price or liquidity are 0 or the next price is out of bounds\n /// @param sqrtPX96 The starting price before accounting for the output amount\n /// @param liquidity The amount of usable liquidity\n /// @param amountOut How much of token0, or token1, is being swapped out\n /// @param zeroForOne Whether the amount out is token0 or token1\n /// @return sqrtQX96 The price after removing the output amount of token0 or token1\n function getNextSqrtPriceFromOutput(\n uint160 sqrtPX96,\n uint128 liquidity,\n uint256 amountOut,\n bool zeroForOne\n ) internal pure returns (uint160 sqrtQX96) {\n require(sqrtPX96 > 0);\n require(liquidity > 0);\n\n // round to make sure that we pass the target price\n return\n zeroForOne\n ? getNextSqrtPriceFromAmount1RoundingDown(sqrtPX96, liquidity, amountOut, false)\n : getNextSqrtPriceFromAmount0RoundingUp(sqrtPX96, liquidity, amountOut, false);\n }\n\n /// @notice Gets the amount0 delta between two prices\n /// @dev Calculates liquidity / sqrt(lower) - liquidity / sqrt(upper),\n /// i.e. liquidity * (sqrt(upper) - sqrt(lower)) / (sqrt(upper) * sqrt(lower))\n /// @param sqrtRatioAX96 A sqrt price\n /// @param sqrtRatioBX96 Another sqrt price\n /// @param liquidity The amount of usable liquidity\n /// @param roundUp Whether to round the amount up or down\n /// @return amount0 Amount of token0 required to cover a position of size liquidity between the two passed prices\n function getAmount0Delta(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity,\n bool roundUp\n ) internal pure returns (uint256 amount0) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n uint256 numerator1 = uint256(liquidity) << FixedPoint96.RESOLUTION;\n uint256 numerator2 = sqrtRatioBX96 - sqrtRatioAX96;\n\n require(sqrtRatioAX96 > 0);\n\n return\n roundUp\n ? UnsafeMath.divRoundingUp(\n FullMath.mulDivRoundingUp(numerator1, numerator2, sqrtRatioBX96),\n sqrtRatioAX96\n )\n : FullMath.mulDiv(numerator1, numerator2, sqrtRatioBX96) / sqrtRatioAX96;\n }\n\n /// @notice Gets the amount1 delta between two prices\n /// @dev Calculates liquidity * (sqrt(upper) - sqrt(lower))\n /// @param sqrtRatioAX96 A sqrt price\n /// @param sqrtRatioBX96 Another sqrt price\n /// @param liquidity The amount of usable liquidity\n /// @param roundUp Whether to round the amount up, or down\n /// @return amount1 Amount of token1 required to cover a position of size liquidity between the two passed prices\n function getAmount1Delta(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n uint128 liquidity,\n bool roundUp\n ) internal pure returns (uint256 amount1) {\n if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);\n\n return\n roundUp\n ? FullMath.mulDivRoundingUp(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96)\n : FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);\n }\n\n /// @notice Helper that gets signed token0 delta\n /// @param sqrtRatioAX96 A sqrt price\n /// @param sqrtRatioBX96 Another sqrt price\n /// @param liquidity The change in liquidity for which to compute the amount0 delta\n /// @return amount0 Amount of token0 corresponding to the passed liquidityDelta between the two prices\n function getAmount0Delta(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n int128 liquidity\n ) internal pure returns (int256 amount0) {\n return\n liquidity < 0\n ? -getAmount0Delta(sqrtRatioAX96, sqrtRatioBX96, uint128(-liquidity), false).toInt256()\n : getAmount0Delta(sqrtRatioAX96, sqrtRatioBX96, uint128(liquidity), true).toInt256();\n }\n\n /// @notice Helper that gets signed token1 delta\n /// @param sqrtRatioAX96 A sqrt price\n /// @param sqrtRatioBX96 Another sqrt price\n /// @param liquidity The change in liquidity for which to compute the amount1 delta\n /// @return amount1 Amount of token1 corresponding to the passed liquidityDelta between the two prices\n function getAmount1Delta(\n uint160 sqrtRatioAX96,\n uint160 sqrtRatioBX96,\n int128 liquidity\n ) internal pure returns (int256 amount1) {\n return\n liquidity < 0\n ? -getAmount1Delta(sqrtRatioAX96, sqrtRatioBX96, uint128(-liquidity), false).toInt256()\n : getAmount1Delta(sqrtRatioAX96, sqrtRatioBX96, uint128(liquidity), true).toInt256();\n }\n}\n" }, "contracts/libraries/SwapMath.sol": { "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity >=0.5.0;\n\nimport './FullMath.sol';\nimport './SqrtPriceMath.sol';\n\n/// @title Computes the result of a swap within ticks\n/// @notice Contains methods for computing the result of a swap within a single tick price range, i.e., a single tick.\nlibrary SwapMath {\n /// @notice Computes the result of swapping some amount in, or amount out, given the parameters of the swap\n /// @dev The fee, plus the amount in, will never exceed the amount remaining if the swap's `amountSpecified` is positive\n /// @param sqrtRatioCurrentX96 The current sqrt price of the pool\n /// @param sqrtRatioTargetX96 The price that cannot be exceeded, from which the direction of the swap is inferred\n /// @param liquidity The usable liquidity\n /// @param amountRemaining How much input or output amount is remaining to be swapped in/out\n /// @param feePips The fee taken from the input amount, expressed in hundredths of a bip\n /// @return sqrtRatioNextX96 The price after swapping the amount in/out, not to exceed the price target\n /// @return amountIn The amount to be swapped in, of either token0 or token1, based on the direction of the swap\n /// @return amountOut The amount to be received, of either token0 or token1, based on the direction of the swap\n /// @return feeAmount The amount of input that will be taken as a fee\n function computeSwapStep(\n uint160 sqrtRatioCurrentX96,\n uint160 sqrtRatioTargetX96,\n uint128 liquidity,\n int256 amountRemaining,\n uint24 feePips\n )\n internal\n pure\n returns (\n uint160 sqrtRatioNextX96,\n uint256 amountIn,\n uint256 amountOut,\n uint256 feeAmount\n )\n {\n bool zeroForOne = sqrtRatioCurrentX96 >= sqrtRatioTargetX96;\n bool exactIn = amountRemaining >= 0;\n\n if (exactIn) {\n uint256 amountRemainingLessFee = FullMath.mulDiv(uint256(amountRemaining), 1e6 - feePips, 1e6);\n amountIn = zeroForOne\n ? SqrtPriceMath.getAmount0Delta(sqrtRatioTargetX96, sqrtRatioCurrentX96, liquidity, true)\n : SqrtPriceMath.getAmount1Delta(sqrtRatioCurrentX96, sqrtRatioTargetX96, liquidity, true);\n if (amountRemainingLessFee >= amountIn) sqrtRatioNextX96 = sqrtRatioTargetX96;\n else\n sqrtRatioNextX96 = SqrtPriceMath.getNextSqrtPriceFromInput(\n sqrtRatioCurrentX96,\n liquidity,\n amountRemainingLessFee,\n zeroForOne\n );\n } else {\n amountOut = zeroForOne\n ? SqrtPriceMath.getAmount1Delta(sqrtRatioTargetX96, sqrtRatioCurrentX96, liquidity, false)\n : SqrtPriceMath.getAmount0Delta(sqrtRatioCurrentX96, sqrtRatioTargetX96, liquidity, false);\n if (uint256(-amountRemaining) >= amountOut) sqrtRatioNextX96 = sqrtRatioTargetX96;\n else\n sqrtRatioNextX96 = SqrtPriceMath.getNextSqrtPriceFromOutput(\n sqrtRatioCurrentX96,\n liquidity,\n uint256(-amountRemaining),\n zeroForOne\n );\n }\n\n bool max = sqrtRatioTargetX96 == sqrtRatioNextX96;\n\n // get the input/output amounts\n if (zeroForOne) {\n amountIn = max && exactIn\n ? amountIn\n : SqrtPriceMath.getAmount0Delta(sqrtRatioNextX96, sqrtRatioCurrentX96, liquidity, true);\n amountOut = max && !exactIn\n ? amountOut\n : SqrtPriceMath.getAmount1Delta(sqrtRatioNextX96, sqrtRatioCurrentX96, liquidity, false);\n } else {\n amountIn = max && exactIn\n ? amountIn\n : SqrtPriceMath.getAmount1Delta(sqrtRatioCurrentX96, sqrtRatioNextX96, liquidity, true);\n amountOut = max && !exactIn\n ? amountOut\n : SqrtPriceMath.getAmount0Delta(sqrtRatioCurrentX96, sqrtRatioNextX96, liquidity, false);\n }\n\n // cap the output amount to not exceed the remaining output amount\n if (!exactIn && amountOut > uint256(-amountRemaining)) {\n amountOut = uint256(-amountRemaining);\n }\n\n if (exactIn && sqrtRatioNextX96 != sqrtRatioTargetX96) {\n // we didn't reach the target, so take the remainder of the maximum input as fee\n feeAmount = uint256(amountRemaining) - amountIn;\n } else {\n feeAmount = FullMath.mulDivRoundingUp(amountIn, feePips, 1e6 - feePips);\n }\n }\n}\n" }, "contracts/interfaces/IUniswapV3PoolDeployer.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title An interface for a contract that is capable of deploying Uniswap V3 Pools\n/// @notice A contract that constructs a pool must implement this to pass arguments to the pool\n/// @dev This is used to avoid having constructor arguments in the pool contract, which results in the init code hash\n/// of the pool being constant allowing the CREATE2 address of the pool to be cheaply computed on-chain\ninterface IUniswapV3PoolDeployer {\n /// @notice Get the parameters to be used in constructing the pool, set transiently during pool creation.\n /// @dev Called by the pool constructor to fetch the parameters of the pool\n /// Returns factory The factory address\n /// Returns token0 The first token of the pool by address sort order\n /// Returns token1 The second token of the pool by address sort order\n /// Returns fee The fee collected upon every swap in the pool, denominated in hundredths of a bip\n /// Returns tickSpacing The minimum number of ticks between initialized ticks\n function parameters()\n external\n view\n returns (\n address factory,\n address token0,\n address token1,\n uint24 fee,\n int24 tickSpacing\n );\n}\n" }, "contracts/interfaces/IUniswapV3Factory.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title The interface for the Uniswap V3 Factory\n/// @notice The Uniswap V3 Factory facilitates creation of Uniswap V3 pools and control over the protocol fees\ninterface IUniswapV3Factory {\n /// @notice Emitted when the owner of the factory is changed\n /// @param oldOwner The owner before the owner was changed\n /// @param newOwner The owner after the owner was changed\n event OwnerChanged(address indexed oldOwner, address indexed newOwner);\n\n /// @notice Emitted when a pool is created\n /// @param token0 The first token of the pool by address sort order\n /// @param token1 The second token of the pool by address sort order\n /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip\n /// @param tickSpacing The minimum number of ticks between initialized ticks\n /// @param pool The address of the created pool\n event PoolCreated(\n address indexed token0,\n address indexed token1,\n uint24 indexed fee,\n int24 tickSpacing,\n address pool\n );\n\n /// @notice Emitted when a new fee amount is enabled for pool creation via the factory\n /// @param fee The enabled fee, denominated in hundredths of a bip\n /// @param tickSpacing The minimum number of ticks between initialized ticks for pools created with the given fee\n event FeeAmountEnabled(uint24 indexed fee, int24 indexed tickSpacing);\n\n /// @notice Returns the current owner of the factory\n /// @dev Can be changed by the current owner via setOwner\n /// @return The address of the factory owner\n function owner() external view returns (address);\n\n /// @notice Returns the tick spacing for a given fee amount, if enabled, or 0 if not enabled\n /// @dev A fee amount can never be removed, so this value should be hard coded or cached in the calling context\n /// @param fee The enabled fee, denominated in hundredths of a bip. Returns 0 in case of unenabled fee\n /// @return The tick spacing\n function feeAmountTickSpacing(uint24 fee) external view returns (int24);\n\n /// @notice Returns the pool address for a given pair of tokens and a fee, or address 0 if it does not exist\n /// @dev tokenA and tokenB may be passed in either token0/token1 or token1/token0 order\n /// @param tokenA The contract address of either token0 or token1\n /// @param tokenB The contract address of the other token\n /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip\n /// @return pool The pool address\n function getPool(\n address tokenA,\n address tokenB,\n uint24 fee\n ) external view returns (address pool);\n\n /// @notice Creates a pool for the given two tokens and fee\n /// @param tokenA One of the two tokens in the desired pool\n /// @param tokenB The other of the two tokens in the desired pool\n /// @param fee The desired fee for the pool\n /// @dev tokenA and tokenB may be passed in either order: token0/token1 or token1/token0. tickSpacing is retrieved\n /// from the fee. The call will revert if the pool already exists, the fee is invalid, or the token arguments\n /// are invalid.\n /// @return pool The address of the newly created pool\n function createPool(\n address tokenA,\n address tokenB,\n uint24 fee\n ) external returns (address pool);\n\n /// @notice Updates the owner of the factory\n /// @dev Must be called by the current owner\n /// @param _owner The new owner of the factory\n function setOwner(address _owner) external;\n\n /// @notice Enables a fee amount with the given tickSpacing\n /// @dev Fee amounts may never be removed once enabled\n /// @param fee The fee amount to enable, denominated in hundredths of a bip (i.e. 1e-6)\n /// @param tickSpacing The spacing between ticks to be enforced for all pools created with the given fee amount\n function enableFeeAmount(uint24 fee, int24 tickSpacing) external;\n}\n" }, "contracts/interfaces/IERC20Minimal.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Minimal ERC20 interface for Uniswap\n/// @notice Contains a subset of the full ERC20 interface that is used in Uniswap V3\ninterface IERC20Minimal {\n /// @notice Returns the balance of a token\n /// @param account The account for which to look up the number of tokens it has, i.e. its balance\n /// @return The number of tokens held by the account\n function balanceOf(address account) external view returns (uint256);\n\n /// @notice Transfers the amount of token from the `msg.sender` to the recipient\n /// @param recipient The account that will receive the amount transferred\n /// @param amount The number of tokens to send from the sender to the recipient\n /// @return Returns true for a successful transfer, false for an unsuccessful transfer\n function transfer(address recipient, uint256 amount) external returns (bool);\n\n /// @notice Returns the current allowance given to a spender by an owner\n /// @param owner The account of the token owner\n /// @param spender The account of the token spender\n /// @return The current allowance granted by `owner` to `spender`\n function allowance(address owner, address spender) external view returns (uint256);\n\n /// @notice Sets the allowance of a spender from the `msg.sender` to the value `amount`\n /// @param spender The account which will be allowed to spend a given amount of the owners tokens\n /// @param amount The amount of tokens allowed to be used by `spender`\n /// @return Returns true for a successful approval, false for unsuccessful\n function approve(address spender, uint256 amount) external returns (bool);\n\n /// @notice Transfers `amount` tokens from `sender` to `recipient` up to the allowance given to the `msg.sender`\n /// @param sender The account from which the transfer will be initiated\n /// @param recipient The recipient of the transfer\n /// @param amount The amount of the transfer\n /// @return Returns true for a successful transfer, false for unsuccessful\n function transferFrom(\n address sender,\n address recipient,\n uint256 amount\n ) external returns (bool);\n\n /// @notice Event emitted when tokens are transferred from one address to another, either via `#transfer` or `#transferFrom`.\n /// @param from The account from which the tokens were sent, i.e. the balance decreased\n /// @param to The account to which the tokens were sent, i.e. the balance increased\n /// @param value The amount of tokens that were transferred\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /// @notice Event emitted when the approval amount for the spender of a given owner's tokens changes.\n /// @param owner The account that approved spending of its tokens\n /// @param spender The account for which the spending allowance was modified\n /// @param value The new allowance from the owner to the spender\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n" }, "contracts/interfaces/callback/IUniswapV3MintCallback.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Callback for IUniswapV3PoolActions#mint\n/// @notice Any contract that calls IUniswapV3PoolActions#mint must implement this interface\ninterface IUniswapV3MintCallback {\n /// @notice Called to `msg.sender` after minting liquidity to a position from IUniswapV3Pool#mint.\n /// @dev In the implementation you must pay the pool tokens owed for the minted liquidity.\n /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.\n /// @param amount0Owed The amount of token0 due to the pool for the minted liquidity\n /// @param amount1Owed The amount of token1 due to the pool for the minted liquidity\n /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#mint call\n function uniswapV3MintCallback(\n uint256 amount0Owed,\n uint256 amount1Owed,\n bytes calldata data\n ) external;\n}\n" }, "contracts/interfaces/callback/IUniswapV3SwapCallback.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Callback for IUniswapV3PoolActions#swap\n/// @notice Any contract that calls IUniswapV3PoolActions#swap must implement this interface\ninterface IUniswapV3SwapCallback {\n /// @notice Called to `msg.sender` after executing a swap via IUniswapV3Pool#swap.\n /// @dev In the implementation you must pay the pool tokens owed for the swap.\n /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.\n /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped.\n /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by\n /// the end of the swap. If positive, the callback must send that amount of token0 to the pool.\n /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by\n /// the end of the swap. If positive, the callback must send that amount of token1 to the pool.\n /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#swap call\n function uniswapV3SwapCallback(\n int256 amount0Delta,\n int256 amount1Delta,\n bytes calldata data\n ) external;\n}\n" }, "contracts/interfaces/callback/IUniswapV3FlashCallback.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Callback for IUniswapV3PoolActions#flash\n/// @notice Any contract that calls IUniswapV3PoolActions#flash must implement this interface\ninterface IUniswapV3FlashCallback {\n /// @notice Called to `msg.sender` after transferring to the recipient from IUniswapV3Pool#flash.\n /// @dev In the implementation you must repay the pool the tokens sent by flash plus the computed fee amounts.\n /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.\n /// @param fee0 The fee amount in token0 due to the pool by the end of the flash\n /// @param fee1 The fee amount in token1 due to the pool by the end of the flash\n /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#flash call\n function uniswapV3FlashCallback(\n uint256 fee0,\n uint256 fee1,\n bytes calldata data\n ) external;\n}\n" }, "contracts/interfaces/pool/IUniswapV3PoolImmutables.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that never changes\n/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values\ninterface IUniswapV3PoolImmutables {\n /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface\n /// @return The contract address\n function factory() external view returns (address);\n\n /// @notice The first of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token0() external view returns (address);\n\n /// @notice The second of the two tokens of the pool, sorted by address\n /// @return The token contract address\n function token1() external view returns (address);\n\n /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\n /// @return The fee\n function fee() external view returns (uint24);\n\n /// @notice The pool tick spacing\n /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive\n /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...\n /// This value is an int24 to avoid casting even though it is always positive.\n /// @return The tick spacing\n function tickSpacing() external view returns (int24);\n\n /// @notice The maximum amount of position liquidity that can use any tick in the range\n /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and\n /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool\n /// @return The max amount of liquidity per tick\n function maxLiquidityPerTick() external view returns (uint128);\n}\n" }, "contracts/interfaces/pool/IUniswapV3PoolState.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that can change\n/// @notice These methods compose the pool's state, and can change with any frequency including multiple times\n/// per transaction\ninterface IUniswapV3PoolState {\n /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas\n /// when accessed externally.\n /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value\n /// tick The current tick of the pool, i.e. according to the last tick transition that was run.\n /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick\n /// boundary.\n /// observationIndex The index of the last oracle observation that was written,\n /// observationCardinality The current maximum number of observations stored in the pool,\n /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.\n /// feeProtocol The protocol fee for both tokens of the pool.\n /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0\n /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.\n /// unlocked Whether the pool is currently locked to reentrancy\n function slot0()\n external\n view\n returns (\n uint160 sqrtPriceX96,\n int24 tick,\n uint16 observationIndex,\n uint16 observationCardinality,\n uint16 observationCardinalityNext,\n uint8 feeProtocol,\n bool unlocked\n );\n\n /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal0X128() external view returns (uint256);\n\n /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool\n /// @dev This value can overflow the uint256\n function feeGrowthGlobal1X128() external view returns (uint256);\n\n /// @notice The amounts of token0 and token1 that are owed to the protocol\n /// @dev Protocol fees will never exceed uint128 max in either token\n function protocolFees() external view returns (uint128 token0, uint128 token1);\n\n /// @notice The currently in range liquidity available to the pool\n /// @dev This value has no relationship to the total liquidity across all ticks\n function liquidity() external view returns (uint128);\n\n /// @notice Look up information about a specific tick in the pool\n /// @param tick The tick to look up\n /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or\n /// tick upper,\n /// liquidityNet how much liquidity changes when the pool price crosses the tick,\n /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,\n /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,\n /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick\n /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,\n /// secondsOutside the seconds spent on the other side of the tick from the current tick,\n /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.\n /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.\n /// In addition, these values are only relative and must be used only in comparison to previous snapshots for\n /// a specific position.\n function ticks(int24 tick)\n external\n view\n returns (\n uint128 liquidityGross,\n int128 liquidityNet,\n uint256 feeGrowthOutside0X128,\n uint256 feeGrowthOutside1X128,\n int56 tickCumulativeOutside,\n uint160 secondsPerLiquidityOutsideX128,\n uint32 secondsOutside,\n bool initialized\n );\n\n /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information\n function tickBitmap(int16 wordPosition) external view returns (uint256);\n\n /// @notice Returns the information about a position by the position's key\n /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper\n /// @return _liquidity The amount of liquidity in the position,\n /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,\n /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,\n /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,\n /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke\n function positions(bytes32 key)\n external\n view\n returns (\n uint128 _liquidity,\n uint256 feeGrowthInside0LastX128,\n uint256 feeGrowthInside1LastX128,\n uint128 tokensOwed0,\n uint128 tokensOwed1\n );\n\n /// @notice Returns data about a specific observation index\n /// @param index The element of the observations array to fetch\n /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time\n /// ago, rather than at a specific index in the array.\n /// @return blockTimestamp The timestamp of the observation,\n /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,\n /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,\n /// Returns initialized whether the observation has been initialized and the values are safe to use\n function observations(uint256 index)\n external\n view\n returns (\n uint32 blockTimestamp,\n int56 tickCumulative,\n uint160 secondsPerLiquidityCumulativeX128,\n bool initialized\n );\n}\n" }, "contracts/interfaces/pool/IUniswapV3PoolDerivedState.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Pool state that is not stored\n/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the\n/// blockchain. The functions here may have variable gas costs.\ninterface IUniswapV3PoolDerivedState {\n /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp\n /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing\n /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,\n /// you must call it with secondsAgos = [3600, 0].\n /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in\n /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.\n /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned\n /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp\n /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block\n /// timestamp\n function observe(uint32[] calldata secondsAgos)\n external\n view\n returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);\n\n /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range\n /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.\n /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first\n /// snapshot is taken and the second snapshot is taken.\n /// @param tickLower The lower tick of the range\n /// @param tickUpper The upper tick of the range\n /// @return tickCumulativeInside The snapshot of the tick accumulator for the range\n /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range\n /// @return secondsInside The snapshot of seconds per liquidity for the range\n function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)\n external\n view\n returns (\n int56 tickCumulativeInside,\n uint160 secondsPerLiquidityInsideX128,\n uint32 secondsInside\n );\n}\n" }, "contracts/interfaces/pool/IUniswapV3PoolActions.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissionless pool actions\n/// @notice Contains pool methods that can be called by anyone\ninterface IUniswapV3PoolActions {\n /// @notice Sets the initial price for the pool\n /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value\n /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96\n function initialize(uint160 sqrtPriceX96) external;\n\n /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position\n /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback\n /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends\n /// on tickLower, tickUpper, the amount of liquidity, and the current price.\n /// @param recipient The address for which the liquidity will be created\n /// @param tickLower The lower tick of the position in which to add liquidity\n /// @param tickUpper The upper tick of the position in which to add liquidity\n /// @param amount The amount of liquidity to mint\n /// @param data Any data that should be passed through to the callback\n /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback\n /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback\n function mint(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount,\n bytes calldata data\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Collects tokens owed to a position\n /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.\n /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or\n /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the\n /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.\n /// @param recipient The address which should receive the fees collected\n /// @param tickLower The lower tick of the position for which to collect fees\n /// @param tickUpper The upper tick of the position for which to collect fees\n /// @param amount0Requested How much token0 should be withdrawn from the fees owed\n /// @param amount1Requested How much token1 should be withdrawn from the fees owed\n /// @return amount0 The amount of fees collected in token0\n /// @return amount1 The amount of fees collected in token1\n function collect(\n address recipient,\n int24 tickLower,\n int24 tickUpper,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n\n /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position\n /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0\n /// @dev Fees must be collected separately via a call to #collect\n /// @param tickLower The lower tick of the position for which to burn liquidity\n /// @param tickUpper The upper tick of the position for which to burn liquidity\n /// @param amount How much liquidity to burn\n /// @return amount0 The amount of token0 sent to the recipient\n /// @return amount1 The amount of token1 sent to the recipient\n function burn(\n int24 tickLower,\n int24 tickUpper,\n uint128 amount\n ) external returns (uint256 amount0, uint256 amount1);\n\n /// @notice Swap token0 for token1, or token1 for token0\n /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback\n /// @param recipient The address to receive the output of the swap\n /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0\n /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)\n /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this\n /// value after the swap. If one for zero, the price cannot be greater than this value after the swap\n /// @param data Any data to be passed through to the callback\n /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive\n /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive\n function swap(\n address recipient,\n bool zeroForOne,\n int256 amountSpecified,\n uint160 sqrtPriceLimitX96,\n bytes calldata data\n ) external returns (int256 amount0, int256 amount1);\n\n /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback\n /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback\n /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling\n /// with 0 amount{0,1} and sending the donation amount(s) from the callback\n /// @param recipient The address which will receive the token0 and token1 amounts\n /// @param amount0 The amount of token0 to send\n /// @param amount1 The amount of token1 to send\n /// @param data Any data to be passed through to the callback\n function flash(\n address recipient,\n uint256 amount0,\n uint256 amount1,\n bytes calldata data\n ) external;\n\n /// @notice Increase the maximum number of price and liquidity observations that this pool will store\n /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to\n /// the input observationCardinalityNext.\n /// @param observationCardinalityNext The desired minimum number of observations for the pool to store\n function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;\n}\n" }, "contracts/interfaces/pool/IUniswapV3PoolOwnerActions.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Permissioned pool actions\n/// @notice Contains pool methods that may only be called by the factory owner\ninterface IUniswapV3PoolOwnerActions {\n /// @notice Set the denominator of the protocol's % share of the fees\n /// @param feeProtocol0 new protocol fee for token0 of the pool\n /// @param feeProtocol1 new protocol fee for token1 of the pool\n function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;\n\n /// @notice Collect the protocol fee accrued to the pool\n /// @param recipient The address to which collected protocol fees should be sent\n /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1\n /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0\n /// @return amount0 The protocol fee collected in token0\n /// @return amount1 The protocol fee collected in token1\n function collectProtocol(\n address recipient,\n uint128 amount0Requested,\n uint128 amount1Requested\n ) external returns (uint128 amount0, uint128 amount1);\n}\n" }, "contracts/interfaces/pool/IUniswapV3PoolEvents.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Events emitted by a pool\n/// @notice Contains all events emitted by the pool\ninterface IUniswapV3PoolEvents {\n /// @notice Emitted exactly once by a pool when #initialize is first called on the pool\n /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize\n /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96\n /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool\n event Initialize(uint160 sqrtPriceX96, int24 tick);\n\n /// @notice Emitted when liquidity is minted for a given position\n /// @param sender The address that minted the liquidity\n /// @param owner The owner of the position and recipient of any minted liquidity\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity minted to the position range\n /// @param amount0 How much token0 was required for the minted liquidity\n /// @param amount1 How much token1 was required for the minted liquidity\n event Mint(\n address sender,\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted when fees are collected by the owner of a position\n /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees\n /// @param owner The owner of the position for which fees are collected\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount0 The amount of token0 fees collected\n /// @param amount1 The amount of token1 fees collected\n event Collect(\n address indexed owner,\n address recipient,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount0,\n uint128 amount1\n );\n\n /// @notice Emitted when a position's liquidity is removed\n /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect\n /// @param owner The owner of the position for which liquidity is removed\n /// @param tickLower The lower tick of the position\n /// @param tickUpper The upper tick of the position\n /// @param amount The amount of liquidity to remove\n /// @param amount0 The amount of token0 withdrawn\n /// @param amount1 The amount of token1 withdrawn\n event Burn(\n address indexed owner,\n int24 indexed tickLower,\n int24 indexed tickUpper,\n uint128 amount,\n uint256 amount0,\n uint256 amount1\n );\n\n /// @notice Emitted by the pool for any swaps between token0 and token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the output of the swap\n /// @param amount0 The delta of the token0 balance of the pool\n /// @param amount1 The delta of the token1 balance of the pool\n /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96\n /// @param liquidity The liquidity of the pool after the swap\n /// @param tick The log base 1.0001 of price of the pool after the swap\n event Swap(\n address indexed sender,\n address indexed recipient,\n int256 amount0,\n int256 amount1,\n uint160 sqrtPriceX96,\n uint128 liquidity,\n int24 tick\n );\n\n /// @notice Emitted by the pool for any flashes of token0/token1\n /// @param sender The address that initiated the swap call, and that received the callback\n /// @param recipient The address that received the tokens from flash\n /// @param amount0 The amount of token0 that was flashed\n /// @param amount1 The amount of token1 that was flashed\n /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee\n /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee\n event Flash(\n address indexed sender,\n address indexed recipient,\n uint256 amount0,\n uint256 amount1,\n uint256 paid0,\n uint256 paid1\n );\n\n /// @notice Emitted by the pool for increases to the number of observations that can be stored\n /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index\n /// just before a mint/swap/burn.\n /// @param observationCardinalityNextOld The previous value of the next observation cardinality\n /// @param observationCardinalityNextNew The updated value of the next observation cardinality\n event IncreaseObservationCardinalityNext(\n uint16 observationCardinalityNextOld,\n uint16 observationCardinalityNextNew\n );\n\n /// @notice Emitted when the protocol fee is changed by the pool\n /// @param feeProtocol0Old The previous value of the token0 protocol fee\n /// @param feeProtocol1Old The previous value of the token1 protocol fee\n /// @param feeProtocol0New The updated value of the token0 protocol fee\n /// @param feeProtocol1New The updated value of the token1 protocol fee\n event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);\n\n /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner\n /// @param sender The address that collects the protocol fees\n /// @param recipient The address that receives the collected protocol fees\n /// @param amount0 The amount of token0 protocol fees that is withdrawn\n /// @param amount0 The amount of token1 protocol fees that is withdrawn\n event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);\n}\n" }, "contracts/libraries/BitMath.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title BitMath\n/// @dev This library provides functionality for computing bit properties of an unsigned integer\nlibrary BitMath {\n /// @notice Returns the index of the most significant bit of the number,\n /// where the least significant bit is at index 0 and the most significant bit is at index 255\n /// @dev The function satisfies the property:\n /// x >= 2**mostSignificantBit(x) and x < 2**(mostSignificantBit(x)+1)\n /// @param x the value for which to compute the most significant bit, must be greater than 0\n /// @return r the index of the most significant bit\n function mostSignificantBit(uint256 x) internal pure returns (uint8 r) {\n require(x > 0);\n\n if (x >= 0x100000000000000000000000000000000) {\n x >>= 128;\n r += 128;\n }\n if (x >= 0x10000000000000000) {\n x >>= 64;\n r += 64;\n }\n if (x >= 0x100000000) {\n x >>= 32;\n r += 32;\n }\n if (x >= 0x10000) {\n x >>= 16;\n r += 16;\n }\n if (x >= 0x100) {\n x >>= 8;\n r += 8;\n }\n if (x >= 0x10) {\n x >>= 4;\n r += 4;\n }\n if (x >= 0x4) {\n x >>= 2;\n r += 2;\n }\n if (x >= 0x2) r += 1;\n }\n\n /// @notice Returns the index of the least significant bit of the number,\n /// where the least significant bit is at index 0 and the most significant bit is at index 255\n /// @dev The function satisfies the property:\n /// (x & 2**leastSignificantBit(x)) != 0 and (x & (2**(leastSignificantBit(x)) - 1)) == 0)\n /// @param x the value for which to compute the least significant bit, must be greater than 0\n /// @return r the index of the least significant bit\n function leastSignificantBit(uint256 x) internal pure returns (uint8 r) {\n require(x > 0);\n\n r = 255;\n if (x & type(uint128).max > 0) {\n r -= 128;\n } else {\n x >>= 128;\n }\n if (x & type(uint64).max > 0) {\n r -= 64;\n } else {\n x >>= 64;\n }\n if (x & type(uint32).max > 0) {\n r -= 32;\n } else {\n x >>= 32;\n }\n if (x & type(uint16).max > 0) {\n r -= 16;\n } else {\n x >>= 16;\n }\n if (x & type(uint8).max > 0) {\n r -= 8;\n } else {\n x >>= 8;\n }\n if (x & 0xf > 0) {\n r -= 4;\n } else {\n x >>= 4;\n }\n if (x & 0x3 > 0) {\n r -= 2;\n } else {\n x >>= 2;\n }\n if (x & 0x1 > 0) r -= 1;\n }\n}\n" }, "contracts/libraries/UnsafeMath.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/// @title Math functions that do not check inputs or outputs\n/// @notice Contains methods that perform common math functions but do not do any overflow or underflow checks\nlibrary UnsafeMath {\n /// @notice Returns ceil(x / y)\n /// @dev division by 0 has unspecified behavior, and must be checked externally\n /// @param x The dividend\n /// @param y The divisor\n /// @return z The quotient, ceil(x / y)\n function divRoundingUp(uint256 x, uint256 y) internal pure returns (uint256 z) {\n assembly {\n z := add(div(x, y), gt(mod(x, y), 0))\n }\n }\n}\n" }, "contracts/libraries/FixedPoint96.sol": { "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.4.0;\n\n/// @title FixedPoint96\n/// @notice A library for handling binary fixed point numbers, see https://en.wikipedia.org/wiki/Q_(number_format)\n/// @dev Used in SqrtPriceMath.sol\nlibrary FixedPoint96 {\n uint8 internal constant RESOLUTION = 96;\n uint256 internal constant Q96 = 0x1000000000000000000000000;\n}\n" } }, "settings": { "optimizer": { "enabled": true, "runs": 800 }, "metadata": { "bytecodeHash": "none" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } }, "libraries": {} } }}
1
19,493,364
041e07a94846b7068cf397da2a2c4f433f1e6a7ffd21ae3425340af5f27098dd
8e18397d44dfc09247560ec3dc75f5de875689bd5bac97698b19c8f68096ae47
d71a88fc853483be77f453fe8cdad330175c3ac1
881d4032abe4188e2237efcd27ab435e81fc6bb1
2e6fd6a7f77b32bdea37ef509416c52ab78bf5e1
3d602d80600a3d3981f3363d3d373d3d3d363d73fcc3956936d3100f8976147de9d80a9de19245b75af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73fcc3956936d3100f8976147de9d80a9de19245b75af43d82803e903d91602b57fd5bf3
1
19,493,364
041e07a94846b7068cf397da2a2c4f433f1e6a7ffd21ae3425340af5f27098dd
98919cf2d683090304000823d9d936a99df72c9616098d9d1ebf5352db04cf31
f7f8bbb310df9cf0a99b2121c27a9f891507fedb
536384fcd25b576265b6775f383d5ac408ff9db7
ff1da60d991082fbcdde0d5bcc384e62c279c518
60a060405234801561001057600080fd5b506040516101d43803806101d483398101604081905261002f91610044565b60601b6001600160601b031916608052610072565b600060208284031215610055578081fd5b81516001600160a01b038116811461006b578182fd5b9392505050565b60805160601c61013f610095600039600081816069015260be015261013f6000f3fe6080604052600436106100225760003560e01c80635c60da1b146100ac57610067565b3661006757604080516020808252600090820152339134917f606834f57405380c4fb88d1f4850326ad3885f014bab3b568dfbf7a041eef738910160405180910390a3005b7f00000000000000000000000000000000000000000000000000000000000000003660008037600080366000845af43d6000803e8080156100a7573d6000f35b3d6000fd5b3480156100b857600080fd5b506100e07f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f3fea2646970667358221220b88a14f52e9d465328c9b3ab476e4b7fa40ed3615fd5409a6afc9885366e03a964736f6c63430008030033000000000000000000000000ab00ea153c43575184ff11dd5e713c96be005573
6080604052600436106100225760003560e01c80635c60da1b146100ac57610067565b3661006757604080516020808252600090820152339134917f606834f57405380c4fb88d1f4850326ad3885f014bab3b568dfbf7a041eef738910160405180910390a3005b7f000000000000000000000000ab00ea153c43575184ff11dd5e713c96be0055733660008037600080366000845af43d6000803e8080156100a7573d6000f35b3d6000fd5b3480156100b857600080fd5b506100e07f000000000000000000000000ab00ea153c43575184ff11dd5e713c96be00557381565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f3fea2646970667358221220b88a14f52e9d465328c9b3ab476e4b7fa40ed3615fd5409a6afc9885366e03a964736f6c63430008030033
// Copyright (C) 2018 Argent Labs Ltd. <https://argent.xyz> // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.3; /** * @title Proxy * @notice Basic proxy that delegates all calls to a fixed implementing contract. * The implementing contract cannot be upgraded. * @author Julien Niset - <[email protected]> */ contract Proxy { address immutable public implementation; event Received(uint indexed value, address indexed sender, bytes data); constructor(address _implementation) { implementation = _implementation; } fallback() external payable { address target = implementation; // solhint-disable-next-line no-inline-assembly assembly { calldatacopy(0, 0, calldatasize()) let result := delegatecall(gas(), target, 0, calldatasize(), 0, 0) returndatacopy(0, 0, returndatasize()) switch result case 0 {revert(0, returndatasize())} default {return (0, returndatasize())} } } receive() external payable { emit Received(msg.value, msg.sender, ""); } }
1
19,493,365
6fcfd680c060d9a73d9752126bfce596f04f1c02038f51115bb057d2ba5a2078
81c5cd605dc5827e07f5fd9e9131d0e5186aeddef246d19a1f13abbcdb079678
bfd6b6f04e3c992e6f88db612daa03cd6aab3798
2269bceb3f4e0aa53d2fc43b1b7c5c5d13b119a5
83de3ca4dca456faffe1c6d6f4c0ccc926acb890
3d602d80600a3d3981f3363d3d373d3d3d363d73de9a07e5f1eaf3236e84724e0a221ce44d7b26575af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73de9a07e5f1eaf3236e84724e0a221ce44d7b26575af43d82803e903d91602b57fd5bf3
{{ "language": "Solidity", "sources": { "@nfts2me/contracts/important/README.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * .::. //\n * ...... //\n * .... ::. //\n * .:.. :: ... //\n * ..:. :: ... //\n * ::. ..:-- ::. ... //\n * .: ..:::::-==: :::::.. : //\n * .: :::::::-====: :::::::: : //\n * .: :::::::-======. :::::::: : //\n * .: :::::::-=======-:::::::: : //\n * .: :::::::-========-::::::: : //\n * .: ::::::::========-::::::: : //\n * .: :::::::. .======-::::::: : //\n * .: :::::::. :====-::::::: : //\n * .: .:::::. -==-:::::. : //\n * .:. .:. .--:.. ... //\n * .:. :. ... //\n * .... :. .... //\n * .:. .:. //\n * .::::. //\n * :--. //\n * //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * More info at: https://docs.nfts2me.com/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\n/// @title NFTs2Me.com Smart Contracts README\n/// @author The NFTs2Me Team\n/// @notice Read our terms of service\n/// @custom:security-contact [email protected]\n/// @custom:terms-of-service https://nfts2me.com/terms-of-service/\n/// @custom:website https://nfts2me.com/\ninterface Readme {\n function n2mVersion() external pure returns (uint256);\n }\n" }, "@nfts2me/contracts/interfaces/IN2M_ERCBase.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol\";\nimport \"./IN2M_ERCStorage.sol\";\n\ninterface IN2M_ERCBase is IERC2981Upgradeable, IN2M_ERCStorage {\n /// @notice To be called to create the collection. Can only be called once.\n function initialize\n (\n string memory tokenName,\n string memory tokenSymbol,\n uint256 iMintPrice,\n bytes32 baseURICIDHash,\n bytes32 placeholderImageCIDHash,\n RevenueAddress[] calldata revenueAddresses,\n address iErc20PaymentAddress,\n uint32 iTotalSupply,\n uint16 iRoyaltyFee,\n bool soulboundCollection,\n MintingType iMintingType\n ) external payable;\n\n /// @notice A descriptive name for a collection of NFTs in this contract\n function name() external view returns (string memory);\n\n /// @notice An abbreviated name for NFTs in this contract\n /// @return the collection symbol\n function symbol() external view returns (string memory);\n\n /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.\n /// @dev Throws if `_tokenId` is not a valid NFT. URIs are defined in RFC\n /// 3986. The URI may point to a JSON file that conforms to the \"ERC721\n /// Metadata JSON Schema\".\n function tokenURI(uint256 tokenId) external view returns (string memory);\n\n /// @notice Mints one NFT to the caller (msg.sender). Requires `minting type` to be `sequential` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n function mint() external payable;\n\n /// @notice Mints `amount` NFTs to the caller (msg.sender). Requires `minting type` to be `sequential` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n /// @param amount The number of NFTs to mint\n function mint(uint256 amount) external payable;\n\n /// @notice Mints `amount` NFTs to the caller (msg.sender) with a given `affiliate`. Requires `minting type` to be `sequential` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n /// @param amount The number of NFTs to mint\n /// @param affiliate The affiliate address\n function mint(uint256 amount, address affiliate) external payable;\n\n /// @notice Mints `amount` NFTs to `to` address. Requires `minting type` to be `sequential` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n /// @param to The address of the NFTs receiver\n /// @param amount The number of NFTs to mint \n function mintTo(address to, uint256 amount) external payable;\n\n /// @notice Mints `amount` NFTs to `to` address with a given `affiliate`. Requires `minting type` to be `sequential` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n /// @param to The address of the NFTs receiver\n /// @param amount The number of NFTs to mint \n /// @param affiliate The affiliate address\n function mintTo(address to, uint256 amount, address affiliate) external payable;\n\n /// @notice Two phases on-chain random minting. Mints `amount` NFTs tickets to `to` address. Requires `minting type` to be `random` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment). Once minted, those tickets must be redeemed for an actual token calling `redeemRandom()`.\n /// @param to The address of the NFTs receiver\n /// @param amount The number of NFTs to mint \n function mintRandomTo(address to, uint256 amount) external payable; \n\n /// @notice Two phases on-chain random minting. Mints `amount` NFTs tickets to `to` address with a given `affiliate`. Requires `minting type` to be `random` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment). Once minted, those tickets must be redeemed for an actual token calling `redeemRandom()`.\n /// @param to The address of the NFTs receiver\n /// @param amount The number of NFTs to mint \n /// @param affiliate The affiliate address\n function mintRandomTo(address to, uint256 amount, address affiliate) external payable;\n\n /// @notice Redeems remaining random tickets generated from `msg.sender` by calling `mintRandomTo` for actual NFTs.\n function redeemRandom() external payable;\n\n /// @notice Mints `amount` NFTs to `to` address. Requires `minting type` to be `specify` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n /// @param to The address of the NFTs receiver\n /// @param tokenIds An array of the specified tokens. They must not be minted, otherwise, it will revert.\n function mintSpecifyTo(address to, uint256[] memory tokenIds) external payable; \n\n /// @notice Mints `amount` NFTs to `to` address with a given `affiliate`. Requires `minting type` to be `specify` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n /// @param to The address of the NFTs receiver\n /// @param tokenIds An array of the specified tokens. They must not be minted, otherwise, it will revert.\n /// @param affiliate The affiliate address\n function mintSpecifyTo(address to, uint256[] memory tokenIds, address affiliate) external payable; \n\n /// @notice Mints one NFT to `to` address. Requires `minting type` to be `customURI`.\n /// @param to The address of the NFTs receiver\n /// @param customURICIDHash The CID of the given token.\n /// @param soulbound True if the NFT is a Soulbound Token (SBT). If set, it can't be transferred.\n function mintCustomURITo(address to, bytes32 customURICIDHash, bool soulbound) external payable;\n\n /// @notice Only owner can call this function. Free of charge. Mints sizeof(`to`) to `to` addresses. Requires `minting type` to be `sequential`.\n /// @param to The addresses of the NFTs receivers\n /// @param soulbound True if the NFT is a Soulbound Token (SBT). If set, it can't be transferred.\n function airdropSequential(address[] memory to, bool soulbound) external payable;\n\n /// @notice Only owner can call this function. Free of charge. Mints sizeof(`to`) to `to` addresses with random tokenIds. Requires `minting type` to be `random`.\n /// @param to The addresses of the NFTs receivers\n /// @param soulbound True if the NFT is a Soulbound Token (SBT). If set, it can't be transferred.\n function airdropRandom(address[] memory to, bool soulbound) external payable;\n\n /// @notice Only owner can call this function. Free of charge. Mints sizeof(`to`) to `to` addresses with specified tokenIds. Requires `minting type` to be `specify`.\n /// @param to The addresses of the NFTs receivers\n /// @param tokenIds An array of the specified tokens. They must not be minted, otherwise, it will revert.\n /// @param soulbound True if the NFT is a Soulbound Token (SBT). If set, it can't be transferred.\n function airdropSpecify(address[] memory to, uint256[] memory tokenIds, bool soulbound) external payable;\n\n /// @notice Mints `amount` of NFTs to `to` address with optional specified tokenIds. This function must be called only if a valid `signature` is given during a whitelisting/presale.\n /// @param to The addresses of the NFTs receivers\n /// @param tokenIds An optional array of the specified tokens. They must not be minted, otherwise, it will revert. Only used if minting type is `specify`.\n /// @param freeMinting True is minting is free\n /// @param customFee Zero is fee is different from `mintingPrice`.\n /// @param maxAmount Max Amount to be minted with the given `signature`.\n /// @param amount Amount to mint.\n /// @param soulbound True if the NFT is a Soulbound Token (SBT). If set, it can't be transferred.\n /// @param signature Valid `signature` for the presale/whitelist.\n function mintPresale (\n address to, \n uint256[] memory tokenIds,\n bool freeMinting, \n uint256 customFee, \n uint256 maxAmount,\n uint256 amount, \n bool soulbound,\n bytes calldata signature) payable external;\n\n /// @notice Returns the minting price of one NFT.\n /// @return Mint price for one NFT in native coin or ERC-20.\n function mintPrice() external view returns (uint256);\n\n /// @notice Returns the current total supply.\n /// @return Current total supply.\n function totalSupply() external view returns (uint256);\n\n /// @notice Max amount of NFTs to be hold per address.\n /// @return Max per address allowed.\n function maxPerAddress() external view returns (uint16);\n\n}\n\n" }, "@nfts2me/contracts/interfaces/IN2M_ERCStorage.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"../important/README.sol\";\n\ninterface IN2M_ERCStorage is Readme {\n /// @notice This event is emitted when a token is minted using an affiliate\n /// @param affiliate The affiliate address\n event AffiliateSell(address indexed affiliate);\n\n /// @notice Error thrown when trying to mint a token with a given id which is already minted\n error TokenAlreadyMinted();\n\n /// @notice Error thrown when input variable differ in length\n error InvalidInputSizesDontMatch();\n\n /// @notice Error thrown when input variable differ in length\n error InputSizeMismatch();\n\n /// @notice Error thrown when trying to mint a token with a given invalid id\n error InvalidTokenId();\n\n /// @notice Error thrown when trying to redeem random tickets with no amount to redeem\n error NothingToRedeem();\n\n /// @notice Error thrown when trying to redeem random tickets too soon\n error CantRevealYetWaitABitToBeAbleToRedeem();\n\n /// @notice Error thrown when the input amount is not valid\n error InvalidAmount();\n\n /// @notice Error thrown when trying to mint a sold out collection or the amount to mint exceeds the remaining supply\n error CollectionSoldOut();\n\n /// @notice Error thrown when trying to presale/whitelist mint and the collection current phase is `closed`\n error PresaleNotOpen();\n\n /// @notice Error thrown when trying to mint and the collection current phase is not `open`\n error PublicSaleNotOpen();\n\n /// @notice Error thrown when trying to mint but the sale has already finished\n error SaleFinished();\n\n /// @notice Error thrown when trying to mint more than the allowance to mint\n error NotEnoughAmountToMint();\n\n /// @notice Error thrown when sending funds to a free minting\n error InvalidMintFeeForFreeMinting();\n\n /// @notice Error thrown when the sent amount is not valid\n error InvalidMintFee();\n\n /// @notice Royalty fee can't be higher than 10%\n error RoyaltyFeeTooHigh();\n\n /// @notice Invalid input. Total supply must be greater than zero\n error TotalSupplyMustBeGreaterThanZero();\n\n /// @notice Can't set BaseURI and Placeholder at the same time\n error CantSetBaseURIAndPlaceholderAtTheSameTime();\n\n /// @notice No BaseURI nor Placeholder set\n error NoBaseURINorPlaceholderSet();\n\n /// @notice Can't transfer a Soulbound Token (SBT)\n error NonTransferrableSoulboundNFT();\n\n /// @notice The input revenue percentages are not valid\n error InvalidRevenuePercentage();\n\n /// @notice Can't mint until specified drop date\n error WaitUntilDropDate();\n\n /// @notice Trying to use mintPresale method in a collection with a minting type that doesn't support whitelist\n error PresaleInvalidMintingType();\n\n /// @notice Metadata is already fixed. Can't change metadata once fixed\n error MetadataAlreadyFixed();\n\n /// @notice Invalid collection minting type for the current minting function\n error InvalidMintingType();\n\n /// @notice The address exceeded the max per address amount\n error MaxPerAddressExceeded();\n\n /// @notice The given signature doesn't match the input values\n error SignatureMismatch();\n\n /// @notice Reentrancy Guard protection\n error ReentrancyGuard();\n\n /// @notice New Placeholder can't be empty\n error NewPlaceholderCantBeEmpty();\n\n /// @notice New BaseURI can't be empty\n error NewBaseURICantBeEmpty(); \n\n /// @notice Invalid percentage or discount values\n error InvalidPercentageOrDiscountValues();\n\n /// @notice Can't lower current percentages\n error CantLowerCurrentPercentages();\n\n /// @notice Contract MetadataURI already fixed\n error ContractMetadataURIAlreadyFixed();\n\n /// @notice Only owner of N2M can call this function\n error OnlyOwnerOrN2M();\n\n /// @notice Only the given affiliate or N2M can call this function\n error OnlyAffiliateOrN2M();\n\n /// @notice The signature has expired\n error SignatureExpired();\n\n /// @notice Invalid phase can't be set without giving a date, use the proper functions\n error InvalidPhaseWithoutDate();\n\n /// @notice Invalid drop date\n error InvalidDropDate();\n\n /// @notice Operator address is filtered\n error AddressFiltered(address filtered);\n\n struct RandomTicket {\n uint256 amount;\n uint256 blockNumberToReveal;\n }\n\n struct RevenueAddress {\n address to;\n uint16 percentage;\n }\n\n struct AffiliateInformation {\n bool enabled;\n uint16 affiliatePercentage;\n uint16 userDiscount;\n }\n\n enum SalePhase { \n CLOSED,\n PRESALE,\n PUBLIC,\n DROP_DATE,\n DROP_AND_END_DATE\n }\n\n enum MintingType { \n SEQUENTIAL, \n RANDOM, \n SPECIFY, \n CUSTOM_URI \n }\n\n enum OperatorFilterStatus { \n ENABLED_NOT_INITIALIZED, \n ENABLED_EXISTS, \n DISABLED_NOT_INITIALIZED,\n DISABLED_EXISTS \n }\n\n /// @notice Returns true if the metadata is fixed and immutable. If the metadata hasn't been fixed yet it will return false. Once fixed, it can't be changed by anyone.\n function isMetadataFixed() external view returns (bool);\n\n}\n\n" }, "@nfts2me/contracts/interfaces/IN2MBeaconFactory.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\ninterface IN2MBeaconFactory {\n function getERC721Implementation() external view returns (address);\n function getERC1155Implementation() external view returns (address);\n}\n" }, "@nfts2me/contracts/interfaces/IN2MCrossFactory.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\ninterface IN2MCrossFactory {\n function getN2MTreasuryAddress() external pure returns (address);\n function ownerOf(uint256 tokenId) external view returns (address);\n function strictOwnerOf(uint256 tokenId) external view returns (address);\n}\n" }, "@nfts2me/contracts/interfaces/IOperatorFilterRegistry.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\ninterface IOperatorFilterRegistry {\n function isOperatorAllowed(address registrant, address operator) external view returns (bool);\n function register(address registrant) external;\n function registerAndSubscribe(address registrant, address subscription) external;\n function registerAndCopyEntries(address registrant, address registrantToCopy) external;\n function updateOperator(address registrant, address operator, bool filtered) external;\n function updateOperators(address registrant, address[] calldata operators, bool filtered) external;\n function updateCodeHash(address registrant, bytes32 codehash, bool filtered) external;\n function updateCodeHashes(address registrant, bytes32[] calldata codeHashes, bool filtered) external;\n function subscribe(address registrant, address registrantToSubscribe) external;\n function unsubscribe(address registrant, bool copyExistingEntries) external;\n function subscriptionOf(address addr) external returns (address registrant);\n function subscribers(address registrant) external returns (address[] memory);\n function subscriberAt(address registrant, uint256 index) external returns (address);\n function copyEntriesOf(address registrant, address registrantToCopy) external;\n function isOperatorFiltered(address registrant, address operator) external returns (bool);\n function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool);\n function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool);\n function filteredOperators(address addr) external returns (address[] memory);\n function filteredCodeHashes(address addr) external returns (bytes32[] memory);\n function filteredOperatorAt(address registrant, uint256 index) external returns (address);\n function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32);\n function isRegistered(address addr) external view returns (bool);\n function codeHashOf(address addr) external view returns (bytes32);\n}" }, "@nfts2me/contracts/ownable/NFTOwnableUpgradeable.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\";\n\n/// @title NFTs2Me.com Smart Contracts\n/// @author The NFTs2Me Team\n/// @notice Read our terms of service\n/// @custom:security-contact [email protected]\n/// @custom:terms-of-service https://nfts2me.com/terms-of-service/\n/// @custom:website https://nfts2me.com/\nabstract contract NFTOwnableUpgradeable is Initializable, ContextUpgradeable {\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n modifier onlyStrictOwner() {\n _checkStrictOwner();\n _;\n }\n\n modifier onlyOwnerOrN2M() {\n _checkOwnerOrN2M();\n _;\n }\n\n modifier onlyN2M() {\n _checkN2M();\n _;\n }\n\n /// @notice Returns the address of the current collection owner.\n /// @return The address of the owner.\n function owner() public view virtual returns (address);\n function _strictOwner() internal view virtual returns (address);\n function _getN2MFeeAddress() internal view virtual returns (address);\n\n function _checkOwner() internal view virtual {\n require(owner() == msg.sender, \"Ownable: caller is not the owner\");\n }\n\n function _checkStrictOwner() internal view virtual {\n require(_strictOwner() == msg.sender, \"Ownable: caller is not the owner\");\n }\n\n function _checkOwnerOrN2M() internal view virtual {\n require(owner() == msg.sender || _getN2MFeeAddress() == msg.sender, \"Ownable: caller is not the owner\");\n }\n\n function _checkN2M() internal view virtual {\n require(_getN2MFeeAddress() == msg.sender, \"Ownable: caller is not the owner\");\n }\n\n}" }, "@openzeppelin/contracts-upgradeable/governance/utils/IVotesUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (governance/utils/IVotes.sol)\npragma solidity ^0.8.0;\n\n/**\n * @dev Common interface for {ERC20Votes}, {ERC721Votes}, and other {Votes}-enabled contracts.\n *\n * _Available since v4.5._\n */\ninterface IVotesUpgradeable {\n /**\n * @dev Emitted when an account changes their delegate.\n */\n event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);\n\n /**\n * @dev Emitted when a token transfer or delegate change results in changes to a delegate's number of votes.\n */\n event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);\n\n /**\n * @dev Returns the current amount of votes that `account` has.\n */\n function getVotes(address account) external view returns (uint256);\n\n /**\n * @dev Returns the amount of votes that `account` had at the end of a past block (`blockNumber`).\n */\n function getPastVotes(address account, uint256 blockNumber) external view returns (uint256);\n\n /**\n * @dev Returns the total supply of votes available at the end of a past block (`blockNumber`).\n *\n * NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes.\n * Votes that have not been delegated are still part of total supply, even though they would not participate in a\n * vote.\n */\n function getPastTotalSupply(uint256 blockNumber) external view returns (uint256);\n\n /**\n * @dev Returns the delegate that `account` has chosen.\n */\n function delegates(address account) external view returns (address);\n\n /**\n * @dev Delegates votes from the sender to `delegatee`.\n */\n function delegate(address delegatee) external;\n\n /**\n * @dev Delegates votes from signer to `delegatee`.\n */\n function delegateBySig(\n address delegatee,\n uint256 nonce,\n uint256 expiry,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n}\n" }, "@openzeppelin/contracts-upgradeable/governance/utils/VotesUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (governance/utils/Votes.sol)\npragma solidity ^0.8.0;\n\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../utils/CountersUpgradeable.sol\";\nimport \"../../utils/CheckpointsUpgradeable.sol\";\nimport \"../../utils/cryptography/EIP712Upgradeable.sol\";\nimport \"./IVotesUpgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev This is a base abstract contract that tracks voting units, which are a measure of voting power that can be\n * transferred, and provides a system of vote delegation, where an account can delegate its voting units to a sort of\n * \"representative\" that will pool delegated voting units from different accounts and can then use it to vote in\n * decisions. In fact, voting units _must_ be delegated in order to count as actual votes, and an account has to\n * delegate those votes to itself if it wishes to participate in decisions and does not have a trusted representative.\n *\n * This contract is often combined with a token contract such that voting units correspond to token units. For an\n * example, see {ERC721Votes}.\n *\n * The full history of delegate votes is tracked on-chain so that governance protocols can consider votes as distributed\n * at a particular block number to protect against flash loans and double voting. The opt-in delegate system makes the\n * cost of this history tracking optional.\n *\n * When using this module the derived contract must implement {_getVotingUnits} (for example, make it return\n * {ERC721-balanceOf}), and can use {_transferVotingUnits} to track a change in the distribution of those units (in the\n * previous example, it would be included in {ERC721-_beforeTokenTransfer}).\n *\n * _Available since v4.5._\n */\nabstract contract VotesUpgradeable is Initializable, IVotesUpgradeable, ContextUpgradeable, EIP712Upgradeable {\n function __Votes_init() internal onlyInitializing {\n }\n\n function __Votes_init_unchained() internal onlyInitializing {\n }\n using CheckpointsUpgradeable for CheckpointsUpgradeable.History;\n using CountersUpgradeable for CountersUpgradeable.Counter;\n\n bytes32 private constant _DELEGATION_TYPEHASH =\n keccak256(\"Delegation(address delegatee,uint256 nonce,uint256 expiry)\");\n\n mapping(address => address) private _delegation;\n mapping(address => CheckpointsUpgradeable.History) private _delegateCheckpoints;\n CheckpointsUpgradeable.History private _totalCheckpoints;\n\n mapping(address => CountersUpgradeable.Counter) private _nonces;\n\n /**\n * @dev Returns the current amount of votes that `account` has.\n */\n function getVotes(address account) public view virtual override returns (uint256) {\n return _delegateCheckpoints[account].latest();\n }\n\n /**\n * @dev Returns the amount of votes that `account` had at the end of a past block (`blockNumber`).\n *\n * Requirements:\n *\n * - `blockNumber` must have been already mined\n */\n function getPastVotes(address account, uint256 blockNumber) public view virtual override returns (uint256) {\n return _delegateCheckpoints[account].getAtProbablyRecentBlock(blockNumber);\n }\n\n /**\n * @dev Returns the total supply of votes available at the end of a past block (`blockNumber`).\n *\n * NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes.\n * Votes that have not been delegated are still part of total supply, even though they would not participate in a\n * vote.\n *\n * Requirements:\n *\n * - `blockNumber` must have been already mined\n */\n function getPastTotalSupply(uint256 blockNumber) public view virtual override returns (uint256) {\n require(blockNumber < block.number, \"Votes: block not yet mined\");\n return _totalCheckpoints.getAtProbablyRecentBlock(blockNumber);\n }\n\n /**\n * @dev Returns the current total supply of votes.\n */\n function _getTotalSupply() internal view virtual returns (uint256) {\n return _totalCheckpoints.latest();\n }\n\n /**\n * @dev Returns the delegate that `account` has chosen.\n */\n function delegates(address account) public view virtual override returns (address) {\n return _delegation[account];\n }\n\n /**\n * @dev Delegates votes from the sender to `delegatee`.\n */\n function delegate(address delegatee) public virtual override {\n address account = _msgSender();\n _delegate(account, delegatee);\n }\n\n /**\n * @dev Delegates votes from signer to `delegatee`.\n */\n function delegateBySig(\n address delegatee,\n uint256 nonce,\n uint256 expiry,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public virtual override {\n require(block.timestamp <= expiry, \"Votes: signature expired\");\n address signer = ECDSAUpgradeable.recover(\n _hashTypedDataV4(keccak256(abi.encode(_DELEGATION_TYPEHASH, delegatee, nonce, expiry))),\n v,\n r,\n s\n );\n require(nonce == _useNonce(signer), \"Votes: invalid nonce\");\n _delegate(signer, delegatee);\n }\n\n /**\n * @dev Delegate all of `account`'s voting units to `delegatee`.\n *\n * Emits events {IVotes-DelegateChanged} and {IVotes-DelegateVotesChanged}.\n */\n function _delegate(address account, address delegatee) internal virtual {\n address oldDelegate = delegates(account);\n _delegation[account] = delegatee;\n\n emit DelegateChanged(account, oldDelegate, delegatee);\n _moveDelegateVotes(oldDelegate, delegatee, _getVotingUnits(account));\n }\n\n /**\n * @dev Transfers, mints, or burns voting units. To register a mint, `from` should be zero. To register a burn, `to`\n * should be zero. Total supply of voting units will be adjusted with mints and burns.\n */\n function _transferVotingUnits(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n if (from == address(0)) {\n _totalCheckpoints.push(_add, amount);\n }\n if (to == address(0)) {\n _totalCheckpoints.push(_subtract, amount);\n }\n _moveDelegateVotes(delegates(from), delegates(to), amount);\n }\n\n /**\n * @dev Moves delegated votes from one delegate to another.\n */\n function _moveDelegateVotes(\n address from,\n address to,\n uint256 amount\n ) private {\n if (from != to && amount > 0) {\n if (from != address(0)) {\n (uint256 oldValue, uint256 newValue) = _delegateCheckpoints[from].push(_subtract, amount);\n emit DelegateVotesChanged(from, oldValue, newValue);\n }\n if (to != address(0)) {\n (uint256 oldValue, uint256 newValue) = _delegateCheckpoints[to].push(_add, amount);\n emit DelegateVotesChanged(to, oldValue, newValue);\n }\n }\n }\n\n function _add(uint256 a, uint256 b) private pure returns (uint256) {\n return a + b;\n }\n\n function _subtract(uint256 a, uint256 b) private pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev Consumes a nonce.\n *\n * Returns the current value and increments nonce.\n */\n function _useNonce(address owner) internal virtual returns (uint256 current) {\n CountersUpgradeable.Counter storage nonce = _nonces[owner];\n current = nonce.current();\n nonce.increment();\n }\n\n /**\n * @dev Returns an address nonce.\n */\n function nonces(address owner) public view virtual returns (uint256) {\n return _nonces[owner].current();\n }\n\n /**\n * @dev Returns the contract's {EIP712} domain separator.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32) {\n return _domainSeparatorV4();\n }\n\n /**\n * @dev Must return the voting units held by an account.\n */\n function _getVotingUnits(address) internal view virtual returns (uint256);\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[46] private __gap;\n}\n" }, "@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Interface for the NFT Royalty Standard.\n *\n * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal\n * support for royalty payments across all NFT marketplaces and ecosystem participants.\n *\n * _Available since v4.5._\n */\ninterface IERC2981Upgradeable is IERC165Upgradeable {\n /**\n * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of\n * exchange. The royalty amount is denominated and should be paid in that same unit of exchange.\n */\n function royaltyInfo(uint256 tokenId, uint256 salePrice)\n external\n view\n returns (address receiver, uint256 royaltyAmount);\n}\n" }, "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Internal function that returns the initialized version. Returns `_initialized`\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Internal function that returns the initialized version. Returns `_initializing`\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" }, "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC1155/ERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC1155Upgradeable.sol\";\nimport \"./IERC1155ReceiverUpgradeable.sol\";\nimport \"./extensions/IERC1155MetadataURIUpgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the basic standard multi-token.\n * See https://eips.ethereum.org/EIPS/eip-1155\n * Originally based on code by Enjin: https://github.com/enjin/erc-1155\n *\n * _Available since v3.1._\n */\ncontract ERC1155Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC1155Upgradeable, IERC1155MetadataURIUpgradeable {\n using AddressUpgradeable for address;\n\n // Mapping from token ID to account balances\n mapping(uint256 => mapping(address => uint256)) private _balances;\n\n // Mapping from account to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json\n string private _uri;\n\n /**\n * @dev See {_setURI}.\n */\n function __ERC1155_init(string memory uri_) internal onlyInitializing {\n __ERC1155_init_unchained(uri_);\n }\n\n function __ERC1155_init_unchained(string memory uri_) internal onlyInitializing {\n _setURI(uri_);\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n return\n interfaceId == type(IERC1155Upgradeable).interfaceId ||\n interfaceId == type(IERC1155MetadataURIUpgradeable).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC1155MetadataURI-uri}.\n *\n * This implementation returns the same URI for *all* token types. It relies\n * on the token type ID substitution mechanism\n * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].\n *\n * Clients calling this function must replace the `\\{id\\}` substring with the\n * actual token type ID.\n */\n function uri(uint256) public view virtual override returns (string memory) {\n return _uri;\n }\n\n /**\n * @dev See {IERC1155-balanceOf}.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {\n require(account != address(0), \"ERC1155: address zero is not a valid owner\");\n return _balances[id][account];\n }\n\n /**\n * @dev See {IERC1155-balanceOfBatch}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] memory accounts, uint256[] memory ids)\n public\n view\n virtual\n override\n returns (uint256[] memory)\n {\n require(accounts.length == ids.length, \"ERC1155: accounts and ids length mismatch\");\n\n uint256[] memory batchBalances = new uint256[](accounts.length);\n\n for (uint256 i = 0; i < accounts.length; ++i) {\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\n }\n\n return batchBalances;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev See {IERC1155-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual override {\n require(\n from == _msgSender() || isApprovedForAll(from, _msgSender()),\n \"ERC1155: caller is not token owner or approved\"\n );\n _safeTransferFrom(from, to, id, amount, data);\n }\n\n /**\n * @dev See {IERC1155-safeBatchTransferFrom}.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override {\n require(\n from == _msgSender() || isApprovedForAll(from, _msgSender()),\n \"ERC1155: caller is not token owner or approved\"\n );\n _safeBatchTransferFrom(from, to, ids, amounts, data);\n }\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function _safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal virtual {\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n\n address operator = _msgSender();\n uint256[] memory ids = _asSingletonArray(id);\n uint256[] memory amounts = _asSingletonArray(amount);\n\n _beforeTokenTransfer(operator, from, to, ids, amounts, data);\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: insufficient balance for transfer\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n _balances[id][to] += amount;\n\n emit TransferSingle(operator, from, to, id, amount);\n\n _afterTokenTransfer(operator, from, to, ids, amounts, data);\n\n _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);\n }\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function _safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, from, to, ids, amounts, data);\n\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: insufficient balance for transfer\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n _balances[id][to] += amount;\n }\n\n emit TransferBatch(operator, from, to, ids, amounts);\n\n _afterTokenTransfer(operator, from, to, ids, amounts, data);\n\n _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);\n }\n\n /**\n * @dev Sets a new URI for all token types, by relying on the token type ID\n * substitution mechanism\n * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].\n *\n * By this mechanism, any occurrence of the `\\{id\\}` substring in either the\n * URI or any of the amounts in the JSON file at said URI will be replaced by\n * clients with the token type ID.\n *\n * For example, the `https://token-cdn-domain/\\{id\\}.json` URI would be\n * interpreted by clients as\n * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`\n * for token type ID 0x4cce0.\n *\n * See {uri}.\n *\n * Because these URIs cannot be meaningfully represented by the {URI} event,\n * this function emits no events.\n */\n function _setURI(string memory newuri) internal virtual {\n _uri = newuri;\n }\n\n /**\n * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function _mint(\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal virtual {\n require(to != address(0), \"ERC1155: mint to the zero address\");\n\n address operator = _msgSender();\n uint256[] memory ids = _asSingletonArray(id);\n uint256[] memory amounts = _asSingletonArray(amount);\n\n _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n _balances[id][to] += amount;\n emit TransferSingle(operator, address(0), to, id, amount);\n\n _afterTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);\n }\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function _mintBatch(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n require(to != address(0), \"ERC1155: mint to the zero address\");\n require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n for (uint256 i = 0; i < ids.length; i++) {\n _balances[ids[i]][to] += amounts[i];\n }\n\n emit TransferBatch(operator, address(0), to, ids, amounts);\n\n _afterTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);\n }\n\n /**\n * @dev Destroys `amount` tokens of token type `id` from `from`\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `from` must have at least `amount` tokens of token type `id`.\n */\n function _burn(\n address from,\n uint256 id,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC1155: burn from the zero address\");\n\n address operator = _msgSender();\n uint256[] memory ids = _asSingletonArray(id);\n uint256[] memory amounts = _asSingletonArray(amount);\n\n _beforeTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: burn amount exceeds balance\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n\n emit TransferSingle(operator, from, address(0), id, amount);\n\n _afterTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n }\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n */\n function _burnBatch(\n address from,\n uint256[] memory ids,\n uint256[] memory amounts\n ) internal virtual {\n require(from != address(0), \"ERC1155: burn from the zero address\");\n require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n\n for (uint256 i = 0; i < ids.length; i++) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: burn amount exceeds balance\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n }\n\n emit TransferBatch(operator, from, address(0), ids, amounts);\n\n _afterTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC1155: setting approval status for self\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting\n * and burning, as well as batched variants.\n *\n * The same hook is called on both single and batched variants. For single\n * transfers, the length of the `ids` and `amounts` arrays will be 1.\n *\n * Calling conditions (for each `id` and `amount` pair):\n *\n * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * of token type `id` will be transferred to `to`.\n * - When `from` is zero, `amount` tokens of token type `id` will be minted\n * for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`\n * will be burned.\n * - `from` and `to` are never both zero.\n * - `ids` and `amounts` have the same, non-zero length.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting\n * and burning, as well as batched variants.\n *\n * The same hook is called on both single and batched variants. For single\n * transfers, the length of the `id` and `amount` arrays will be 1.\n *\n * Calling conditions (for each `id` and `amount` pair):\n *\n * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * of token type `id` will be transferred to `to`.\n * - When `from` is zero, `amount` tokens of token type `id` will be minted\n * for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`\n * will be burned.\n * - `from` and `to` are never both zero.\n * - `ids` and `amounts` have the same, non-zero length.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {}\n\n function _doSafeTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try IERC1155ReceiverUpgradeable(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {\n if (response != IERC1155ReceiverUpgradeable.onERC1155Received.selector) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non-ERC1155Receiver implementer\");\n }\n }\n }\n\n function _doSafeBatchTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try IERC1155ReceiverUpgradeable(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (\n bytes4 response\n ) {\n if (response != IERC1155ReceiverUpgradeable.onERC1155BatchReceived.selector) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non-ERC1155Receiver implementer\");\n }\n }\n }\n\n function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {\n uint256[] memory array = new uint256[](1);\n array[0] = element;\n\n return array;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[47] private __gap;\n}\n" }, "@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155SupplyUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/extensions/ERC1155Supply.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC1155Upgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Extension of ERC1155 that adds tracking of total supply per id.\n *\n * Useful for scenarios where Fungible and Non-fungible tokens have to be\n * clearly identified. Note: While a totalSupply of 1 might mean the\n * corresponding is an NFT, there is no guarantees that no other token with the\n * same id are not going to be minted.\n */\nabstract contract ERC1155SupplyUpgradeable is Initializable, ERC1155Upgradeable {\n function __ERC1155Supply_init() internal onlyInitializing {\n }\n\n function __ERC1155Supply_init_unchained() internal onlyInitializing {\n }\n mapping(uint256 => uint256) private _totalSupply;\n\n /**\n * @dev Total amount of tokens in with a given id.\n */\n function totalSupply(uint256 id) public view virtual returns (uint256) {\n return _totalSupply[id];\n }\n\n /**\n * @dev Indicates whether any token exist with a given id, or not.\n */\n function exists(uint256 id) public view virtual returns (bool) {\n return ERC1155SupplyUpgradeable.totalSupply(id) > 0;\n }\n\n /**\n * @dev See {ERC1155-_beforeTokenTransfer}.\n */\n function _beforeTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual override {\n super._beforeTokenTransfer(operator, from, to, ids, amounts, data);\n\n if (from == address(0)) {\n for (uint256 i = 0; i < ids.length; ++i) {\n _totalSupply[ids[i]] += amounts[i];\n }\n }\n\n if (to == address(0)) {\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n uint256 supply = _totalSupply[id];\n require(supply >= amount, \"ERC1155: burn amount exceeds totalSupply\");\n unchecked {\n _totalSupply[id] = supply - amount;\n }\n }\n }\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" }, "@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/IERC1155MetadataURIUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155Upgradeable.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURIUpgradeable is IERC1155Upgradeable {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" }, "@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155ReceiverUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155ReceiverUpgradeable is IERC165Upgradeable {\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n *\n * NOTE: To accept the transfer, this must return\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n * (i.e. 0xf23a6e61, or its own function selector).\n *\n * @param operator The address which initiated the transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param id The ID of the token being transferred\n * @param value The amount of tokens being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\n * is called at the end of a `safeBatchTransferFrom` after the balances have\n * been updated.\n *\n * NOTE: To accept the transfer(s), this must return\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n * (i.e. 0xbc197c81, or its own function selector).\n *\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" }, "@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155Upgradeable is IERC165Upgradeable {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" }, "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" }, "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" }, "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\nimport \"../extensions/draft-IERC20PermitUpgradeable.sol\";\nimport \"../../../utils/AddressUpgradeable.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20Upgradeable {\n using AddressUpgradeable for address;\n\n function safeTransfer(\n IERC20Upgradeable token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20Upgradeable token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20PermitUpgradeable token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" }, "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721Upgradeable.sol\";\nimport \"./IERC721ReceiverUpgradeable.sol\";\nimport \"./extensions/IERC721MetadataUpgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../utils/StringsUpgradeable.sol\";\nimport \"../../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\n using AddressUpgradeable for address;\n using StringsUpgradeable for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __ERC721_init_unchained(name_, symbol_);\n }\n\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n return\n interfaceId == type(IERC721Upgradeable).interfaceId ||\n interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721Upgradeable.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256, /* firstTokenId */\n uint256 batchSize\n ) internal virtual {\n if (batchSize > 1) {\n if (from != address(0)) {\n _balances[from] -= batchSize;\n }\n if (to != address(0)) {\n _balances[to] += batchSize;\n }\n }\n }\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual {}\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[44] private __gap;\n}\n" }, "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721URIStorageUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/extensions/ERC721URIStorage.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC721Upgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev ERC721 token with storage based token URI management.\n */\nabstract contract ERC721URIStorageUpgradeable is Initializable, ERC721Upgradeable {\n function __ERC721URIStorage_init() internal onlyInitializing {\n }\n\n function __ERC721URIStorage_init_unchained() internal onlyInitializing {\n }\n using StringsUpgradeable for uint256;\n\n // Optional mapping for token URIs\n mapping(uint256 => string) private _tokenURIs;\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory _tokenURI = _tokenURIs[tokenId];\n string memory base = _baseURI();\n\n // If there is no base URI, return the token URI.\n if (bytes(base).length == 0) {\n return _tokenURI;\n }\n // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).\n if (bytes(_tokenURI).length > 0) {\n return string(abi.encodePacked(base, _tokenURI));\n }\n\n return super.tokenURI(tokenId);\n }\n\n /**\n * @dev Sets `_tokenURI` as the tokenURI of `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {\n require(_exists(tokenId), \"ERC721URIStorage: URI set of nonexistent token\");\n _tokenURIs[tokenId] = _tokenURI;\n }\n\n /**\n * @dev See {ERC721-_burn}. This override additionally checks to see if a\n * token-specific URI was set for the token, and if so, it deletes the token URI from\n * the storage mapping.\n */\n function _burn(uint256 tokenId) internal virtual override {\n super._burn(tokenId);\n\n if (bytes(_tokenURIs[tokenId]).length != 0) {\n delete _tokenURIs[tokenId];\n }\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" }, "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721VotesUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/ERC721Votes.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC721Upgradeable.sol\";\nimport \"../../../governance/utils/VotesUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Extension of ERC721 to support voting and delegation as implemented by {Votes}, where each individual NFT counts\n * as 1 vote unit.\n *\n * Tokens do not count as votes until they are delegated, because votes must be tracked which incurs an additional cost\n * on every transfer. Token holders can either delegate to a trusted representative who will decide how to make use of\n * the votes in governance decisions, or they can delegate to themselves to be their own representative.\n *\n * _Available since v4.5._\n */\nabstract contract ERC721VotesUpgradeable is Initializable, ERC721Upgradeable, VotesUpgradeable {\n function __ERC721Votes_init() internal onlyInitializing {\n }\n\n function __ERC721Votes_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {ERC721-_afterTokenTransfer}. Adjusts votes when tokens are transferred.\n *\n * Emits a {IVotes-DelegateVotesChanged} event.\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual override {\n _transferVotingUnits(from, to, batchSize);\n super._afterTokenTransfer(from, to, firstTokenId, batchSize);\n }\n\n /**\n * @dev Returns the balance of `account`.\n */\n function _getVotingUnits(address account) internal view virtual override returns (uint256) {\n return balanceOf(account);\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" }, "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721Upgradeable.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721MetadataUpgradeable is IERC721Upgradeable {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" }, "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721ReceiverUpgradeable {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" }, "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721Upgradeable is IERC165Upgradeable {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" }, "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" }, "@openzeppelin/contracts-upgradeable/utils/CheckpointsUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Checkpoints.sol)\n// This file was procedurally generated from scripts/generate/templates/Checkpoints.js.\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\nimport \"./math/SafeCastUpgradeable.sol\";\n\n/**\n * @dev This library defines the `History` struct, for checkpointing values as they change at different points in\n * time, and later looking up past values by block number. See {Votes} as an example.\n *\n * To create a history of checkpoints define a variable type `Checkpoints.History` in your contract, and store a new\n * checkpoint for the current transaction block using the {push} function.\n *\n * _Available since v4.5._\n */\nlibrary CheckpointsUpgradeable {\n struct History {\n Checkpoint[] _checkpoints;\n }\n\n struct Checkpoint {\n uint32 _blockNumber;\n uint224 _value;\n }\n\n /**\n * @dev Returns the value at a given block number. If a checkpoint is not available at that block, the closest one\n * before it is returned, or zero otherwise.\n */\n function getAtBlock(History storage self, uint256 blockNumber) internal view returns (uint256) {\n require(blockNumber < block.number, \"Checkpoints: block not yet mined\");\n uint32 key = SafeCastUpgradeable.toUint32(blockNumber);\n\n uint256 len = self._checkpoints.length;\n uint256 pos = _upperBinaryLookup(self._checkpoints, key, 0, len);\n return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;\n }\n\n /**\n * @dev Returns the value at a given block number. If a checkpoint is not available at that block, the closest one\n * before it is returned, or zero otherwise. Similar to {upperLookup} but optimized for the case when the searched\n * checkpoint is probably \"recent\", defined as being among the last sqrt(N) checkpoints where N is the number of\n * checkpoints.\n */\n function getAtProbablyRecentBlock(History storage self, uint256 blockNumber) internal view returns (uint256) {\n require(blockNumber < block.number, \"Checkpoints: block not yet mined\");\n uint32 key = SafeCastUpgradeable.toUint32(blockNumber);\n\n uint256 len = self._checkpoints.length;\n\n uint256 low = 0;\n uint256 high = len;\n\n if (len > 5) {\n uint256 mid = len - MathUpgradeable.sqrt(len);\n if (key < _unsafeAccess(self._checkpoints, mid)._blockNumber) {\n high = mid;\n } else {\n low = mid + 1;\n }\n }\n\n uint256 pos = _upperBinaryLookup(self._checkpoints, key, low, high);\n\n return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;\n }\n\n /**\n * @dev Pushes a value onto a History so that it is stored as the checkpoint for the current block.\n *\n * Returns previous value and new value.\n */\n function push(History storage self, uint256 value) internal returns (uint256, uint256) {\n return _insert(self._checkpoints, SafeCastUpgradeable.toUint32(block.number), SafeCastUpgradeable.toUint224(value));\n }\n\n /**\n * @dev Pushes a value onto a History, by updating the latest value using binary operation `op`. The new value will\n * be set to `op(latest, delta)`.\n *\n * Returns previous value and new value.\n */\n function push(\n History storage self,\n function(uint256, uint256) view returns (uint256) op,\n uint256 delta\n ) internal returns (uint256, uint256) {\n return push(self, op(latest(self), delta));\n }\n\n /**\n * @dev Returns the value in the most recent checkpoint, or zero if there are no checkpoints.\n */\n function latest(History storage self) internal view returns (uint224) {\n uint256 pos = self._checkpoints.length;\n return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;\n }\n\n /**\n * @dev Returns whether there is a checkpoint in the structure (i.e. it is not empty), and if so the key and value\n * in the most recent checkpoint.\n */\n function latestCheckpoint(History storage self)\n internal\n view\n returns (\n bool exists,\n uint32 _blockNumber,\n uint224 _value\n )\n {\n uint256 pos = self._checkpoints.length;\n if (pos == 0) {\n return (false, 0, 0);\n } else {\n Checkpoint memory ckpt = _unsafeAccess(self._checkpoints, pos - 1);\n return (true, ckpt._blockNumber, ckpt._value);\n }\n }\n\n /**\n * @dev Returns the number of checkpoint.\n */\n function length(History storage self) internal view returns (uint256) {\n return self._checkpoints.length;\n }\n\n /**\n * @dev Pushes a (`key`, `value`) pair into an ordered list of checkpoints, either by inserting a new checkpoint,\n * or by updating the last one.\n */\n function _insert(\n Checkpoint[] storage self,\n uint32 key,\n uint224 value\n ) private returns (uint224, uint224) {\n uint256 pos = self.length;\n\n if (pos > 0) {\n // Copying to memory is important here.\n Checkpoint memory last = _unsafeAccess(self, pos - 1);\n\n // Checkpoints keys must be increasing.\n require(last._blockNumber <= key, \"Checkpoint: invalid key\");\n\n // Update or push new checkpoint\n if (last._blockNumber == key) {\n _unsafeAccess(self, pos - 1)._value = value;\n } else {\n self.push(Checkpoint({_blockNumber: key, _value: value}));\n }\n return (last._value, value);\n } else {\n self.push(Checkpoint({_blockNumber: key, _value: value}));\n return (0, value);\n }\n }\n\n /**\n * @dev Return the index of the oldest checkpoint whose key is greater than the search key, or `high` if there is none.\n * `low` and `high` define a section where to do the search, with inclusive `low` and exclusive `high`.\n *\n * WARNING: `high` should not be greater than the array's length.\n */\n function _upperBinaryLookup(\n Checkpoint[] storage self,\n uint32 key,\n uint256 low,\n uint256 high\n ) private view returns (uint256) {\n while (low < high) {\n uint256 mid = MathUpgradeable.average(low, high);\n if (_unsafeAccess(self, mid)._blockNumber > key) {\n high = mid;\n } else {\n low = mid + 1;\n }\n }\n return high;\n }\n\n /**\n * @dev Return the index of the oldest checkpoint whose key is greater or equal than the search key, or `high` if there is none.\n * `low` and `high` define a section where to do the search, with inclusive `low` and exclusive `high`.\n *\n * WARNING: `high` should not be greater than the array's length.\n */\n function _lowerBinaryLookup(\n Checkpoint[] storage self,\n uint32 key,\n uint256 low,\n uint256 high\n ) private view returns (uint256) {\n while (low < high) {\n uint256 mid = MathUpgradeable.average(low, high);\n if (_unsafeAccess(self, mid)._blockNumber < key) {\n low = mid + 1;\n } else {\n high = mid;\n }\n }\n return high;\n }\n\n function _unsafeAccess(Checkpoint[] storage self, uint256 pos) private pure returns (Checkpoint storage result) {\n assembly {\n mstore(0, self.slot)\n result.slot := add(keccak256(0, 0x20), pos)\n }\n }\n\n struct Trace224 {\n Checkpoint224[] _checkpoints;\n }\n\n struct Checkpoint224 {\n uint32 _key;\n uint224 _value;\n }\n\n /**\n * @dev Pushes a (`key`, `value`) pair into a Trace224 so that it is stored as the checkpoint.\n *\n * Returns previous value and new value.\n */\n function push(\n Trace224 storage self,\n uint32 key,\n uint224 value\n ) internal returns (uint224, uint224) {\n return _insert(self._checkpoints, key, value);\n }\n\n /**\n * @dev Returns the value in the oldest checkpoint with key greater or equal than the search key, or zero if there is none.\n */\n function lowerLookup(Trace224 storage self, uint32 key) internal view returns (uint224) {\n uint256 len = self._checkpoints.length;\n uint256 pos = _lowerBinaryLookup(self._checkpoints, key, 0, len);\n return pos == len ? 0 : _unsafeAccess(self._checkpoints, pos)._value;\n }\n\n /**\n * @dev Returns the value in the most recent checkpoint with key lower or equal than the search key.\n */\n function upperLookup(Trace224 storage self, uint32 key) internal view returns (uint224) {\n uint256 len = self._checkpoints.length;\n uint256 pos = _upperBinaryLookup(self._checkpoints, key, 0, len);\n return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;\n }\n\n /**\n * @dev Returns the value in the most recent checkpoint, or zero if there are no checkpoints.\n */\n function latest(Trace224 storage self) internal view returns (uint224) {\n uint256 pos = self._checkpoints.length;\n return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;\n }\n\n /**\n * @dev Returns whether there is a checkpoint in the structure (i.e. it is not empty), and if so the key and value\n * in the most recent checkpoint.\n */\n function latestCheckpoint(Trace224 storage self)\n internal\n view\n returns (\n bool exists,\n uint32 _key,\n uint224 _value\n )\n {\n uint256 pos = self._checkpoints.length;\n if (pos == 0) {\n return (false, 0, 0);\n } else {\n Checkpoint224 memory ckpt = _unsafeAccess(self._checkpoints, pos - 1);\n return (true, ckpt._key, ckpt._value);\n }\n }\n\n /**\n * @dev Returns the number of checkpoint.\n */\n function length(Trace224 storage self) internal view returns (uint256) {\n return self._checkpoints.length;\n }\n\n /**\n * @dev Pushes a (`key`, `value`) pair into an ordered list of checkpoints, either by inserting a new checkpoint,\n * or by updating the last one.\n */\n function _insert(\n Checkpoint224[] storage self,\n uint32 key,\n uint224 value\n ) private returns (uint224, uint224) {\n uint256 pos = self.length;\n\n if (pos > 0) {\n // Copying to memory is important here.\n Checkpoint224 memory last = _unsafeAccess(self, pos - 1);\n\n // Checkpoints keys must be increasing.\n require(last._key <= key, \"Checkpoint: invalid key\");\n\n // Update or push new checkpoint\n if (last._key == key) {\n _unsafeAccess(self, pos - 1)._value = value;\n } else {\n self.push(Checkpoint224({_key: key, _value: value}));\n }\n return (last._value, value);\n } else {\n self.push(Checkpoint224({_key: key, _value: value}));\n return (0, value);\n }\n }\n\n /**\n * @dev Return the index of the oldest checkpoint whose key is greater than the search key, or `high` if there is none.\n * `low` and `high` define a section where to do the search, with inclusive `low` and exclusive `high`.\n *\n * WARNING: `high` should not be greater than the array's length.\n */\n function _upperBinaryLookup(\n Checkpoint224[] storage self,\n uint32 key,\n uint256 low,\n uint256 high\n ) private view returns (uint256) {\n while (low < high) {\n uint256 mid = MathUpgradeable.average(low, high);\n if (_unsafeAccess(self, mid)._key > key) {\n high = mid;\n } else {\n low = mid + 1;\n }\n }\n return high;\n }\n\n /**\n * @dev Return the index of the oldest checkpoint whose key is greater or equal than the search key, or `high` if there is none.\n * `low` and `high` define a section where to do the search, with inclusive `low` and exclusive `high`.\n *\n * WARNING: `high` should not be greater than the array's length.\n */\n function _lowerBinaryLookup(\n Checkpoint224[] storage self,\n uint32 key,\n uint256 low,\n uint256 high\n ) private view returns (uint256) {\n while (low < high) {\n uint256 mid = MathUpgradeable.average(low, high);\n if (_unsafeAccess(self, mid)._key < key) {\n low = mid + 1;\n } else {\n high = mid;\n }\n }\n return high;\n }\n\n function _unsafeAccess(Checkpoint224[] storage self, uint256 pos)\n private\n pure\n returns (Checkpoint224 storage result)\n {\n assembly {\n mstore(0, self.slot)\n result.slot := add(keccak256(0, 0x20), pos)\n }\n }\n\n struct Trace160 {\n Checkpoint160[] _checkpoints;\n }\n\n struct Checkpoint160 {\n uint96 _key;\n uint160 _value;\n }\n\n /**\n * @dev Pushes a (`key`, `value`) pair into a Trace160 so that it is stored as the checkpoint.\n *\n * Returns previous value and new value.\n */\n function push(\n Trace160 storage self,\n uint96 key,\n uint160 value\n ) internal returns (uint160, uint160) {\n return _insert(self._checkpoints, key, value);\n }\n\n /**\n * @dev Returns the value in the oldest checkpoint with key greater or equal than the search key, or zero if there is none.\n */\n function lowerLookup(Trace160 storage self, uint96 key) internal view returns (uint160) {\n uint256 len = self._checkpoints.length;\n uint256 pos = _lowerBinaryLookup(self._checkpoints, key, 0, len);\n return pos == len ? 0 : _unsafeAccess(self._checkpoints, pos)._value;\n }\n\n /**\n * @dev Returns the value in the most recent checkpoint with key lower or equal than the search key.\n */\n function upperLookup(Trace160 storage self, uint96 key) internal view returns (uint160) {\n uint256 len = self._checkpoints.length;\n uint256 pos = _upperBinaryLookup(self._checkpoints, key, 0, len);\n return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;\n }\n\n /**\n * @dev Returns the value in the most recent checkpoint, or zero if there are no checkpoints.\n */\n function latest(Trace160 storage self) internal view returns (uint160) {\n uint256 pos = self._checkpoints.length;\n return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;\n }\n\n /**\n * @dev Returns whether there is a checkpoint in the structure (i.e. it is not empty), and if so the key and value\n * in the most recent checkpoint.\n */\n function latestCheckpoint(Trace160 storage self)\n internal\n view\n returns (\n bool exists,\n uint96 _key,\n uint160 _value\n )\n {\n uint256 pos = self._checkpoints.length;\n if (pos == 0) {\n return (false, 0, 0);\n } else {\n Checkpoint160 memory ckpt = _unsafeAccess(self._checkpoints, pos - 1);\n return (true, ckpt._key, ckpt._value);\n }\n }\n\n /**\n * @dev Returns the number of checkpoint.\n */\n function length(Trace160 storage self) internal view returns (uint256) {\n return self._checkpoints.length;\n }\n\n /**\n * @dev Pushes a (`key`, `value`) pair into an ordered list of checkpoints, either by inserting a new checkpoint,\n * or by updating the last one.\n */\n function _insert(\n Checkpoint160[] storage self,\n uint96 key,\n uint160 value\n ) private returns (uint160, uint160) {\n uint256 pos = self.length;\n\n if (pos > 0) {\n // Copying to memory is important here.\n Checkpoint160 memory last = _unsafeAccess(self, pos - 1);\n\n // Checkpoints keys must be increasing.\n require(last._key <= key, \"Checkpoint: invalid key\");\n\n // Update or push new checkpoint\n if (last._key == key) {\n _unsafeAccess(self, pos - 1)._value = value;\n } else {\n self.push(Checkpoint160({_key: key, _value: value}));\n }\n return (last._value, value);\n } else {\n self.push(Checkpoint160({_key: key, _value: value}));\n return (0, value);\n }\n }\n\n /**\n * @dev Return the index of the oldest checkpoint whose key is greater than the search key, or `high` if there is none.\n * `low` and `high` define a section where to do the search, with inclusive `low` and exclusive `high`.\n *\n * WARNING: `high` should not be greater than the array's length.\n */\n function _upperBinaryLookup(\n Checkpoint160[] storage self,\n uint96 key,\n uint256 low,\n uint256 high\n ) private view returns (uint256) {\n while (low < high) {\n uint256 mid = MathUpgradeable.average(low, high);\n if (_unsafeAccess(self, mid)._key > key) {\n high = mid;\n } else {\n low = mid + 1;\n }\n }\n return high;\n }\n\n /**\n * @dev Return the index of the oldest checkpoint whose key is greater or equal than the search key, or `high` if there is none.\n * `low` and `high` define a section where to do the search, with inclusive `low` and exclusive `high`.\n *\n * WARNING: `high` should not be greater than the array's length.\n */\n function _lowerBinaryLookup(\n Checkpoint160[] storage self,\n uint96 key,\n uint256 low,\n uint256 high\n ) private view returns (uint256) {\n while (low < high) {\n uint256 mid = MathUpgradeable.average(low, high);\n if (_unsafeAccess(self, mid)._key < key) {\n low = mid + 1;\n } else {\n high = mid;\n }\n }\n return high;\n }\n\n function _unsafeAccess(Checkpoint160[] storage self, uint256 pos)\n private\n pure\n returns (Checkpoint160 storage result)\n {\n assembly {\n mstore(0, self.slot)\n result.slot := add(keccak256(0, 0x20), pos)\n }\n }\n}\n" }, "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" }, "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title Counters\n * @author Matt Condon (@shrugs)\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\n *\n * Include with `using Counters for Counters.Counter;`\n */\nlibrary CountersUpgradeable {\n struct Counter {\n // This variable should never be directly accessed by users of the library: interactions must be restricted to\n // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\n // this feature: see https://github.com/ethereum/solidity/issues/4637\n uint256 _value; // default: 0\n }\n\n function current(Counter storage counter) internal view returns (uint256) {\n return counter._value;\n }\n\n function increment(Counter storage counter) internal {\n unchecked {\n counter._value += 1;\n }\n }\n\n function decrement(Counter storage counter) internal {\n uint256 value = counter._value;\n require(value > 0, \"Counter: decrement overflow\");\n unchecked {\n counter._value = value - 1;\n }\n }\n\n function reset(Counter storage counter) internal {\n counter._value = 0;\n }\n}\n" }, "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../StringsUpgradeable.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSAUpgradeable {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV // Deprecated in v4.8\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", StringsUpgradeable.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" }, "@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/EIP712.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSAUpgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * _Available since v3.4._\n *\n * @custom:storage-size 52\n */\nabstract contract EIP712Upgradeable is Initializable {\n /* solhint-disable var-name-mixedcase */\n bytes32 private _HASHED_NAME;\n bytes32 private _HASHED_VERSION;\n bytes32 private constant _TYPE_HASH = keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n\n /* solhint-enable var-name-mixedcase */\n\n /**\n * @dev Initializes the domain separator and parameter caches.\n *\n * The meaning of `name` and `version` is specified in\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\n *\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n * - `version`: the current major version of the signing domain.\n *\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n * contract upgrade].\n */\n function __EIP712_init(string memory name, string memory version) internal onlyInitializing {\n __EIP712_init_unchained(name, version);\n }\n\n function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing {\n bytes32 hashedName = keccak256(bytes(name));\n bytes32 hashedVersion = keccak256(bytes(version));\n _HASHED_NAME = hashedName;\n _HASHED_VERSION = hashedVersion;\n }\n\n /**\n * @dev Returns the domain separator for the current chain.\n */\n function _domainSeparatorV4() internal view returns (bytes32) {\n return _buildDomainSeparator(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash());\n }\n\n function _buildDomainSeparator(\n bytes32 typeHash,\n bytes32 nameHash,\n bytes32 versionHash\n ) private view returns (bytes32) {\n return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));\n }\n\n /**\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n * function returns the hash of the fully encoded EIP712 message for this domain.\n *\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n *\n * ```solidity\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n * keccak256(\"Mail(address to,string contents)\"),\n * mailTo,\n * keccak256(bytes(mailContents))\n * )));\n * address signer = ECDSA.recover(digest, signature);\n * ```\n */\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n return ECDSAUpgradeable.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n\n /**\n * @dev The hash of the name parameter for the EIP712 domain.\n *\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n * are a concern.\n */\n function _EIP712NameHash() internal virtual view returns (bytes32) {\n return _HASHED_NAME;\n }\n\n /**\n * @dev The hash of the version parameter for the EIP712 domain.\n *\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n * are a concern.\n */\n function _EIP712VersionHash() internal virtual view returns (bytes32) {\n return _HASHED_VERSION;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" }, "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\n function __ERC165_init() internal onlyInitializing {\n }\n\n function __ERC165_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165Upgradeable).interfaceId;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" }, "@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165Upgradeable {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" }, "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary MathUpgradeable {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" }, "@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\n * checks.\n *\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\n * easily result in undesired exploitation or bugs, since developers usually\n * assume that overflows raise errors. `SafeCast` restores this intuition by\n * reverting the transaction when such an operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n *\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\n * all math on `uint256` and `int256` and then downcasting.\n */\nlibrary SafeCastUpgradeable {\n /**\n * @dev Returns the downcasted uint248 from uint256, reverting on\n * overflow (when the input is greater than largest uint248).\n *\n * Counterpart to Solidity's `uint248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n *\n * _Available since v4.7._\n */\n function toUint248(uint256 value) internal pure returns (uint248) {\n require(value <= type(uint248).max, \"SafeCast: value doesn't fit in 248 bits\");\n return uint248(value);\n }\n\n /**\n * @dev Returns the downcasted uint240 from uint256, reverting on\n * overflow (when the input is greater than largest uint240).\n *\n * Counterpart to Solidity's `uint240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n *\n * _Available since v4.7._\n */\n function toUint240(uint256 value) internal pure returns (uint240) {\n require(value <= type(uint240).max, \"SafeCast: value doesn't fit in 240 bits\");\n return uint240(value);\n }\n\n /**\n * @dev Returns the downcasted uint232 from uint256, reverting on\n * overflow (when the input is greater than largest uint232).\n *\n * Counterpart to Solidity's `uint232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n *\n * _Available since v4.7._\n */\n function toUint232(uint256 value) internal pure returns (uint232) {\n require(value <= type(uint232).max, \"SafeCast: value doesn't fit in 232 bits\");\n return uint232(value);\n }\n\n /**\n * @dev Returns the downcasted uint224 from uint256, reverting on\n * overflow (when the input is greater than largest uint224).\n *\n * Counterpart to Solidity's `uint224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n *\n * _Available since v4.2._\n */\n function toUint224(uint256 value) internal pure returns (uint224) {\n require(value <= type(uint224).max, \"SafeCast: value doesn't fit in 224 bits\");\n return uint224(value);\n }\n\n /**\n * @dev Returns the downcasted uint216 from uint256, reverting on\n * overflow (when the input is greater than largest uint216).\n *\n * Counterpart to Solidity's `uint216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n *\n * _Available since v4.7._\n */\n function toUint216(uint256 value) internal pure returns (uint216) {\n require(value <= type(uint216).max, \"SafeCast: value doesn't fit in 216 bits\");\n return uint216(value);\n }\n\n /**\n * @dev Returns the downcasted uint208 from uint256, reverting on\n * overflow (when the input is greater than largest uint208).\n *\n * Counterpart to Solidity's `uint208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n *\n * _Available since v4.7._\n */\n function toUint208(uint256 value) internal pure returns (uint208) {\n require(value <= type(uint208).max, \"SafeCast: value doesn't fit in 208 bits\");\n return uint208(value);\n }\n\n /**\n * @dev Returns the downcasted uint200 from uint256, reverting on\n * overflow (when the input is greater than largest uint200).\n *\n * Counterpart to Solidity's `uint200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n *\n * _Available since v4.7._\n */\n function toUint200(uint256 value) internal pure returns (uint200) {\n require(value <= type(uint200).max, \"SafeCast: value doesn't fit in 200 bits\");\n return uint200(value);\n }\n\n /**\n * @dev Returns the downcasted uint192 from uint256, reverting on\n * overflow (when the input is greater than largest uint192).\n *\n * Counterpart to Solidity's `uint192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n *\n * _Available since v4.7._\n */\n function toUint192(uint256 value) internal pure returns (uint192) {\n require(value <= type(uint192).max, \"SafeCast: value doesn't fit in 192 bits\");\n return uint192(value);\n }\n\n /**\n * @dev Returns the downcasted uint184 from uint256, reverting on\n * overflow (when the input is greater than largest uint184).\n *\n * Counterpart to Solidity's `uint184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n *\n * _Available since v4.7._\n */\n function toUint184(uint256 value) internal pure returns (uint184) {\n require(value <= type(uint184).max, \"SafeCast: value doesn't fit in 184 bits\");\n return uint184(value);\n }\n\n /**\n * @dev Returns the downcasted uint176 from uint256, reverting on\n * overflow (when the input is greater than largest uint176).\n *\n * Counterpart to Solidity's `uint176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n *\n * _Available since v4.7._\n */\n function toUint176(uint256 value) internal pure returns (uint176) {\n require(value <= type(uint176).max, \"SafeCast: value doesn't fit in 176 bits\");\n return uint176(value);\n }\n\n /**\n * @dev Returns the downcasted uint168 from uint256, reverting on\n * overflow (when the input is greater than largest uint168).\n *\n * Counterpart to Solidity's `uint168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n *\n * _Available since v4.7._\n */\n function toUint168(uint256 value) internal pure returns (uint168) {\n require(value <= type(uint168).max, \"SafeCast: value doesn't fit in 168 bits\");\n return uint168(value);\n }\n\n /**\n * @dev Returns the downcasted uint160 from uint256, reverting on\n * overflow (when the input is greater than largest uint160).\n *\n * Counterpart to Solidity's `uint160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n *\n * _Available since v4.7._\n */\n function toUint160(uint256 value) internal pure returns (uint160) {\n require(value <= type(uint160).max, \"SafeCast: value doesn't fit in 160 bits\");\n return uint160(value);\n }\n\n /**\n * @dev Returns the downcasted uint152 from uint256, reverting on\n * overflow (when the input is greater than largest uint152).\n *\n * Counterpart to Solidity's `uint152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n *\n * _Available since v4.7._\n */\n function toUint152(uint256 value) internal pure returns (uint152) {\n require(value <= type(uint152).max, \"SafeCast: value doesn't fit in 152 bits\");\n return uint152(value);\n }\n\n /**\n * @dev Returns the downcasted uint144 from uint256, reverting on\n * overflow (when the input is greater than largest uint144).\n *\n * Counterpart to Solidity's `uint144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n *\n * _Available since v4.7._\n */\n function toUint144(uint256 value) internal pure returns (uint144) {\n require(value <= type(uint144).max, \"SafeCast: value doesn't fit in 144 bits\");\n return uint144(value);\n }\n\n /**\n * @dev Returns the downcasted uint136 from uint256, reverting on\n * overflow (when the input is greater than largest uint136).\n *\n * Counterpart to Solidity's `uint136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n *\n * _Available since v4.7._\n */\n function toUint136(uint256 value) internal pure returns (uint136) {\n require(value <= type(uint136).max, \"SafeCast: value doesn't fit in 136 bits\");\n return uint136(value);\n }\n\n /**\n * @dev Returns the downcasted uint128 from uint256, reverting on\n * overflow (when the input is greater than largest uint128).\n *\n * Counterpart to Solidity's `uint128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n *\n * _Available since v2.5._\n */\n function toUint128(uint256 value) internal pure returns (uint128) {\n require(value <= type(uint128).max, \"SafeCast: value doesn't fit in 128 bits\");\n return uint128(value);\n }\n\n /**\n * @dev Returns the downcasted uint120 from uint256, reverting on\n * overflow (when the input is greater than largest uint120).\n *\n * Counterpart to Solidity's `uint120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n *\n * _Available since v4.7._\n */\n function toUint120(uint256 value) internal pure returns (uint120) {\n require(value <= type(uint120).max, \"SafeCast: value doesn't fit in 120 bits\");\n return uint120(value);\n }\n\n /**\n * @dev Returns the downcasted uint112 from uint256, reverting on\n * overflow (when the input is greater than largest uint112).\n *\n * Counterpart to Solidity's `uint112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n *\n * _Available since v4.7._\n */\n function toUint112(uint256 value) internal pure returns (uint112) {\n require(value <= type(uint112).max, \"SafeCast: value doesn't fit in 112 bits\");\n return uint112(value);\n }\n\n /**\n * @dev Returns the downcasted uint104 from uint256, reverting on\n * overflow (when the input is greater than largest uint104).\n *\n * Counterpart to Solidity's `uint104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n *\n * _Available since v4.7._\n */\n function toUint104(uint256 value) internal pure returns (uint104) {\n require(value <= type(uint104).max, \"SafeCast: value doesn't fit in 104 bits\");\n return uint104(value);\n }\n\n /**\n * @dev Returns the downcasted uint96 from uint256, reverting on\n * overflow (when the input is greater than largest uint96).\n *\n * Counterpart to Solidity's `uint96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n *\n * _Available since v4.2._\n */\n function toUint96(uint256 value) internal pure returns (uint96) {\n require(value <= type(uint96).max, \"SafeCast: value doesn't fit in 96 bits\");\n return uint96(value);\n }\n\n /**\n * @dev Returns the downcasted uint88 from uint256, reverting on\n * overflow (when the input is greater than largest uint88).\n *\n * Counterpart to Solidity's `uint88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n *\n * _Available since v4.7._\n */\n function toUint88(uint256 value) internal pure returns (uint88) {\n require(value <= type(uint88).max, \"SafeCast: value doesn't fit in 88 bits\");\n return uint88(value);\n }\n\n /**\n * @dev Returns the downcasted uint80 from uint256, reverting on\n * overflow (when the input is greater than largest uint80).\n *\n * Counterpart to Solidity's `uint80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n *\n * _Available since v4.7._\n */\n function toUint80(uint256 value) internal pure returns (uint80) {\n require(value <= type(uint80).max, \"SafeCast: value doesn't fit in 80 bits\");\n return uint80(value);\n }\n\n /**\n * @dev Returns the downcasted uint72 from uint256, reverting on\n * overflow (when the input is greater than largest uint72).\n *\n * Counterpart to Solidity's `uint72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n *\n * _Available since v4.7._\n */\n function toUint72(uint256 value) internal pure returns (uint72) {\n require(value <= type(uint72).max, \"SafeCast: value doesn't fit in 72 bits\");\n return uint72(value);\n }\n\n /**\n * @dev Returns the downcasted uint64 from uint256, reverting on\n * overflow (when the input is greater than largest uint64).\n *\n * Counterpart to Solidity's `uint64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n *\n * _Available since v2.5._\n */\n function toUint64(uint256 value) internal pure returns (uint64) {\n require(value <= type(uint64).max, \"SafeCast: value doesn't fit in 64 bits\");\n return uint64(value);\n }\n\n /**\n * @dev Returns the downcasted uint56 from uint256, reverting on\n * overflow (when the input is greater than largest uint56).\n *\n * Counterpart to Solidity's `uint56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n *\n * _Available since v4.7._\n */\n function toUint56(uint256 value) internal pure returns (uint56) {\n require(value <= type(uint56).max, \"SafeCast: value doesn't fit in 56 bits\");\n return uint56(value);\n }\n\n /**\n * @dev Returns the downcasted uint48 from uint256, reverting on\n * overflow (when the input is greater than largest uint48).\n *\n * Counterpart to Solidity's `uint48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n *\n * _Available since v4.7._\n */\n function toUint48(uint256 value) internal pure returns (uint48) {\n require(value <= type(uint48).max, \"SafeCast: value doesn't fit in 48 bits\");\n return uint48(value);\n }\n\n /**\n * @dev Returns the downcasted uint40 from uint256, reverting on\n * overflow (when the input is greater than largest uint40).\n *\n * Counterpart to Solidity's `uint40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n *\n * _Available since v4.7._\n */\n function toUint40(uint256 value) internal pure returns (uint40) {\n require(value <= type(uint40).max, \"SafeCast: value doesn't fit in 40 bits\");\n return uint40(value);\n }\n\n /**\n * @dev Returns the downcasted uint32 from uint256, reverting on\n * overflow (when the input is greater than largest uint32).\n *\n * Counterpart to Solidity's `uint32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n *\n * _Available since v2.5._\n */\n function toUint32(uint256 value) internal pure returns (uint32) {\n require(value <= type(uint32).max, \"SafeCast: value doesn't fit in 32 bits\");\n return uint32(value);\n }\n\n /**\n * @dev Returns the downcasted uint24 from uint256, reverting on\n * overflow (when the input is greater than largest uint24).\n *\n * Counterpart to Solidity's `uint24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n *\n * _Available since v4.7._\n */\n function toUint24(uint256 value) internal pure returns (uint24) {\n require(value <= type(uint24).max, \"SafeCast: value doesn't fit in 24 bits\");\n return uint24(value);\n }\n\n /**\n * @dev Returns the downcasted uint16 from uint256, reverting on\n * overflow (when the input is greater than largest uint16).\n *\n * Counterpart to Solidity's `uint16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n *\n * _Available since v2.5._\n */\n function toUint16(uint256 value) internal pure returns (uint16) {\n require(value <= type(uint16).max, \"SafeCast: value doesn't fit in 16 bits\");\n return uint16(value);\n }\n\n /**\n * @dev Returns the downcasted uint8 from uint256, reverting on\n * overflow (when the input is greater than largest uint8).\n *\n * Counterpart to Solidity's `uint8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n *\n * _Available since v2.5._\n */\n function toUint8(uint256 value) internal pure returns (uint8) {\n require(value <= type(uint8).max, \"SafeCast: value doesn't fit in 8 bits\");\n return uint8(value);\n }\n\n /**\n * @dev Converts a signed int256 into an unsigned uint256.\n *\n * Requirements:\n *\n * - input must be greater than or equal to 0.\n *\n * _Available since v3.0._\n */\n function toUint256(int256 value) internal pure returns (uint256) {\n require(value >= 0, \"SafeCast: value must be positive\");\n return uint256(value);\n }\n\n /**\n * @dev Returns the downcasted int248 from int256, reverting on\n * overflow (when the input is less than smallest int248 or\n * greater than largest int248).\n *\n * Counterpart to Solidity's `int248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n *\n * _Available since v4.7._\n */\n function toInt248(int256 value) internal pure returns (int248 downcasted) {\n downcasted = int248(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 248 bits\");\n }\n\n /**\n * @dev Returns the downcasted int240 from int256, reverting on\n * overflow (when the input is less than smallest int240 or\n * greater than largest int240).\n *\n * Counterpart to Solidity's `int240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n *\n * _Available since v4.7._\n */\n function toInt240(int256 value) internal pure returns (int240 downcasted) {\n downcasted = int240(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 240 bits\");\n }\n\n /**\n * @dev Returns the downcasted int232 from int256, reverting on\n * overflow (when the input is less than smallest int232 or\n * greater than largest int232).\n *\n * Counterpart to Solidity's `int232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n *\n * _Available since v4.7._\n */\n function toInt232(int256 value) internal pure returns (int232 downcasted) {\n downcasted = int232(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 232 bits\");\n }\n\n /**\n * @dev Returns the downcasted int224 from int256, reverting on\n * overflow (when the input is less than smallest int224 or\n * greater than largest int224).\n *\n * Counterpart to Solidity's `int224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n *\n * _Available since v4.7._\n */\n function toInt224(int256 value) internal pure returns (int224 downcasted) {\n downcasted = int224(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 224 bits\");\n }\n\n /**\n * @dev Returns the downcasted int216 from int256, reverting on\n * overflow (when the input is less than smallest int216 or\n * greater than largest int216).\n *\n * Counterpart to Solidity's `int216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n *\n * _Available since v4.7._\n */\n function toInt216(int256 value) internal pure returns (int216 downcasted) {\n downcasted = int216(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 216 bits\");\n }\n\n /**\n * @dev Returns the downcasted int208 from int256, reverting on\n * overflow (when the input is less than smallest int208 or\n * greater than largest int208).\n *\n * Counterpart to Solidity's `int208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n *\n * _Available since v4.7._\n */\n function toInt208(int256 value) internal pure returns (int208 downcasted) {\n downcasted = int208(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 208 bits\");\n }\n\n /**\n * @dev Returns the downcasted int200 from int256, reverting on\n * overflow (when the input is less than smallest int200 or\n * greater than largest int200).\n *\n * Counterpart to Solidity's `int200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n *\n * _Available since v4.7._\n */\n function toInt200(int256 value) internal pure returns (int200 downcasted) {\n downcasted = int200(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 200 bits\");\n }\n\n /**\n * @dev Returns the downcasted int192 from int256, reverting on\n * overflow (when the input is less than smallest int192 or\n * greater than largest int192).\n *\n * Counterpart to Solidity's `int192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n *\n * _Available since v4.7._\n */\n function toInt192(int256 value) internal pure returns (int192 downcasted) {\n downcasted = int192(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 192 bits\");\n }\n\n /**\n * @dev Returns the downcasted int184 from int256, reverting on\n * overflow (when the input is less than smallest int184 or\n * greater than largest int184).\n *\n * Counterpart to Solidity's `int184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n *\n * _Available since v4.7._\n */\n function toInt184(int256 value) internal pure returns (int184 downcasted) {\n downcasted = int184(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 184 bits\");\n }\n\n /**\n * @dev Returns the downcasted int176 from int256, reverting on\n * overflow (when the input is less than smallest int176 or\n * greater than largest int176).\n *\n * Counterpart to Solidity's `int176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n *\n * _Available since v4.7._\n */\n function toInt176(int256 value) internal pure returns (int176 downcasted) {\n downcasted = int176(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 176 bits\");\n }\n\n /**\n * @dev Returns the downcasted int168 from int256, reverting on\n * overflow (when the input is less than smallest int168 or\n * greater than largest int168).\n *\n * Counterpart to Solidity's `int168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n *\n * _Available since v4.7._\n */\n function toInt168(int256 value) internal pure returns (int168 downcasted) {\n downcasted = int168(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 168 bits\");\n }\n\n /**\n * @dev Returns the downcasted int160 from int256, reverting on\n * overflow (when the input is less than smallest int160 or\n * greater than largest int160).\n *\n * Counterpart to Solidity's `int160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n *\n * _Available since v4.7._\n */\n function toInt160(int256 value) internal pure returns (int160 downcasted) {\n downcasted = int160(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 160 bits\");\n }\n\n /**\n * @dev Returns the downcasted int152 from int256, reverting on\n * overflow (when the input is less than smallest int152 or\n * greater than largest int152).\n *\n * Counterpart to Solidity's `int152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n *\n * _Available since v4.7._\n */\n function toInt152(int256 value) internal pure returns (int152 downcasted) {\n downcasted = int152(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 152 bits\");\n }\n\n /**\n * @dev Returns the downcasted int144 from int256, reverting on\n * overflow (when the input is less than smallest int144 or\n * greater than largest int144).\n *\n * Counterpart to Solidity's `int144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n *\n * _Available since v4.7._\n */\n function toInt144(int256 value) internal pure returns (int144 downcasted) {\n downcasted = int144(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 144 bits\");\n }\n\n /**\n * @dev Returns the downcasted int136 from int256, reverting on\n * overflow (when the input is less than smallest int136 or\n * greater than largest int136).\n *\n * Counterpart to Solidity's `int136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n *\n * _Available since v4.7._\n */\n function toInt136(int256 value) internal pure returns (int136 downcasted) {\n downcasted = int136(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 136 bits\");\n }\n\n /**\n * @dev Returns the downcasted int128 from int256, reverting on\n * overflow (when the input is less than smallest int128 or\n * greater than largest int128).\n *\n * Counterpart to Solidity's `int128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n *\n * _Available since v3.1._\n */\n function toInt128(int256 value) internal pure returns (int128 downcasted) {\n downcasted = int128(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 128 bits\");\n }\n\n /**\n * @dev Returns the downcasted int120 from int256, reverting on\n * overflow (when the input is less than smallest int120 or\n * greater than largest int120).\n *\n * Counterpart to Solidity's `int120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n *\n * _Available since v4.7._\n */\n function toInt120(int256 value) internal pure returns (int120 downcasted) {\n downcasted = int120(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 120 bits\");\n }\n\n /**\n * @dev Returns the downcasted int112 from int256, reverting on\n * overflow (when the input is less than smallest int112 or\n * greater than largest int112).\n *\n * Counterpart to Solidity's `int112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n *\n * _Available since v4.7._\n */\n function toInt112(int256 value) internal pure returns (int112 downcasted) {\n downcasted = int112(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 112 bits\");\n }\n\n /**\n * @dev Returns the downcasted int104 from int256, reverting on\n * overflow (when the input is less than smallest int104 or\n * greater than largest int104).\n *\n * Counterpart to Solidity's `int104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n *\n * _Available since v4.7._\n */\n function toInt104(int256 value) internal pure returns (int104 downcasted) {\n downcasted = int104(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 104 bits\");\n }\n\n /**\n * @dev Returns the downcasted int96 from int256, reverting on\n * overflow (when the input is less than smallest int96 or\n * greater than largest int96).\n *\n * Counterpart to Solidity's `int96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n *\n * _Available since v4.7._\n */\n function toInt96(int256 value) internal pure returns (int96 downcasted) {\n downcasted = int96(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 96 bits\");\n }\n\n /**\n * @dev Returns the downcasted int88 from int256, reverting on\n * overflow (when the input is less than smallest int88 or\n * greater than largest int88).\n *\n * Counterpart to Solidity's `int88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n *\n * _Available since v4.7._\n */\n function toInt88(int256 value) internal pure returns (int88 downcasted) {\n downcasted = int88(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 88 bits\");\n }\n\n /**\n * @dev Returns the downcasted int80 from int256, reverting on\n * overflow (when the input is less than smallest int80 or\n * greater than largest int80).\n *\n * Counterpart to Solidity's `int80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n *\n * _Available since v4.7._\n */\n function toInt80(int256 value) internal pure returns (int80 downcasted) {\n downcasted = int80(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 80 bits\");\n }\n\n /**\n * @dev Returns the downcasted int72 from int256, reverting on\n * overflow (when the input is less than smallest int72 or\n * greater than largest int72).\n *\n * Counterpart to Solidity's `int72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n *\n * _Available since v4.7._\n */\n function toInt72(int256 value) internal pure returns (int72 downcasted) {\n downcasted = int72(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 72 bits\");\n }\n\n /**\n * @dev Returns the downcasted int64 from int256, reverting on\n * overflow (when the input is less than smallest int64 or\n * greater than largest int64).\n *\n * Counterpart to Solidity's `int64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n *\n * _Available since v3.1._\n */\n function toInt64(int256 value) internal pure returns (int64 downcasted) {\n downcasted = int64(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 64 bits\");\n }\n\n /**\n * @dev Returns the downcasted int56 from int256, reverting on\n * overflow (when the input is less than smallest int56 or\n * greater than largest int56).\n *\n * Counterpart to Solidity's `int56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n *\n * _Available since v4.7._\n */\n function toInt56(int256 value) internal pure returns (int56 downcasted) {\n downcasted = int56(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 56 bits\");\n }\n\n /**\n * @dev Returns the downcasted int48 from int256, reverting on\n * overflow (when the input is less than smallest int48 or\n * greater than largest int48).\n *\n * Counterpart to Solidity's `int48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n *\n * _Available since v4.7._\n */\n function toInt48(int256 value) internal pure returns (int48 downcasted) {\n downcasted = int48(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 48 bits\");\n }\n\n /**\n * @dev Returns the downcasted int40 from int256, reverting on\n * overflow (when the input is less than smallest int40 or\n * greater than largest int40).\n *\n * Counterpart to Solidity's `int40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n *\n * _Available since v4.7._\n */\n function toInt40(int256 value) internal pure returns (int40 downcasted) {\n downcasted = int40(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 40 bits\");\n }\n\n /**\n * @dev Returns the downcasted int32 from int256, reverting on\n * overflow (when the input is less than smallest int32 or\n * greater than largest int32).\n *\n * Counterpart to Solidity's `int32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n *\n * _Available since v3.1._\n */\n function toInt32(int256 value) internal pure returns (int32 downcasted) {\n downcasted = int32(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 32 bits\");\n }\n\n /**\n * @dev Returns the downcasted int24 from int256, reverting on\n * overflow (when the input is less than smallest int24 or\n * greater than largest int24).\n *\n * Counterpart to Solidity's `int24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n *\n * _Available since v4.7._\n */\n function toInt24(int256 value) internal pure returns (int24 downcasted) {\n downcasted = int24(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 24 bits\");\n }\n\n /**\n * @dev Returns the downcasted int16 from int256, reverting on\n * overflow (when the input is less than smallest int16 or\n * greater than largest int16).\n *\n * Counterpart to Solidity's `int16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n *\n * _Available since v3.1._\n */\n function toInt16(int256 value) internal pure returns (int16 downcasted) {\n downcasted = int16(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 16 bits\");\n }\n\n /**\n * @dev Returns the downcasted int8 from int256, reverting on\n * overflow (when the input is less than smallest int8 or\n * greater than largest int8).\n *\n * Counterpart to Solidity's `int8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n *\n * _Available since v3.1._\n */\n function toInt8(int256 value) internal pure returns (int8 downcasted) {\n downcasted = int8(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 8 bits\");\n }\n\n /**\n * @dev Converts an unsigned uint256 into a signed int256.\n *\n * Requirements:\n *\n * - input must be less than or equal to maxInt256.\n *\n * _Available since v3.0._\n */\n function toInt256(uint256 value) internal pure returns (int256) {\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\n require(value <= uint256(type(int256).max), \"SafeCast: value doesn't fit in an int256\");\n return int256(value);\n }\n}\n" }, "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = MathUpgradeable.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, MathUpgradeable.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" }, "@openzeppelin/contracts/governance/utils/IVotes.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (governance/utils/IVotes.sol)\npragma solidity ^0.8.0;\n\n/**\n * @dev Common interface for {ERC20Votes}, {ERC721Votes}, and other {Votes}-enabled contracts.\n *\n * _Available since v4.5._\n */\ninterface IVotes {\n /**\n * @dev Emitted when an account changes their delegate.\n */\n event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);\n\n /**\n * @dev Emitted when a token transfer or delegate change results in changes to a delegate's number of votes.\n */\n event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);\n\n /**\n * @dev Returns the current amount of votes that `account` has.\n */\n function getVotes(address account) external view returns (uint256);\n\n /**\n * @dev Returns the amount of votes that `account` had at the end of a past block (`blockNumber`).\n */\n function getPastVotes(address account, uint256 blockNumber) external view returns (uint256);\n\n /**\n * @dev Returns the total supply of votes available at the end of a past block (`blockNumber`).\n *\n * NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes.\n * Votes that have not been delegated are still part of total supply, even though they would not participate in a\n * vote.\n */\n function getPastTotalSupply(uint256 blockNumber) external view returns (uint256);\n\n /**\n * @dev Returns the delegate that `account` has chosen.\n */\n function delegates(address account) external view returns (address);\n\n /**\n * @dev Delegates votes from the sender to `delegatee`.\n */\n function delegate(address delegatee) external;\n\n /**\n * @dev Delegates votes from signer to `delegatee`.\n */\n function delegateBySig(\n address delegatee,\n uint256 nonce,\n uint256 expiry,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n}\n" }, "@openzeppelin/contracts/proxy/Proxy.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\n * be specified by overriding the virtual {_implementation} function.\n *\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\n * different contract through the {_delegate} function.\n *\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\n */\nabstract contract Proxy {\n /**\n * @dev Delegates the current call to `implementation`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _delegate(address implementation) internal virtual {\n assembly {\n // Copy msg.data. We take full control of memory in this inline assembly\n // block because it will not return to Solidity code. We overwrite the\n // Solidity scratch pad at memory position 0.\n calldatacopy(0, 0, calldatasize())\n\n // Call the implementation.\n // out and outsize are 0 because we don't know the size yet.\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n // Copy the returned data.\n returndatacopy(0, 0, returndatasize())\n\n switch result\n // delegatecall returns 0 on error.\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n /**\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\n * and {_fallback} should delegate.\n */\n function _implementation() internal view virtual returns (address);\n\n /**\n * @dev Delegates the current call to the address returned by `_implementation()`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _fallback() internal virtual {\n _beforeFallback();\n _delegate(_implementation());\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n * function in the contract matches the call data.\n */\n fallback() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\n * is empty.\n */\n receive() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\n * call, or as part of the Solidity `fallback` or `receive` functions.\n *\n * If overridden should call `super._beforeFallback()`.\n */\n function _beforeFallback() internal virtual {}\n}\n" }, "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURI is IERC1155 {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" }, "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" }, "@openzeppelin/contracts/token/ERC20/IERC20.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" }, "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" }, "@openzeppelin/contracts/token/ERC721/IERC721.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" }, "@openzeppelin/contracts/utils/introspection/IERC165.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" }, "contracts/beacon/N2MERC1155Upgradeable.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * ----------------------------------------------------------------------------- */\n\n// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"./N2MUpgradeable.sol\";\n\ncontract N2MERC1155Upgradeable is N2MUpgradeable {\n constructor(address factoryAddress) N2MUpgradeable(factoryAddress) {}\n\n function _implementation() internal view override returns (address) {\n return IN2MBeaconFactory(FACTORY_ADDRESS).getERC1155Implementation();\n }\n}\n" }, "contracts/beacon/N2MERC721Upgradeable.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"./N2MUpgradeable.sol\";\n\ncontract N2MERC721Upgradeable is N2MUpgradeable {\n constructor(address factoryAddress) N2MUpgradeable(factoryAddress) {}\n\n function _implementation() internal view override returns (address) {\n return IN2MBeaconFactory(FACTORY_ADDRESS).getERC721Implementation();\n }\n}\n" }, "contracts/beacon/N2MUpgradeable.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"@nfts2me/contracts/important/README.sol\";\nimport \"@nfts2me/contracts/interfaces/IN2MBeaconFactory.sol\";\nimport \"@openzeppelin/contracts/proxy/Proxy.sol\";\nimport \"../N2MVersion.sol\";\n\nabstract contract N2MUpgradeable is Proxy {\n address internal immutable FACTORY_ADDRESS;\n\n constructor(address factoryAddress) {\n FACTORY_ADDRESS = factoryAddress;\n }\n\n function n2mVersions() external view returns (uint256 implementationVersion, uint256 beaconVersion) {\n implementationVersion = N2MVersion(address(this)).n2mVersion();\n beaconVersion = 1000;\n }\n}\n" }, "contracts/interfaces/IN2M_ERCBase.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol\";\nimport \"./IN2M_ERCStorage.sol\";\n\ninterface IN2M_ERCBase is IERC2981Upgradeable, IN2M_ERCStorage {\n /// @notice To be called to create the collection. Can only be called once.\n function initialize\n (\n string memory tokenName,\n string memory tokenSymbol,\n uint256 iMintPrice,\n bytes32 baseURICIDHash,\n bytes32 placeholderImageCIDHash,\n RevenueAddress[] calldata revenueAddresses,\n address iErc20PaymentAddress,\n uint32 iTotalSupply,\n uint16 iRoyaltyFee,\n bool soulboundCollection,\n MintingType iMintingType\n ) external payable;\n\n /// @notice A descriptive name for a collection of NFTs in this contract\n function name() external view returns (string memory);\n\n /// @notice An abbreviated name for NFTs in this contract\n /// @return the collection symbol\n function symbol() external view returns (string memory);\n\n /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.\n /// @dev Throws if `_tokenId` is not a valid NFT. URIs are defined in RFC\n /// 3986. The URI may point to a JSON file that conforms to the \"ERC721\n /// Metadata JSON Schema\".\n function tokenURI(uint256 tokenId) external view returns (string memory);\n\n /// @notice Mints one NFT to the caller (msg.sender). Requires `minting type` to be `sequential` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n function mint() external payable;\n\n /// @notice Mints `amount` NFTs to the caller (msg.sender). Requires `minting type` to be `sequential` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n /// @param amount The number of NFTs to mint\n function mint(uint256 amount) external payable;\n\n /// @notice Mints `amount` NFTs to the caller (msg.sender) with a given `affiliate`. Requires `minting type` to be `sequential` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n /// @param amount The number of NFTs to mint\n /// @param affiliate The affiliate address\n function mint(uint256 amount, address affiliate) external payable;\n\n /// @notice Mints `amount` NFTs to `to` address. Requires `minting type` to be `sequential` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n /// @param to The address of the NFTs receiver\n /// @param amount The number of NFTs to mint \n function mintTo(address to, uint256 amount) external payable;\n\n /// @notice Mints `amount` NFTs to `to` address with a given `affiliate`. Requires `minting type` to be `sequential` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n /// @param to The address of the NFTs receiver\n /// @param amount The number of NFTs to mint \n /// @param affiliate The affiliate address\n function mintTo(address to, uint256 amount, address affiliate) external payable;\n\n /// @notice Two phases on-chain random minting. Mints `amount` NFTs tickets to `to` address. Requires `minting type` to be `random` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment). Once minted, those tickets must be redeemed for an actual token calling `redeemRandom()`.\n /// @param to The address of the NFTs receiver\n /// @param amount The number of NFTs to mint \n function mintRandomTo(address to, uint256 amount) external payable; \n\n /// @notice Two phases on-chain random minting. Mints `amount` NFTs tickets to `to` address with a given `affiliate`. Requires `minting type` to be `random` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment). Once minted, those tickets must be redeemed for an actual token calling `redeemRandom()`.\n /// @param to The address of the NFTs receiver\n /// @param amount The number of NFTs to mint \n /// @param affiliate The affiliate address\n function mintRandomTo(address to, uint256 amount, address affiliate) external payable;\n\n /// @notice Redeems remaining random tickets generated from `msg.sender` by calling `mintRandomTo` for actual NFTs.\n function redeemRandom() external payable;\n\n /// @notice Mints `amount` NFTs to `to` address. Requires `minting type` to be `specify` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n /// @param to The address of the NFTs receiver\n /// @param tokenIds An array of the specified tokens. They must not be minted, otherwise, it will revert.\n function mintSpecifyTo(address to, uint256[] memory tokenIds) external payable; \n\n /// @notice Mints `amount` NFTs to `to` address with a given `affiliate`. Requires `minting type` to be `specify` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n /// @param to The address of the NFTs receiver\n /// @param tokenIds An array of the specified tokens. They must not be minted, otherwise, it will revert.\n /// @param affiliate The affiliate address\n function mintSpecifyTo(address to, uint256[] memory tokenIds, address affiliate) external payable; \n\n /// @notice Mints one NFT to `to` address. Requires `minting type` to be `customURI`.\n /// @param to The address of the NFTs receiver\n /// @param customURICIDHash The CID of the given token.\n /// @param soulbound True if the NFT is a Soulbound Token (SBT). If set, it can't be transferred.\n function mintCustomURITo(address to, bytes32 customURICIDHash, bool soulbound) external payable;\n\n /// @notice Only owner can call this function. Free of charge. Mints sizeof(`to`) to `to` addresses. Requires `minting type` to be `sequential`.\n /// @param to The addresses of the NFTs receivers\n /// @param soulbound True if the NFT is a Soulbound Token (SBT). If set, it can't be transferred.\n function airdropSequential(address[] memory to, bool soulbound) external payable;\n\n /// @notice Only owner can call this function. Free of charge. Mints sizeof(`to`) to `to` addresses with random tokenIds. Requires `minting type` to be `random`.\n /// @param to The addresses of the NFTs receivers\n /// @param soulbound True if the NFT is a Soulbound Token (SBT). If set, it can't be transferred.\n function airdropRandom(address[] memory to, bool soulbound) external payable;\n\n /// @notice Only owner can call this function. Free of charge. Mints sizeof(`to`) to `to` addresses with specified tokenIds. Requires `minting type` to be `specify`.\n /// @param to The addresses of the NFTs receivers\n /// @param tokenIds An array of the specified tokens. They must not be minted, otherwise, it will revert.\n /// @param soulbound True if the NFT is a Soulbound Token (SBT). If set, it can't be transferred.\n function airdropSpecify(address[] memory to, uint256[] memory tokenIds, bool soulbound) external payable;\n\n /// @notice Mints `amount` of NFTs to `to` address with optional specified tokenIds. This function must be called only if a valid `signature` is given during a whitelisting/presale.\n /// @param to The addresses of the NFTs receivers\n /// @param tokenIds An optional array of the specified tokens. They must not be minted, otherwise, it will revert. Only used if minting type is `specify`.\n /// @param freeMinting True is minting is free\n /// @param customFee Zero is fee is different from `mintingPrice`.\n /// @param maxAmount Max Amount to be minted with the given `signature`.\n /// @param amount Amount to mint.\n /// @param soulbound True if the NFT is a Soulbound Token (SBT). If set, it can't be transferred.\n /// @param signature Valid `signature` for the presale/whitelist.\n function mintPresale (\n address to, \n uint256[] memory tokenIds,\n bool freeMinting, \n uint256 customFee, \n uint256 maxAmount,\n uint256 amount, \n bool soulbound,\n bytes calldata signature) payable external;\n\n /// @notice Returns the minting price of one NFT.\n /// @return Mint price for one NFT in native coin or ERC-20.\n function mintPrice() external view returns (uint256);\n\n /// @notice Returns the current total supply.\n /// @return Current total supply.\n function totalSupply() external view returns (uint256);\n\n /// @notice Max amount of NFTs to be hold per address.\n /// @return Max per address allowed.\n function maxPerAddress() external view returns (uint16);\n\n}\n\n" }, "contracts/interfaces/IN2M_ERCCommon.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"./IN2M_ERCLibrary.sol\";\nimport \"./IN2M_ERCBase.sol\";\n\ninterface IN2M_ERCCommon is IN2M_ERCBase, IN2M_ERCLibrary {\n /// @notice Returns the address of the current collection owner.\n /// @return The address of the owner.\n function owner() external view returns (address);\n}\n\n" }, "contracts/interfaces/IN2M_ERCLibrary.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"./IN2M_ERCStorage.sol\";\n\ninterface IN2M_ERCLibrary is IN2M_ERCStorage {\n function setAndRevealBaseURI(bytes32 baseURICIDHash) external;\n function changeMintPrice(uint256 newMintPrice) external;\n function contractURI() external view returns (string memory);\n function setContractURI(bytes32 newContractURIMetadataCIDHash) external;\n function setAffiliatesPercentageAndDiscount(uint16 userDiscount, uint16 affiliatePercentage, address affiliateAddress) external;\n function affiliateWithdraw(address affiliate) external;\n function withdrawERC20(address erc20Address) external;\n function withdrawERC20Pro(uint256 signatureExpireDate, uint n2mFee, address erc20Address, bytes calldata signature) external;\n function withdraw() external;\n function withdrawPro(uint256 signatureExpireDate, uint256 n2mFee, bytes calldata signature) external;\n function setReverseENSName(address rerverseResolver, string calldata collectionENSName) external;\n function initializeAndSetReverseENSName(address resolver, string calldata collectionENSName) external;\n function changePlaceholderImageCID(bytes32 newPlaceholderImageCIDHash) external;\n function setPhase(SalePhase newPhase) external;\n function setDropDate(uint256 dropDateTimestamp) external;\n function setDropAndEndDate(uint256 dropDateTimestamp, uint256 endDateTimestamp) external;\n function setMaxPerAddress(uint16 newMaxPerAddress) external;\n function isOperatorFilterRegistryEnabled() external view returns (bool);\n function enableOperatorFilterRegistry() external;\n function disableOperatorFilterRegistry() external;\n function collectionSize() external view returns (uint256);\n function randomTickets(address affiliate) external view returns (uint amount, uint blockNumberToReveal);\n function affiliatesInfo(address affiliate) external view returns (bool enabled, uint16 affiliatePercentage, uint16 userDiscount);\n function pendingAffiliateBalance(address affiliate) external view returns (uint256);\n function pendingTotalAffiliatesBalance() external view returns (uint256);\n function royaltyFee() external view returns (uint256);\n function withdrawnAmount() external view returns (uint256);\n function withdrawnERC20Amount(address erc20) external view returns (uint256);\n function erc20PaymentAddress() external view returns (address);\n function currentPhase() external view returns (SalePhase);\n function mintingType() external view returns (MintingType);\n function saleDates() external view returns (uint256 dropDateTimestamp, uint256 endDateTimestamp);\n function isOpen() external view returns (bool);\n function ownerMaxRevenue() external view returns (uint256);\n\n}\n\n" }, "contracts/interfaces/IN2M_ERCStorage.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"@nfts2me/contracts/important/README.sol\";\n\ninterface IN2M_ERCStorage is Readme {\n /// @notice This event is emitted when a token is minted using an affiliate\n /// @param affiliate The affiliate address\n event AffiliateSell(address indexed affiliate);\n\n /// @notice Error thrown when trying to mint a token with a given id which is already minted\n error TokenAlreadyMinted();\n\n /// @notice Error thrown when input variable differ in length\n error InvalidInputSizesDontMatch();\n\n /// @notice Error thrown when input variable differ in length\n error InputSizeMismatch();\n\n /// @notice Error thrown when trying to mint a token with a given invalid id\n error InvalidTokenId();\n\n /// @notice Error thrown when trying to redeem random tickets with no amount to redeem\n error NothingToRedeem();\n\n /// @notice Error thrown when trying to redeem random tickets too soon\n error CantRevealYetWaitABitToBeAbleToRedeem();\n\n /// @notice Error thrown when the input amount is not valid\n error InvalidAmount();\n\n /// @notice Error thrown when trying to mint a sold out collection or the amount to mint exceeds the remaining supply\n error CollectionSoldOut();\n\n /// @notice Error thrown when trying to presale/whitelist mint and the collection current phase is `closed`\n error PresaleNotOpen();\n\n /// @notice Error thrown when trying to mint and the collection current phase is not `open`\n error PublicSaleNotOpen();\n\n /// @notice Error thrown when trying to mint but the sale has already finished\n error SaleFinished();\n\n /// @notice Error thrown when trying to mint more than the allowance to mint\n error NotEnoughAmountToMint();\n\n /// @notice Error thrown when sending funds to a free minting\n error InvalidMintFeeForFreeMinting();\n\n /// @notice Error thrown when the sent amount is not valid\n error InvalidMintFee();\n\n /// @notice Royalty fee can't be higher than 10%\n error RoyaltyFeeTooHigh();\n\n /// @notice Invalid input. Total supply must be greater than zero\n error TotalSupplyMustBeGreaterThanZero();\n\n /// @notice Can't set BaseURI and Placeholder at the same time\n error CantSetBaseURIAndPlaceholderAtTheSameTime();\n\n /// @notice No BaseURI nor Placeholder set\n error NoBaseURINorPlaceholderSet();\n\n /// @notice Can't transfer a Soulbound Token (SBT)\n error NonTransferrableSoulboundNFT();\n\n /// @notice The input revenue percentages are not valid\n error InvalidRevenuePercentage();\n\n /// @notice Can't mint until specified drop date\n error WaitUntilDropDate();\n\n /// @notice Trying to use mintPresale method in a collection with a minting type that doesn't support whitelist\n error PresaleInvalidMintingType();\n\n /// @notice Metadata is already fixed. Can't change metadata once fixed\n error MetadataAlreadyFixed();\n\n /// @notice Invalid collection minting type for the current minting function\n error InvalidMintingType();\n\n /// @notice The address exceeded the max per address amount\n error MaxPerAddressExceeded();\n\n /// @notice The given signature doesn't match the input values\n error SignatureMismatch();\n\n /// @notice Reentrancy Guard protection\n error ReentrancyGuard();\n\n /// @notice New Placeholder can't be empty\n error NewPlaceholderCantBeEmpty();\n\n /// @notice New BaseURI can't be empty\n error NewBaseURICantBeEmpty(); \n\n /// @notice Invalid percentage or discount values\n error InvalidPercentageOrDiscountValues();\n\n /// @notice Can't lower current percentages\n error CantLowerCurrentPercentages();\n\n /// @notice Contract MetadataURI already fixed\n error ContractMetadataURIAlreadyFixed();\n\n /// @notice Only owner of N2M can call this function\n error OnlyOwnerOrN2M();\n\n /// @notice Only the given affiliate or N2M can call this function\n error OnlyAffiliateOrN2M();\n\n /// @notice The signature has expired\n error SignatureExpired();\n\n /// @notice Invalid phase can't be set without giving a date, use the proper functions\n error InvalidPhaseWithoutDate();\n\n /// @notice Invalid drop date\n error InvalidDropDate();\n\n /// @notice Operator address is filtered\n error AddressFiltered(address filtered);\n\n struct RandomTicket {\n uint256 amount;\n uint256 blockNumberToReveal;\n }\n\n struct RevenueAddress {\n address to;\n uint16 percentage;\n }\n\n struct AffiliateInformation {\n bool enabled;\n uint16 affiliatePercentage;\n uint16 userDiscount;\n }\n\n enum SalePhase { \n CLOSED,\n PRESALE,\n PUBLIC,\n DROP_DATE,\n DROP_AND_END_DATE\n }\n\n enum MintingType { \n SEQUENTIAL, \n RANDOM, \n SPECIFY, \n CUSTOM_URI \n }\n\n enum OperatorFilterStatus { \n ENABLED_NOT_INITIALIZED, \n ENABLED_EXISTS, \n DISABLED_NOT_INITIALIZED,\n DISABLED_EXISTS \n }\n\n /// @notice Returns true if the metadata is fixed and immutable. If the metadata hasn't been fixed yet it will return false. Once fixed, it can't be changed by anyone.\n function isMetadataFixed() external view returns (bool);\n\n}\n\n" }, "contracts/interfaces/IN2MBeaconFactory.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\ninterface IN2MUpgradeable {\n function getERC721Implementation() external view returns (address);\n function getERC1155Implementation() external view returns (address);\n}\n" }, "contracts/interfaces/IN2MCrossFactory.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\ninterface IN2MCrossFactory {\n function getN2MTreasuryAddress() external pure returns (address);\n function ownerOf(uint256 tokenId) external view returns (address);\n function strictOwnerOf(uint256 tokenId) external view returns (address);\n}\n" }, "contracts/interfaces/IN2MERC1155.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\";\nimport \"./IN2M_ERCCommon.sol\";\n\ninterface IN2MERC1155 is IERC1155MetadataURI, IN2M_ERCCommon {\n function supportsInterface(bytes4 interfaceId) external view override(IERC165, IERC165Upgradeable) returns (bool);\n function balanceOf(address owner) external view returns (uint256 balance);\n function totalSupply(uint256 id) external view returns (uint256);\n function exists(uint256 id) external view returns (bool);\n function getSupplies(uint256 startId, uint256 endId) external view returns (uint256[] memory supplies, uint256 blockNumber, uint256 blockTimestamp);\n}\n\n" }, "contracts/interfaces/IN2MERC721.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\";\nimport \"@openzeppelin/contracts/governance/utils/IVotes.sol\";\nimport \"./IN2M_ERCCommon.sol\";\n\ninterface IN2MERC721 is IERC721Metadata, IN2M_ERCCommon, IVotes {\n function name() external view override(IERC721Metadata, IN2M_ERCBase) returns (string memory);\n function tokenURI(uint256 tokenId) external view override(IERC721Metadata, IN2M_ERCBase) returns (string memory);\n function symbol() external view override(IERC721Metadata, IN2M_ERCBase) returns (string memory);\n function supportsInterface(bytes4 interfaceId) external view override(IERC165, IERC165Upgradeable) returns (bool);\n}\n\n" }, "contracts/interfaces/IOperatorFilterRegistry.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\ninterface IOperatorFilterRegistry {\n function isOperatorAllowed(address registrant, address operator) external view returns (bool);\n function register(address registrant) external;\n function registerAndSubscribe(address registrant, address subscription) external;\n function registerAndCopyEntries(address registrant, address registrantToCopy) external;\n function updateOperator(address registrant, address operator, bool filtered) external;\n function updateOperators(address registrant, address[] calldata operators, bool filtered) external;\n function updateCodeHash(address registrant, bytes32 codehash, bool filtered) external;\n function updateCodeHashes(address registrant, bytes32[] calldata codeHashes, bool filtered) external;\n function subscribe(address registrant, address registrantToSubscribe) external;\n function unsubscribe(address registrant, bool copyExistingEntries) external;\n function subscriptionOf(address addr) external returns (address registrant);\n function subscribers(address registrant) external returns (address[] memory);\n function subscriberAt(address registrant, uint256 index) external returns (address);\n function copyEntriesOf(address registrant, address registrantToCopy) external;\n function isOperatorFiltered(address registrant, address operator) external returns (bool);\n function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool);\n function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool);\n function filteredOperators(address addr) external returns (address[] memory);\n function filteredCodeHashes(address addr) external returns (bytes32[] memory);\n function filteredOperatorAt(address registrant, uint256 index) external returns (address);\n function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32);\n function isRegistered(address addr) external view returns (bool);\n function codeHashOf(address addr) external view returns (bytes32);\n}" }, "contracts/interfaces/IReverseRegistrar.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\ninterface IReverseRegistrar {\n function setDefaultResolver(address resolver) external;\n\n function claim(address owner) external returns (bytes32);\n\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function claimWithResolver(address owner, address resolver)\n external\n returns (bytes32);\n\n function setName(string memory name) external returns (bytes32);\n\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) external returns (bytes32);\n\n function node(address addr) external pure returns (bytes32);\n}" }, "contracts/N2MCommonStorage.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"@nfts2me/contracts/interfaces/IN2M_ERCStorage.sol\";\nimport \"@nfts2me/contracts/interfaces/IN2MCrossFactory.sol\";\nimport \"@nfts2me/contracts/ownable/NFTOwnableUpgradeable.sol\";\nimport {IOperatorFilterRegistry} from \"@nfts2me/contracts/interfaces/IOperatorFilterRegistry.sol\";\nimport \"./N2MVersion.sol\";\n\n/// @title NFTs2Me.com Smart Contracts\n/// @author The NFTs2Me Team\n/// @notice Read our terms of service\n/// @custom:security-contact [email protected]\n/// @custom:terms-of-service https://nfts2me.com/terms-of-service/\n/// @custom:website https://nfts2me.com/\nabstract contract N2MCommonStorage is\n NFTOwnableUpgradeable,\n IN2M_ERCStorage,\n N2MVersion\n{\n /// CONSTANTS\n address internal constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6);\n address internal constant OPENSEA_CONDUIT = address(0x1E0049783F008A0085193E00003D00cd54003c71);\n address internal constant N2M_CONDUIT = address(0x88899DC0B84C6E726840e00DFb94ABc6248825eC);\n IOperatorFilterRegistry internal constant operatorFilterRegistry = IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E);\n address internal constant N2M_PRESALE_SIGNER = address(0xC0ffee06CE3D6689305035601a055A96acd619c6);\n address internal constant N2M_TREASURY = address(0x955aF4de9Ca03f84c9462457D075aCABf1A8AfC8);\n uint256 internal constant N2M_FEE = 5_00;\n uint256 internal constant MAX_AFFILIATE_DISCOUNT = 100_00;\n uint256 internal constant MAX_AFFILIATE_PERCENTAGE = 100_00;\n uint256 internal constant NOT_ENTERED = 0;\n\n /// IMMUTABLE \n address payable internal immutable _factory;\n\n bytes32 internal _baseURICIDHash;\n bytes32 internal _placeholderImageCIDHash;\n bytes32 internal _contractURIMetadataCIDHash;\n\n mapping(address => uint256) internal _pendingAffiliateBalance;\n uint256 internal _pendingTotalAffiliatesBalance;\n\n RevenueAddress[] internal _revenueInfo;\n mapping(address => AffiliateInformation) internal _affiliatesInfo;\n\n uint256 internal _mintPrice;\n uint256 internal _withdrawnAmount;\n uint256 internal _reentrancyEntered;\n uint256 internal _dropDateTimestamp;\n uint256 internal _endDateTimestamp; \n\n mapping(address => uint256) internal _withdrawnERC20Amount;\n address internal _erc20PaymentAddress;\n\n mapping(address => RandomTicket) internal _randomTickets;\n mapping(bytes => uint256) internal _usedAmountSignature;\n mapping(uint256 => bool) internal _soulbound;\n mapping(uint256 => bytes32) internal _customURICIDHashes;\n\n uint32 internal _soldTokens;\n SalePhase internal _currentPhase;\n OperatorFilterStatus internal _operatorFilterStatus;\n MintingType internal _mintingType; \n uint16 internal _royaltyFee;\n uint16 internal _maxPerAddress; \n uint32 internal _collectionSize;\n bool internal _isERC20Payment;\n bool internal _soulboundCollection;\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor(address payable factoryAddress) {\n _factory = factoryAddress;\n _disableInitializers();\n }\n\n /// @notice Returns the address of the current collection owner.\n function owner() public view override(NFTOwnableUpgradeable) returns (address collectionOwner) {\n try IN2MCrossFactory(_factory).ownerOf(uint256(uint160(address(this)))) returns (address ownerOf) {\n return ownerOf;\n } catch {}\n }\n\n function _strictOwner() internal view override(NFTOwnableUpgradeable) returns (address ownerStrictAddress) {\n try IN2MCrossFactory(_factory).strictOwnerOf(uint256(uint160(address(this)))) returns (address strictOwnerOf) {\n return strictOwnerOf;\n } catch {}\n }\n\n function _getN2MFeeAddress() internal view override(NFTOwnableUpgradeable) returns (address) {\n\n try IN2MCrossFactory(_factory).getN2MTreasuryAddress() returns (address n2mTreasuryAddress) {\n return n2mTreasuryAddress;\n } catch {\n return N2M_TREASURY;\n }\n } \n\n modifier nonReentrant() {\n _nonReentrantBefore();\n _;\n _nonReentrantAfter();\n }\n\n function _nonReentrantBefore() private {\n if (_reentrancyEntered != 0) revert ReentrancyGuard();\n _reentrancyEntered = 1;\n }\n\n function _nonReentrantAfter() private {\n delete(_reentrancyEntered);\n } \n\n /// @notice Returns true if the metadata is fixed and immutable. If the metadata hasn't been fixed yet it will return false. Once fixed, it can't be changed by anyone.\n function isMetadataFixed() public view override returns (bool) {\n return (_baseURICIDHash != 0 || (_mintingType == MintingType.CUSTOM_URI));\n }\n\n}\n" }, "contracts/N2MERC1155.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155SupplyUpgradeable.sol\";\n\nimport \"./N2MTokenCommon.sol\";\n\n/// @title NFTs2Me.com Smart Contracts for ERC-1155.\n/// @author The NFTs2Me Team\n/// @notice Read our terms of service\n/// @custom:security-contact [email protected]\n/// @custom:terms-of-service https://nfts2me.com/terms-of-service/\n/// @custom:website https://nfts2me.com/\ncontract N2MERC1155 is\n N2MTokenCommon,\n ERC1155Upgradeable,\n ERC1155SupplyUpgradeable\n{\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor(address libraryAddress, address payable factoryAddress) N2MTokenCommon(libraryAddress, factoryAddress) {}\n\n string private _name;\n string public override symbol;\n\n mapping(address => uint256) private _balances;\n\n /// @notice To be called to create the collection. Can only be called once.\n function initialize(\n string memory tokenName,\n string memory tokenSymbol,\n uint256 iMintPrice,\n bytes32 baseURICIDHash,\n bytes32 placeholderImageCIDHash,\n RevenueAddress[] calldata revenueAddresses,\n address iErc20PaymentAddress,\n uint32 iTotalSupply,\n uint16 iRoyaltyFee,\n bool soulboundCollection,\n MintingType iMintingType\n ) public payable override initializer {\n\n _name = tokenName;\n symbol = tokenSymbol;\n\n if (iTotalSupply == 0) revert TotalSupplyMustBeGreaterThanZero();\n if (baseURICIDHash != 0 && placeholderImageCIDHash != 0) revert CantSetBaseURIAndPlaceholderAtTheSameTime();\n if (iRoyaltyFee > 10_00) revert RoyaltyFeeTooHigh();\n\n _collectionSize = iTotalSupply;\n if (baseURICIDHash == 0) {\n if (placeholderImageCIDHash == 0) {\n if (iMintingType != MintingType.CUSTOM_URI)\n revert NoBaseURINorPlaceholderSet();\n } else {\n _placeholderImageCIDHash = placeholderImageCIDHash;\n }\n } else {\n _baseURICIDHash = baseURICIDHash;\n }\n\n _mintPrice = iMintPrice;\n _royaltyFee = iRoyaltyFee;\n if (iMintingType != MintingType.SEQUENTIAL) {\n _mintingType = iMintingType;\n }\n if (iErc20PaymentAddress != address(0)) {\n _isERC20Payment = true;\n _erc20PaymentAddress = iErc20PaymentAddress;\n }\n if (soulboundCollection == true) {\n _soulboundCollection = true;\n }\n\n if (revenueAddresses.length > 0) {\n uint256 revenuePercentageTotal;\n for (uint256 i; i < revenueAddresses.length; ) {\n revenuePercentageTotal += revenueAddresses[i].percentage;\n unchecked {\n ++i;\n }\n }\n _revenueInfo = revenueAddresses;\n if (revenuePercentageTotal > 100_00 - N2M_FEE) revert InvalidRevenuePercentage();\n }\n\n }\n\n /// @notice alias for `uri`\n function tokenURI(uint256 tokenId)\n public\n view\n override\n returns (string memory)\n {\n return uri(tokenId);\n }\n\n /// @notice tokenURI of the given token\n /// @param tokenId of the token to ask for\n /// @return tokenURI for `tokenId`\n function uri(uint256 tokenId)\n public\n view\n override(ERC1155Upgradeable)\n returns (string memory)\n {\n return IN2MLibrary(address(this)).tokenURIImpl(tokenId);\n }\n\n function _exists(uint256 tokenId) internal view override returns (bool) {\n return exists(tokenId);\n }\n\n function _mint(address to, uint256 tokenId) internal override {\n super._mint(to, tokenId, 1, \"\");\n }\n\n /// @notice Collection name\n /// @return the collection name\n function name() public view override returns (string memory) {\n return _name;\n }\n\n /// @notice Balance of a given address for ERC-1155 (non-standard).\n /// @param owner to ask for the balance\n /// @return balance of the `owner`\n function balanceOf(address owner) public view override returns (uint256 balance) {\n if (owner == address(0)) revert();\n balance = _balances[owner];\n if (_mintingType == MintingType.RANDOM) {\n balance += _randomTickets[owner].amount;\n }\n }\n\n function _mintSequential(address to, uint256 amount) internal override {\n if (amount == 1) {\n unchecked {\n _mint(to, ++_soldTokens, 1, \"\");\n }\n } else {\n uint256[] memory ids = new uint256[](amount);\n uint256[] memory amounts = new uint256[](amount);\n\n for (uint256 i; i < amount; ) {\n unchecked {\n ids[i] = ++_soldTokens;\n amounts[i] = 1;\n ++i;\n }\n }\n\n _mintBatch(to, ids, amounts, \"\");\n }\n }\n\n function _mintSpecify(address to, uint256[] memory tokenIds)\n internal\n override\n {\n uint32 amount = uint32(tokenIds.length);\n _soldTokens += amount;\n uint256[] memory amounts = new uint256[](amount);\n\n for (uint256 i; i < amount; ) {\n uint256 tokenId = tokenIds[i];\n amounts[i] = 1;\n if (_exists(tokenId)) revert TokenAlreadyMinted();\n if (tokenId <= 0 || tokenId > _collectionSize) revert InvalidTokenId();\n unchecked {\n ++i;\n }\n }\n _mintBatch(to, tokenIds, amounts, \"\");\n }\n\n function _beforeTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal override(ERC1155Upgradeable, ERC1155SupplyUpgradeable) {\n uint256 length = ids.length;\n for (uint256 i; i < length; ) {\n\n if (from != address(0)) {\n if (_soulbound[ids[i]] || _soulboundCollection) revert NonTransferrableSoulboundNFT();\n\n _balances[from] -= amounts[i];\n }\n\n if (to != address(0)) {\n\n _balances[to] += amounts[i];\n }\n\n unchecked {\n ++i;\n }\n }\n\n super._beforeTokenTransfer(operator, from, to, ids, amounts, data);\n\n if (_maxPerAddress != 0) {\n\n if (balanceOf(to) > _maxPerAddress) revert MaxPerAddressExceeded();\n } \n }\n\n /// @notice Query if a contract implements an interface\n /// @param interfaceId The interface identifier, as specified in ERC-165\n /// @dev Interface identification is specified in ERC-165. This function uses less than 30,000 gas.\n /// @return `true` if the contract implements `interfaceId` and `interfaceId` is not 0xffffffff, `false` otherwise\n function supportsInterface(bytes4 interfaceId)\n public\n view\n override(ERC1155Upgradeable, IERC165Upgradeable)\n returns (bool)\n {\n return (\n\n interfaceId == type(IERC2981Upgradeable).interfaceId || super.supportsInterface(interfaceId));\n }\n\n /// @notice Enable or disable approval for a third party (\"operator\") to manage all of the caller's tokens.\n /// @dev MUST emit the ApprovalForAll event on success.\n /// @param operator Address to add to the set of authorized operators\n /// @param approved True if the operator is approved, false to revoke approval\n function setApprovalForAll(address operator, bool approved) public override onlyAllowedOperatorApproval(operator) {\n super.setApprovalForAll(operator, approved);\n } \n\n /// @notice Queries the approval status of an operator for a given owner.\n /// @param owner The owner of the tokens\n /// @param operator Address of authorized operator\n /// @return True if the operator is approved, false if not\n function isApprovedForAll(address owner, address operator)\n public\n view\n virtual\n override\n returns (bool)\n {\n\n if (operator == N2M_CONDUIT) return true;\n if (operator == OPENSEA_CONDUIT) return true;\n\n return super.isApprovedForAll(owner, operator);\n }\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public override onlyAllowedOperator() {\n super.safeTransferFrom(from, to, id, amount, data);\n }\n\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public override onlyAllowedOperator() {\n super.safeBatchTransferFrom(from, to, ids, amounts, data);\n }\n\n // ////////\n\n // ////////\n\n function getSupplies(uint256 startId, uint256 endId)\n external\n view\n returns (\n uint256[] memory supplies,\n uint256 blockNumber,\n uint256 blockTimestamp\n )\n {\n blockNumber = block.number;\n blockTimestamp = block.timestamp;\n\n if (endId >= startId) {\n uint256 total = 1 + endId - startId;\n unchecked {\n supplies = new uint256[](total);\n for (uint256 i; i < total; i++) {\n supplies[i] = totalSupply(startId + i);\n }\n }\n } else {\n uint256[] memory emptyArray;\n supplies = emptyArray;\n }\n } \n\n}\n" }, "contracts/N2MERC721.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721VotesUpgradeable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\nimport \"./N2MTokenCommon.sol\";\n\n/// @title NFTs2Me.com Smart Contracts for ERC-721.\n/// @author The NFTs2Me Team\n/// @notice Read our terms of service\n/// @custom:security-contact [email protected]\n/// @custom:terms-of-service https://nfts2me.com/terms-of-service/\n/// @custom:website https://nfts2me.com/\ncontract N2MERC721 is\n N2MTokenCommon,\n ERC721Upgradeable,\n EIP712Upgradeable,\n ERC721VotesUpgradeable\n{\n\n /// @notice To be called to create the collection. Can only be called once.\n function initialize(\n string memory tokenName,\n string memory tokenSymbol,\n uint256 iMintPrice,\n bytes32 baseURICIDHash,\n bytes32 placeholderImageCIDHash,\n RevenueAddress[] calldata revenueAddresses,\n address iErc20PaymentAddress,\n uint32 iTotalSupply,\n uint16 iRoyaltyFee,\n bool soulboundCollection,\n MintingType iMintingType\n ) public payable override initializer {\n __ERC721_init(tokenName, tokenSymbol);\n\n if (iTotalSupply == 0) revert TotalSupplyMustBeGreaterThanZero();\n if (baseURICIDHash != 0 && placeholderImageCIDHash != 0) revert CantSetBaseURIAndPlaceholderAtTheSameTime();\n if (iRoyaltyFee > 10_00) revert RoyaltyFeeTooHigh();\n\n _collectionSize = iTotalSupply;\n if (baseURICIDHash == 0) {\n if (placeholderImageCIDHash == 0) {\n if (iMintingType != MintingType.CUSTOM_URI)\n revert NoBaseURINorPlaceholderSet();\n } else {\n _placeholderImageCIDHash = placeholderImageCIDHash;\n }\n } else {\n _baseURICIDHash = baseURICIDHash;\n }\n\n _mintPrice = iMintPrice;\n _royaltyFee = iRoyaltyFee;\n if (iMintingType != MintingType.SEQUENTIAL) {\n _mintingType = iMintingType;\n }\n if (iErc20PaymentAddress != address(0)) {\n _isERC20Payment = true;\n _erc20PaymentAddress = iErc20PaymentAddress;\n }\n if (soulboundCollection == true) {\n _soulboundCollection = true;\n }\n\n if (revenueAddresses.length > 0) {\n uint256 revenuePercentageTotal;\n for (uint256 i; i < revenueAddresses.length; ) {\n revenuePercentageTotal += revenueAddresses[i].percentage;\n unchecked {\n ++i;\n }\n }\n _revenueInfo = revenueAddresses;\n if (revenuePercentageTotal > 100_00 - N2M_FEE) revert InvalidRevenuePercentage();\n }\n\n }\n\n constructor(address libraryAddress, address payable factoryAddress) N2MTokenCommon(libraryAddress, factoryAddress) {}\n\n /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.\n /// @dev Throws if `_tokenId` is not a valid NFT. URIs are defined in RFC\n /// 3986. The URI may point to a JSON file that conforms to the \"ERC721\n /// Metadata JSON Schema\".\n function tokenURI(uint256 tokenId)\n public\n view\n override(N2MTokenCommon, ERC721Upgradeable)\n returns (string memory)\n {\n _requireMinted(tokenId);\n return IN2MLibrary(address(this)).tokenURIImpl(tokenId);\n }\n\n function _exists(uint256 tokenId)\n internal\n view\n override(ERC721Upgradeable, N2MTokenCommon)\n returns (bool)\n {\n return super._exists(tokenId);\n }\n\n function _mint(address to, uint256 tokenId)\n internal\n override(ERC721Upgradeable, N2MTokenCommon)\n {\n super._mint(to, tokenId);\n }\n\n /// @notice A descriptive name for a collection of NFTs in this contract\n function name()\n public\n view\n override(ERC721Upgradeable, N2MTokenCommon)\n returns (string memory)\n {\n return super.name();\n }\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal override {\n if (\n from != address(0) &&\n (_soulbound[firstTokenId] || _soulboundCollection)\n ) revert NonTransferrableSoulboundNFT();\n\n super._beforeTokenTransfer(from, to, firstTokenId, batchSize);\n }\n\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal override(ERC721Upgradeable, ERC721VotesUpgradeable) {\n super._afterTokenTransfer(from, to, firstTokenId, batchSize);\n\n if (_maxPerAddress != 0) {\n\n if (balanceOf(to) > _maxPerAddress) revert MaxPerAddressExceeded();\n }\n }\n\n function _burn(uint256 tokenId)\n internal\n override(ERC721Upgradeable)\n {\n super._burn(tokenId);\n if (_customURICIDHashes[tokenId] != 0) {\n delete _customURICIDHashes[tokenId];\n } \n }\n\n /// @notice Query if a contract implements an interface\n /// @param interfaceId The interface identifier, as specified in ERC-165\n /// @dev Interface identification is specified in ERC-165. This function uses less than 30,000 gas.\n /// @return `true` if the contract implements `interfaceId` and `interfaceId` is not 0xffffffff, `false` otherwise\n function supportsInterface(bytes4 interfaceId)\n public\n view\n override(ERC721Upgradeable, IERC165Upgradeable)\n returns (bool)\n {\n return (\n\n interfaceId == type(IERC2981Upgradeable).interfaceId || super.supportsInterface(interfaceId));\n }\n\n /// @notice An abbreviated name for NFTs in this contract\n /// @return the collection symbol\n function symbol()\n public\n view\n virtual\n override(IN2M_ERCBase, ERC721Upgradeable)\n returns (string memory)\n {\n return super.symbol();\n }\n\n /// @notice Count all NFTs assigned to an owner\n /// @dev NFTs assigned to the zero address are considered invalid, and this\n /// function throws for queries about the zero address.\n /// @param owner An address for whom to query the balance\n /// @return balance The number of NFTs owned by `owner`, possibly zero\n function balanceOf(address owner) public view override(ERC721Upgradeable, N2MTokenCommon) returns (uint256 balance) {\n balance = super.balanceOf(owner);\n if (_mintingType == MintingType.RANDOM) {\n balance += _randomTickets[owner].amount;\n }\n }\n\n function _EIP712NameHash() internal virtual override view returns (bytes32) {\n\n return keccak256(\"NFTs2Me\");\n }\n\n function _EIP712VersionHash() internal virtual override view returns (bytes32) {\n return keccak256(\"1\");\n } \n\n /// @notice Enable or disable approval for a third party (\"operator\") to manage\n /// all of `msg.sender`'s assets\n /// @dev Emits the ApprovalForAll event. The contract MUST allow\n /// multiple operators per owner.\n /// @param operator Address to add to the set of authorized operators\n /// @param approved True if the operator is approved, false to revoke approval\n function setApprovalForAll(address operator, bool approved) public override onlyAllowedOperatorApproval(operator) {\n super.setApprovalForAll(operator, approved);\n }\n\n /// @notice Change or reaffirm the approved address for an NFT\n /// @dev The zero address indicates there is no approved address.\n /// Throws unless `msg.sender` is the current NFT owner, or an authorized\n /// operator of the current owner.\n /// @param operator The new approved NFT controller\n /// @param tokenId The NFT to approve\n function approve(address operator, uint256 tokenId) public override onlyAllowedOperatorApproval(operator) {\n super.approve(operator, tokenId);\n }\n\n /// @notice Query if an address is an authorized operator for another address\n /// @param owner The address that owns the NFTs\n /// @param operator The address that acts on behalf of the owner\n /// @return True if `operator` is an approved operator for `owner`, false otherwise\n function isApprovedForAll(address owner, address operator)\n public\n view\n virtual\n override\n returns (bool)\n {\n\n if (operator == N2M_CONDUIT) return true;\n if (operator == OPENSEA_CONDUIT) return true;\n\n return super.isApprovedForAll(owner, operator);\n }\n\n /// @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE\n /// TO CONFIRM THAT `to` IS CAPABLE OF RECEIVING NFTS OR ELSE\n /// THEY MAY BE PERMANENTLY LOST\n /// @dev Throws unless `msg.sender` is the current owner, an authorized\n /// operator, or the approved address for this NFT. Throws if `from` is\n /// not the current owner. Throws if `to` is the zero address. Throws if\n /// `tokenId` is not a valid NFT.\n /// @param from The current owner of the NFT\n /// @param to The new owner\n /// @param tokenId The NFT to transfer\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public override onlyAllowedOperator() {\n super.transferFrom(from, to, tokenId);\n }\n\n /// @notice Transfers the ownership of an NFT from one address to another address\n /// @dev This works identically to the other function with an extra data parameter,\n /// except this function just sets data to \"\".\n /// @param from The current owner of the NFT\n /// @param to The new owner\n /// @param tokenId The NFT to transfer\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public override onlyAllowedOperator() {\n super.safeTransferFrom(from, to, tokenId);\n }\n\n /// @notice Transfers the ownership of an NFT from one address to another address\n /// @dev Throws unless `msg.sender` is the current owner, an authorized\n /// operator, or the approved address for this NFT. Throws if `from` is\n /// not the current owner. Throws if `to` is the zero address. Throws if\n /// `tokenId` is not a valid NFT. When transfer is complete, this function\n /// checks if `to` is a smart contract (code size > 0). If so, it calls\n /// `onERC721Received` on `to` and throws if the return value is not\n /// `bytes4(keccak256(\"onERC721Received(address,address,uint256,bytes)\"))`.\n /// @param from The current owner of the NFT\n /// @param to The new owner\n /// @param tokenId The NFT to transfer\n /// @param data Additional data with no specified format, sent in call to `to`\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) public override onlyAllowedOperator() {\n super.safeTransferFrom(from, to, tokenId, data);\n }\n\n}\n" }, "contracts/N2MTokenCommon.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721VotesUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721URIStorageUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol\";\n\n/// Utils\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\nimport \"@nfts2me/contracts/interfaces/IN2MCrossFactory.sol\";\nimport \"@nfts2me/contracts/interfaces/IN2M_ERCBase.sol\";\nimport \"./N2MCommonStorage.sol\";\n\ninterface IN2MLibrary {\n function tokenURIImpl(uint256 tokenId) external view returns (string memory);\n}\n\n/// @title NFTs2Me.com Smart Contracts\n/// @author The NFTs2Me Team\n/// @notice Read our terms of service\n/// @custom:security-contact [email protected]\n/// @custom:terms-of-service https://nfts2me.com/terms-of-service/\n/// @custom:website https://nfts2me.com/\nabstract contract N2MTokenCommon is N2MCommonStorage, IN2M_ERCBase {\n /// IMMUTABLE\n address internal immutable LIBRARY_ADDRESS;\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor(address libraryAddress, address payable factoryAddress) N2MCommonStorage(factoryAddress) {\n LIBRARY_ADDRESS = libraryAddress;\n }\n\n function _mint(address to, uint256 tokenId) internal virtual;\n\n function _exists(uint256 tokenId) internal view virtual returns (bool);\n\n function name() external view virtual override returns (string memory);\n\n function tokenURI(uint256 tokenId) external view virtual override returns (string memory);\n\n function balanceOf(address owner) public view virtual returns (uint256 balance); \n\n /// @notice Mints one NFT to the caller (msg.sender). Requires `minting type` to be `sequential` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n function mint() external payable override {\n _requirePayment(_mintPrice, 1);\n _checkPhase();\n if (_mintingType != MintingType.SEQUENTIAL) revert InvalidMintingType();\n unchecked {\n if ((++_soldTokens) > _collectionSize) revert CollectionSoldOut();\n }\n _mint(msg.sender, _soldTokens);\n }\n\n /// @notice Mints `amount` NFTs to the caller (msg.sender). Requires `minting type` to be `sequential` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n /// @param amount The number of NFTs to mint\n function mint(uint256 amount) external payable override {\n _requirePayment(_mintPrice, amount);\n _mintSequentialWithChecks(msg.sender, amount);\n }\n\n /// @notice Mints `amount` NFTs to the caller (msg.sender) with a given `affiliate`. Requires `minting type` to be `sequential` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n /// @param amount The number of NFTs to mint\n /// @param affiliate The affiliate address\n function mint(uint256 amount, address affiliate) external payable override {\n _requirePaymentWithAffiliates(amount, affiliate);\n _mintSequentialWithChecks(msg.sender, amount);\n }\n\n /// @notice Mints `amount` NFTs to `to` address. Requires `minting type` to be `sequential` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n /// @param to The address of the NFTs receiver\n /// @param amount The number of NFTs to mint \n function mintTo(address to, uint256 amount) external payable override {\n _requirePayment(_mintPrice, amount);\n _mintSequentialWithChecks(to, amount);\n }\n\n /// @notice Mints `amount` NFTs to `to` address with a given `affiliate`. Requires `minting type` to be `sequential` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n /// @param to The address of the NFTs receiver\n /// @param amount The number of NFTs to mint \n /// @param affiliate The affiliate address\n function mintTo(address to, uint256 amount, address affiliate) external payable override {\n _requirePaymentWithAffiliates(amount, affiliate);\n _mintSequentialWithChecks(to, amount);\n }\n\n function _mintSequentialWithChecks(address to, uint256 amount) private {\n _checkPhase();\n if (_mintingType != MintingType.SEQUENTIAL) revert InvalidMintingType();\n if ((_soldTokens + amount) > _collectionSize) revert CollectionSoldOut();\n\n _mintSequential(to, amount);\n }\n\n function _mintSequential(address to, uint256 amount, bool soulbound) private {\n for (uint256 i; i < amount; ) {\n unchecked {\n _mint(to, ++_soldTokens);\n }\n if (soulbound) _soulbound[_soldTokens] = true;\n unchecked {\n ++i;\n }\n }\n }\n\n function _mintSequential(address to, uint256 amount) internal virtual {\n for (uint256 i; i < amount; ) {\n unchecked {\n _mint(to, ++_soldTokens);\n ++i;\n }\n }\n }\n\n /// @notice Two phases on-chain random minting. Mints `amount` NFTs tickets to `to` address. Requires `minting type` to be `random` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment). Once minted, those tickets must be redeemed for an actual token calling `redeemRandom()`.\n /// @param to The address of the NFTs receiver\n /// @param amount The number of NFTs to mint \n function mintRandomTo(address to, uint256 amount) external payable override {\n _requirePayment(_mintPrice, amount);\n _mintRandomWithChecks(to, amount);\n }\n\n /// @notice Two phases on-chain random minting. Mints `amount` NFTs tickets to `to` address with a given `affiliate`. Requires `minting type` to be `random` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment). Once minted, those tickets must be redeemed for an actual token calling `redeemRandom()`.\n /// @param to The address of the NFTs receiver\n /// @param amount The number of NFTs to mint \n /// @param affiliate The affiliate address\n function mintRandomTo(address to, uint256 amount, address affiliate) external payable override {\n _requirePaymentWithAffiliates(amount, affiliate);\n _mintRandomWithChecks(to, amount);\n }\n\n function _mintRandomWithChecks(address to, uint256 amount) private {\n _checkPhase();\n if (_mintingType != MintingType.RANDOM) revert InvalidMintingType();\n if (_soldTokens + (amount) > _collectionSize) revert CollectionSoldOut();\n\n unchecked {\n _randomTickets[to].blockNumberToReveal = block.number + 2;\n _randomTickets[to].amount += amount;\n _soldTokens += uint32(amount);\n }\n\n if (_maxPerAddress != 0) {\n\n if (balanceOf(to) > _maxPerAddress) revert MaxPerAddressExceeded();\n } \n }\n\n /// @notice Redeems remaining random tickets generated from `msg.sender` by calling `mintRandomTo` for actual NFTs.\n function redeemRandom() external payable override {\n uint256 blockNumberToReveal = _randomTickets[msg.sender].blockNumberToReveal;\n uint256 amountToRedeem = _randomTickets[msg.sender].amount;\n\n if (amountToRedeem == 0) revert NothingToRedeem();\n if (block.number <= _randomTickets[msg.sender].blockNumberToReveal) revert CantRevealYetWaitABitToBeAbleToRedeem();\n\n bytes32 seedFromBlockNumber = blockhash(blockNumberToReveal);\n\n if (seedFromBlockNumber == 0) {\n\n uint256 newBlockNumber = ((block.number & uint256(int256(-0x100))) + (blockNumberToReveal & 0xff));\n\n if ((newBlockNumber >= block.number)) {\n newBlockNumber -= 256;\n\n }\n seedFromBlockNumber = blockhash(newBlockNumber);\n\n }\n\n delete(_randomTickets[msg.sender].blockNumberToReveal);\n delete(_randomTickets[msg.sender].amount);\n\n uint16 maxPerAddressTemp = _maxPerAddress;\n delete(_maxPerAddress);\n _mintRandom(msg.sender, amountToRedeem, seedFromBlockNumber, false);\n _maxPerAddress = maxPerAddressTemp;\n }\n\n function _mintRandom(address to, uint256 amount, bytes32 seed, bool soulbound) private {\n for (; amount > 0; ) {\n uint256 tokenId = _randomTokenId(seed, amount);\n _mint(to, tokenId);\n if (soulbound) _soulbound[tokenId] = true;\n unchecked {\n --amount;\n }\n }\n }\n\n function _randomTokenId(bytes32 seed, uint256 extraModifier) private view returns (uint256 tokenId) {\n\n tokenId = (uint256(keccak256(abi.encodePacked(seed, extraModifier))) % _collectionSize) + 1;\n\n while (_exists(tokenId)) {\n unchecked {\n tokenId = (tokenId % _collectionSize) + 1;\n }\n }\n }\n\n /// @notice Mints `amount` NFTs to `to` address. Requires `minting type` to be `specify` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n /// @param to The address of the NFTs receiver\n /// @param tokenIds An array of the specified tokens. They must not be minted, otherwise, it will revert.\n function mintSpecifyTo(address to, uint256[] memory tokenIds)\n external\n payable\n override\n {\n _requirePayment(_mintPrice, tokenIds.length);\n _mintSpecifyWithChecks(to, tokenIds);\n }\n\n /// @notice Mints `amount` NFTs to `to` address with a given `affiliate`. Requires `minting type` to be `specify` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n /// @param to The address of the NFTs receiver\n /// @param tokenIds An array of the specified tokens. They must not be minted, otherwise, it will revert.\n /// @param affiliate The affiliate address\n function mintSpecifyTo(address to, uint256[] memory tokenIds, address affiliate) \n external\n payable\n override\n {\n _requirePaymentWithAffiliates(tokenIds.length, affiliate);\n _mintSpecifyWithChecks(to, tokenIds);\n }\n\n function _mintSpecifyWithChecks(address to, uint256[] memory tokenIds)\n private\n {\n _checkPhase();\n if (_mintingType != MintingType.SPECIFY) revert InvalidMintingType();\n\n if (_soldTokens + (tokenIds.length) > _collectionSize) revert CollectionSoldOut();\n\n _mintSpecify(to, tokenIds);\n }\n\n function _mintSpecify(\n address to,\n uint256[] memory tokenIds,\n bool soulbound\n ) private {\n _mintSpecify(to, tokenIds);\n uint256 inputLength = tokenIds.length; \n if (soulbound) {\n for (uint256 i; i < inputLength; ) {\n _soulbound[tokenIds[i]] = true;\n unchecked {\n ++i;\n }\n }\n }\n }\n\n function _mintSpecify(address to, uint256[] memory tokenIds)\n internal\n virtual\n {\n\n uint256 inputLength = tokenIds.length;\n unchecked {\n _soldTokens += uint32(inputLength);\n }\n for (uint256 i; i < inputLength; ) {\n uint256 tokenId = tokenIds[i];\n\n if (tokenId == 0 || tokenId > _collectionSize) revert InvalidTokenId();\n _mint(to, tokenId);\n unchecked {\n ++i;\n }\n }\n }\n\n /// @notice Mints one NFT to `to` address. Requires `minting type` to be `customURI`.\n /// @param to The address of the NFTs receiver\n /// @param customURICIDHash The CID of the given token.\n /// @param soulbound True if the NFT is a Soulbound Token (SBT). If set, it can't be transferred.\n function mintCustomURITo(address to, bytes32 customURICIDHash, bool soulbound)\n external\n payable\n override\n {\n _requirePayment(_mintPrice, 1);\n _checkPhase();\n if (_mintingType != MintingType.CUSTOM_URI) revert InvalidMintingType();\n unchecked {\n if ((++_soldTokens) > _collectionSize) revert CollectionSoldOut();\n }\n _mint(to, _soldTokens);\n\n unchecked {\n if (soulbound) _soulbound[_soldTokens] = true;\n }\n _customURICIDHashes[_soldTokens] = customURICIDHash;\n }\n\n /// @notice Only owner can call this function. Free of charge. Mints sizeof(`to`) to `to` addresses. Requires `minting type` to be `sequential`.\n /// @param to The addresses of the NFTs receivers\n /// @param soulbound True if the NFT is a Soulbound Token (SBT). If set, it can't be transferred.\n function airdropSequential(address[] memory to, bool soulbound)\n external\n payable\n override\n onlyStrictOwner\n {\n if (_mintingType != MintingType.SEQUENTIAL) revert InvalidMintingType();\n if (_soldTokens + (to.length) > _collectionSize) revert CollectionSoldOut();\n\n uint256 toLength = to.length;\n for (uint256 i; i < toLength; ) {\n\n unchecked {\n _mint(to[i], ++_soldTokens); \n if (soulbound) _soulbound[_soldTokens] = true;\n ++i;\n }\n }\n }\n\n /// @notice Only owner can call this function. Free of charge. Mints sizeof(`to`) to `to` addresses with random tokenIds. Requires `minting type` to be `random`.\n /// @param to The addresses of the NFTs receivers\n /// @param soulbound True if the NFT is a Soulbound Token (SBT). If set, it can't be transferred.\n function airdropRandom(address[] memory to, bool soulbound)\n external\n payable\n override\n onlyOwner\n {\n uint256 toLength = to.length;\n if (_mintingType != MintingType.RANDOM) revert InvalidMintingType();\n\n if ((_soldTokens + toLength) > _collectionSize) revert CollectionSoldOut();\n\n unchecked {\n _soldTokens += uint32(toLength);\n }\n\n bytes32 randomSeed = blockhash(block.number - 1);\n\n for (uint256 i; i < toLength; ) {\n uint256 newTokenId = _randomTokenId(randomSeed, i);\n _mint(to[i], newTokenId);\n if (soulbound) _soulbound[newTokenId] = true;\n unchecked {\n ++i;\n }\n }\n }\n\n /// @notice Only owner can call this function. Free of charge. Mints sizeof(`to`) to `to` addresses with specified tokenIds. Requires `minting type` to be `specify`.\n /// @param to The addresses of the NFTs receivers\n /// @param tokenIds An array of the specified tokens. They must not be minted, otherwise, it will revert.\n /// @param soulbound True if the NFT is a Soulbound Token (SBT). If set, it can't be transferred.\n function airdropSpecify(\n address[] memory to,\n uint256[] memory tokenIds,\n bool soulbound\n ) external payable override onlyOwner {\n uint256 toLength = to.length;\n if (_mintingType != MintingType.SPECIFY) revert InvalidMintingType();\n\n if (_soldTokens + (tokenIds.length) > _collectionSize) revert CollectionSoldOut();\n if (toLength != tokenIds.length) revert InvalidInputSizesDontMatch();\n\n unchecked {\n _soldTokens += uint32(toLength);\n }\n\n for (uint256 i; i < toLength; ) {\n\n if (tokenIds[i] == 0 || tokenIds[i] > _collectionSize) revert InvalidTokenId();\n _mint(to[i], tokenIds[i]);\n if (soulbound) _soulbound[tokenIds[i]] = true;\n unchecked {\n ++i;\n }\n }\n }\n\n /// @notice Mints `amount` of NFTs to `to` address with optional specified tokenIds. This function must be called only if a valid `signature` is given during a whitelisting/presale.\n /// @param to The addresses of the NFTs receivers\n /// @param tokenIds An optional array of the specified tokens. They must not be minted, otherwise, it will revert. Only used if minting type is `specify`.\n /// @param freeMinting True is minting is free\n /// @param customFee Zero is fee is different from `mintingPrice`.\n /// @param maxAmount Max Amount to be minted with the given `signature`.\n /// @param amount Amount to mint.\n /// @param soulbound True if the NFT is a Soulbound Token (SBT). If set, it can't be transferred.\n /// @param signature Valid `signature` for the presale/whitelist.\n function mintPresale(\n address to,\n uint256[] memory tokenIds,\n bool freeMinting,\n uint256 customFee,\n uint256 maxAmount,\n uint256 amount,\n bool soulbound,\n bytes calldata signature\n ) external payable override {\n if (amount == 0) revert InvalidAmount();\n\n _usedAmountSignature[signature] += amount;\n if (_usedAmountSignature[signature] > maxAmount) revert NotEnoughAmountToMint();\n\n if (_soldTokens + amount > _collectionSize) revert CollectionSoldOut();\n\n if (_currentPhase == SalePhase.CLOSED) revert PresaleNotOpen();\n\n address signer = ECDSAUpgradeable.recover(\n ECDSAUpgradeable.toEthSignedMessageHash(\n keccak256(\n abi.encodePacked(\n this.mintPresale.selector, \n address(this), \n block.chainid, \n to,\n freeMinting,\n customFee,\n maxAmount,\n soulbound\n )\n )\n ),\n signature\n );\n\n if (signer != N2M_PRESALE_SIGNER && signer != owner()) revert SignatureMismatch();\n\n if (freeMinting) {\n\n if (msg.value != 0) revert InvalidMintFeeForFreeMinting();\n } else {\n\n if (customFee == 0) customFee = _mintPrice;\n _requirePayment(customFee, amount);\n }\n\n if (_mintingType == MintingType.SPECIFY) {\n\n if (tokenIds.length != amount) revert InvalidInputSizesDontMatch();\n _mintSpecify(to, tokenIds, soulbound);\n } else if (_mintingType == MintingType.RANDOM) {\n bytes32 seed = keccak256(abi.encodePacked(signature));\n _soldTokens += uint32(amount);\n _mintRandom(to, amount, seed, soulbound);\n } else if (_mintingType == MintingType.SEQUENTIAL) {\n _mintSequential(to, amount, soulbound);\n } else {\n\n revert PresaleInvalidMintingType();\n }\n }\n\n /// @notice Returns the minting price of one NFT.\n /// @return Mint price for one NFT in native coin or ERC-20.\n function mintPrice() external view returns (uint256) {\n return _mintPrice;\n }\n\n /// @notice Returns the current total supply.\n /// @return Current total supply.\n function totalSupply() external view returns (uint256) {\n return _soldTokens;\n }\n\n /// @notice Max amount of NFTs to be hold per address.\n /// @return Max per address allowed.\n function maxPerAddress() external view override returns (uint16) {\n return _maxPerAddress;\n }\n\n /// @notice Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of exchange. The royalty amount is denominated and should be paid in that same unit of exchange.\n /// @param salePrice The sale price\n /// @return receiver the receiver of the royalties.\n /// @return royaltyAmount the amount of the royalties for the given input.\n function royaltyInfo(\n uint256, \n uint256 salePrice\n ) external view virtual returns (address receiver, uint256 royaltyAmount) {\n\n return (address(this), uint256((salePrice * _royaltyFee) / 100_00));\n }\n\n function _requirePaymentWithAffiliates(uint256 amount, address affiliate)\n internal\n {\n uint16 currentUserDiscount;\n uint16 currentAffiliatePercentage;\n if (_affiliatesInfo[affiliate].enabled) {\n currentUserDiscount = _affiliatesInfo[affiliate].userDiscount;\n currentAffiliatePercentage = _affiliatesInfo[affiliate].affiliatePercentage;\n } else {\n currentUserDiscount = _affiliatesInfo[address(0)].userDiscount;\n currentAffiliatePercentage = _affiliatesInfo[address(0)].affiliatePercentage;\n }\n\n uint256 discountMintPrice = ((100_00 - currentUserDiscount) * _mintPrice) / 100_00;\n _requirePayment(discountMintPrice, amount);\n if (affiliate != address(0)) {\n uint256 affiliateAmount = (currentAffiliatePercentage * discountMintPrice * amount) / 100_00;\n _pendingTotalAffiliatesBalance += affiliateAmount;\n _pendingAffiliateBalance[affiliate] += affiliateAmount;\n emit AffiliateSell(affiliate);\n }\n }\n\n function _checkPhase() private {\n\n if (_currentPhase != SalePhase.PUBLIC) {\n if (_currentPhase == SalePhase.DROP_DATE) {\n if (block.timestamp >= _dropDateTimestamp) {\n _currentPhase = SalePhase.PUBLIC;\n delete(_dropDateTimestamp);\n } else {\n revert WaitUntilDropDate();\n }\n } else if (_currentPhase == SalePhase.DROP_AND_END_DATE) {\n if (block.timestamp < _dropDateTimestamp) {\n revert WaitUntilDropDate();\n }\n if (block.timestamp >= _endDateTimestamp) {\n revert SaleFinished();\n }\n } else {\n\n revert PublicSaleNotOpen();\n }\n }\n }\n\n function _requirePayment(uint256 p_mintPrice, uint256 amount) internal {\n if (_isERC20Payment == false) {\n\n if (msg.value != (p_mintPrice * amount)) revert InvalidMintFee();\n } else {\n\n if (p_mintPrice == 0) return;\n uint256 totalAmount = p_mintPrice * amount;\n\n SafeERC20Upgradeable.safeTransferFrom(\n IERC20Upgradeable(_erc20PaymentAddress),\n msg.sender,\n address(this),\n totalAmount\n );\n }\n }\n\n modifier onlyAllowedOperator() {\n\n _isOperatorAllowed(msg.sender);\n _;\n }\n\n modifier onlyAllowedOperatorApproval(address operator) {\n _isOperatorAllowed(operator);\n _;\n } \n\n function _isOperatorAllowed(address operator) private {\n if (_operatorFilterStatus == OperatorFilterStatus.ENABLED_EXISTS) {\n\n operatorFilterRegistry.isOperatorAllowed(address(this), operator);\n\n } else if (_operatorFilterStatus == OperatorFilterStatus.ENABLED_NOT_INITIALIZED) {\n\n if (address(operatorFilterRegistry).code.length > 0) {\n try operatorFilterRegistry.registerAndSubscribe(address(this), DEFAULT_SUBSCRIPTION) {\n\n _operatorFilterStatus = OperatorFilterStatus.ENABLED_EXISTS;\n operatorFilterRegistry.isOperatorAllowed(address(this), operator);\n } catch {\n }\n }\n } \n\n }\n\n fallback() external payable\n {\n address libraryAddress = LIBRARY_ADDRESS;\n\n assembly {\n\n calldatacopy(0, 0, calldatasize())\n\n let result := delegatecall(\n gas(),\n libraryAddress,\n 0,\n calldatasize(),\n 0,\n 0\n )\n\n returndatacopy(0, 0, returndatasize())\n\n switch result\n\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n receive() external payable {} \n}\n" }, "contracts/N2MVersion.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"@nfts2me/contracts/important/README.sol\";\n\n/// @title NFTs2Me.com Smart Contracts Version\n/// @author The NFTs2Me Team\n/// @notice Read our terms of service\n/// @custom:security-contact [email protected]\n/// @custom:terms-of-service https://nfts2me.com/terms-of-service/\n/// @custom:website https://nfts2me.com/\nabstract contract N2MVersion is Readme {\n /// @notice Current version of the nfts2me.com contracts.\n function n2mVersion() virtual external pure returns (uint256) {\n return 1000;\n }\n\n}\n" }, "contracts/ownable/NFTOwnableUpgradeable.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\";\n\n/// @title NFTs2Me.com Smart Contracts\n/// @author The NFTs2Me Team\n/// @notice Read our terms of service\n/// @custom:security-contact [email protected]\n/// @custom:terms-of-service https://nfts2me.com/terms-of-service/\n/// @custom:website https://nfts2me.com/\nabstract contract NFTOwnableUpgradeable is Initializable, ContextUpgradeable {\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n modifier onlyStrictOwner() {\n _checkStrictOwner();\n _;\n }\n\n modifier onlyOwnerOrN2M() {\n _checkOwnerOrN2M();\n _;\n }\n\n modifier onlyN2M() {\n _checkN2M();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address);\n function _strictOwner() internal view virtual returns (address);\n function _getN2MFeeAddress() internal view virtual returns (address);\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == msg.sender, \"Ownable: caller is not the owner\");\n }\n\n function _checkStrictOwner() internal view virtual {\n require(_strictOwner() == msg.sender, \"Ownable: caller is not the owner\");\n }\n\n function _checkOwnerOrN2M() internal view virtual {\n require(owner() == msg.sender || _getN2MFeeAddress() == msg.sender, \"Ownable: caller is not the owner\");\n }\n\n function _checkN2M() internal view virtual {\n require(_getN2MFeeAddress() == msg.sender, \"Ownable: caller is not the owner\");\n }\n\n}" }, "contracts/TextUtils.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\nbytes constant BASE64_TABLE = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n\n/// @title NFTs2Me.com TextUtils Library\n/// @author The NFTs2Me Team\n/// @notice Read our terms of service\n/// @custom:security-contact [email protected]\n/// @custom:terms-of-service https://nfts2me.com/terms-of-service/\n/// @custom:website https://nfts2me.com/\nlibrary TextUtils {\n\n /// @notice Encodes some bytes to the base64 representation\n function base64Encode(bytes memory data)\n internal\n pure\n returns (string memory)\n {\n uint256 len = data.length;\n if (len == 0) return \"\";\n\n uint256 encodedLen = 4 * ((len + 2) / 3);\n\n bytes memory result = new bytes(encodedLen + 32);\n\n bytes memory table = BASE64_TABLE;\n\n assembly {\n let tablePtr := add(table, 1)\n let resultPtr := add(result, 32)\n\n for {\n let i := 0\n } lt(i, len) {\n\n } {\n i := add(i, 3)\n let input := and(mload(add(data, i)), 0xffffff)\n\n let out := mload(add(tablePtr, and(shr(18, input), 0x3F)))\n out := shl(8, out)\n out := add(\n out,\n and(mload(add(tablePtr, and(shr(12, input), 0x3F))), 0xFF)\n )\n out := shl(8, out)\n out := add(\n out,\n and(mload(add(tablePtr, and(shr(6, input), 0x3F))), 0xFF)\n )\n out := shl(8, out)\n out := add(\n out,\n and(mload(add(tablePtr, and(input, 0x3F))), 0xFF)\n )\n out := shl(224, out)\n\n mstore(resultPtr, out)\n\n resultPtr := add(resultPtr, 4)\n }\n\n switch mod(len, 3)\n case 1 {\n mstore(sub(resultPtr, 2), shl(240, 0x3d3d))\n }\n case 2 {\n mstore(sub(resultPtr, 1), shl(248, 0x3d))\n }\n\n mstore(result, encodedLen)\n }\n\n return string(result);\n }\n\n function escapeQuotesAndBackslash(string memory symbol)\n internal\n pure\n returns (string memory)\n {\n bytes memory symbolBytes = bytes(symbol);\n uint8 quotesCount;\n for (uint8 i; i < symbolBytes.length; ) {\n if (symbolBytes[i] == '\"' || symbolBytes[i] == \"\\\\\") {\n unchecked {\n ++quotesCount;\n }\n }\n unchecked {\n ++i;\n }\n }\n if (quotesCount > 0) {\n bytes memory escapedBytes = new bytes(\n symbolBytes.length + (quotesCount)\n );\n uint256 index;\n for (uint8 i; i < symbolBytes.length; ) {\n if (symbolBytes[i] == '\"' || symbolBytes[i] == \"\\\\\") {\n escapedBytes[index++] = \"\\\\\";\n }\n escapedBytes[index++] = symbolBytes[i];\n unchecked {\n ++i;\n }\n }\n return string(escapedBytes);\n }\n return symbol;\n } \n}" } }, "settings": { "optimizer": { "enabled": true, "runs": 17766 }, "viaIR": true, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} } }}
1
19,493,371
a0976c99c993f0abeffad3edcbd9f620e49716846e28dc8e191ce924807f197d
5292b47e56f34c4b5375ed5a7fffb5afe0c2fd49bec0f39d8dfc8d61c2cb3cdd
df500893c0cf9e4de237a84e3c498ba9306fed6a
a11c7eadc744599cc2dd52f945ecbff89300f7ea
a206efed2a82c7f6bf9baaa3269394a16b13f970
608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe
1
19,493,372
b70abd663754d2fa4e7acf4423007e72ced9ab168ba6a85afe5825cb216ad493
d300c8dc88d1ffa84a6f6298a8444b19d8f5cc790991a84304ec17a9213aae73
00bdb5699745f5b860228c8f939abf1b9ae374ed
ffa397285ce46fb78c588a9e993286aac68c37cd
437af4bd71cfcaa90e24c73919e4be27c68018a8
3d602d80600a3d3981f3363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73059ffafdc6ef594230de44f824e2bd0a51ca5ded5af43d82803e903d91602b57fd5bf3
pragma solidity 0.7.5; /* The MIT License (MIT) Copyright (c) 2018 Murray Software, LLC. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //solhint-disable max-line-length //solhint-disable no-inline-assembly contract CloneFactory { function createClone(address target, bytes32 salt) internal returns (address payable result) { bytes20 targetBytes = bytes20(target); assembly { // load the next free memory slot as a place to store the clone contract data let clone := mload(0x40) // The bytecode block below is responsible for contract initialization // during deployment, it is worth noting the proxied contract constructor will not be called during // the cloning procedure and that is why an initialization function needs to be called after the // clone is created mstore( clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000 ) // This stores the address location of the implementation contract // so that the proxy knows where to delegate call logic to mstore(add(clone, 0x14), targetBytes) // The bytecode block is the actual code that is deployed for each clone created. // It forwards all calls to the already deployed implementation via a delegatecall mstore( add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000 ) // deploy the contract using the CREATE2 opcode // this deploys the minimal proxy defined above, which will proxy all // calls to use the logic defined in the implementation contract `target` result := create2(0, clone, 0x37, salt) } } function isClone(address target, address query) internal view returns (bool result) { bytes20 targetBytes = bytes20(target); assembly { // load the next free memory slot as a place to store the comparison clone let clone := mload(0x40) // The next three lines store the expected bytecode for a miniml proxy // that targets `target` as its implementation contract mstore( clone, 0x363d3d373d3d3d363d7300000000000000000000000000000000000000000000 ) mstore(add(clone, 0xa), targetBytes) mstore( add(clone, 0x1e), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000 ) // the next two lines store the bytecode of the contract that we are checking in memory let other := add(clone, 0x40) extcodecopy(query, other, 0, 0x2d) // Check if the expected bytecode equals the actual bytecode and return the result result := and( eq(mload(clone), mload(other)), eq(mload(add(clone, 0xd)), mload(add(other, 0xd))) ) } } } /** * Contract that exposes the needed erc20 token functions */ abstract contract ERC20Interface { // Send _value amount of tokens to address _to function transfer(address _to, uint256 _value) public virtual returns (bool success); // Get the account balance of another account with address _owner function balanceOf(address _owner) public virtual view returns (uint256 balance); } // helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false library TransferHelper { function safeApprove( address token, address to, uint256 value ) internal { // bytes4(keccak256(bytes('approve(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::safeApprove: approve failed' ); } function safeTransfer( address token, address to, uint256 value ) internal { // bytes4(keccak256(bytes('transfer(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::safeTransfer: transfer failed' ); } function safeTransferFrom( address token, address from, address to, uint256 value ) internal { // bytes4(keccak256(bytes('transferFrom(address,address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value)); require( success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper::transferFrom: transferFrom failed' ); } function safeTransferETH(address to, uint256 value) internal { (bool success, ) = to.call{value: value}(new bytes(0)); require(success, 'TransferHelper::safeTransferETH: ETH transfer failed'); } } /** * Contract that will forward any incoming Ether to the creator of the contract * */ contract Forwarder { // Address to which any funds sent to this contract will be forwarded address public parentAddress; event ForwarderDeposited(address from, uint256 value, bytes data); /** * Initialize the contract, and sets the destination address to that of the creator */ function init(address _parentAddress) external onlyUninitialized { parentAddress = _parentAddress; uint256 value = address(this).balance; if (value == 0) { return; } (bool success, ) = parentAddress.call{ value: value }(''); require(success, 'Flush failed'); // NOTE: since we are forwarding on initialization, // we don't have the context of the original sender. // We still emit an event about the forwarding but set // the sender to the forwarder itself emit ForwarderDeposited(address(this), value, msg.data); } /** * Modifier that will execute internal code block only if the sender is the parent address */ modifier onlyParent { require(msg.sender == parentAddress, 'Only Parent'); _; } /** * Modifier that will execute internal code block only if the contract has not been initialized yet */ modifier onlyUninitialized { require(parentAddress == address(0x0), 'Already initialized'); _; } /** * Default function; Gets called when data is sent but does not match any other function */ fallback() external payable { flush(); } /** * Default function; Gets called when Ether is deposited with no data, and forwards it to the parent address */ receive() external payable { flush(); } /** * Execute a token transfer of the full balance from the forwarder token to the parent address * @param tokenContractAddress the address of the erc20 token contract */ function flushTokens(address tokenContractAddress) external onlyParent { ERC20Interface instance = ERC20Interface(tokenContractAddress); address forwarderAddress = address(this); uint256 forwarderBalance = instance.balanceOf(forwarderAddress); if (forwarderBalance == 0) { return; } TransferHelper.safeTransfer( tokenContractAddress, parentAddress, forwarderBalance ); } /** * Flush the entire balance of the contract to the parent address. */ function flush() public { uint256 value = address(this).balance; if (value == 0) { return; } (bool success, ) = parentAddress.call{ value: value }(''); require(success, 'Flush failed'); emit ForwarderDeposited(msg.sender, value, msg.data); } } contract ForwarderFactory is CloneFactory { address public implementationAddress; event ForwarderCreated(address newForwarderAddress, address parentAddress); constructor(address _implementationAddress) { implementationAddress = _implementationAddress; } function createForwarder(address parent, bytes32 salt) external { // include the signers in the salt so any contract deployed to a given address must have the same signers bytes32 finalSalt = keccak256(abi.encodePacked(parent, salt)); address payable clone = createClone(implementationAddress, finalSalt); Forwarder(clone).init(parent); emit ForwarderCreated(clone, parent); } }
1
19,493,376
09705f6cdf944a4c98b7bef79983986ab391157d932ffcc8f8e2cd8e67e44433
dfb8f02c38ae90bbbf78d007ce8547213327babb377e28157bf6bb3aad4a0dcf
4b086554f5405313e8c4d2072efe181546dd2154
f041690d9cbe398d3d51f25c87902c1403affe66
8b0560c22d285e9cac67d8ddf93c28e700be9cd1
3d602d80600a3d3981f3363d3d373d3d3d363d73d29bb41f2f507638f6d42805268ba7c7f8c0ecb35af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73d29bb41f2f507638f6d42805268ba7c7f8c0ecb35af43d82803e903d91602b57fd5bf3
1
19,493,376
09705f6cdf944a4c98b7bef79983986ab391157d932ffcc8f8e2cd8e67e44433
138a4d77d61796e0fe6a88f103c0c436ace07439e6b2a6b030f5212b440b61a8
9d84bcb3be25ed408dc245c7693bca216e879ffc
6e95c8e8557abc08b46f3c347ba06f8dc012763f
503a732d50fa081742925546236bb8be3ace1a03
606060405234156200001057600080fd5b60405162002616380380620026168339810160405280805182019190602001805190602001909190805190602001909190505082826000825182603282111580156200005c5750818111155b80156200006a575060008114155b801562000078575060008214155b15156200008457600080fd5b600092505b8451831015620001bf57600260008685815181101515620000a657fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015620001355750600085848151811015156200011257fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1614155b15156200014157600080fd5b60016002600087868151811015156200015657fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550828060010193505062000089565b8460039080519060200190620001d7929190620001f4565b5083600481905550505050505080600681905550505050620002c9565b82805482825590600052602060002090810192821562000270579160200282015b828111156200026f5782518260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509160200191906001019062000215565b5b5090506200027f919062000283565b5090565b620002c691905b80821115620002c257600081816101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055506001016200028a565b5090565b90565b61233d80620002d96000396000f300606060405260043610610154576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c27146101ae578063173825d91461021157806320ea8d861461024a5780632f54bf6e1461026d5780633411c81c146102be5780634bc9fdc214610318578063547415251461034157806367eeba0c146103855780636b0c932d146103ae5780637065cb48146103d7578063784547a7146104105780638b51d13f1461044b5780639ace38c214610482578063a0e67e2b14610580578063a8abe69a146105ea578063b5dc40c314610681578063b77bf600146106f9578063ba51a6df14610722578063c01a8c8414610745578063c642747414610768578063cea0862114610801578063d74f8edd14610824578063dc8452cd1461084d578063e20056e614610876578063ee22610b146108ce578063f059cf2b146108f1575b60003411156101ac573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b005b34156101b957600080fd5b6101cf600480803590602001909190505061091a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561021c57600080fd5b610248600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610959565b005b341561025557600080fd5b61026b6004808035906020019091905050610bf5565b005b341561027857600080fd5b6102a4600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d9d565b604051808215151515815260200191505060405180910390f35b34156102c957600080fd5b6102fe600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610dbd565b604051808215151515815260200191505060405180910390f35b341561032357600080fd5b61032b610dec565b6040518082815260200191505060405180910390f35b341561034c57600080fd5b61036f600480803515159060200190919080351515906020019091905050610e29565b6040518082815260200191505060405180910390f35b341561039057600080fd5b610398610ebb565b6040518082815260200191505060405180910390f35b34156103b957600080fd5b6103c1610ec1565b6040518082815260200191505060405180910390f35b34156103e257600080fd5b61040e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ec7565b005b341561041b57600080fd5b61043160048080359060200190919050506110c9565b604051808215151515815260200191505060405180910390f35b341561045657600080fd5b61046c60048080359060200190919050506111af565b6040518082815260200191505060405180910390f35b341561048d57600080fd5b6104a3600480803590602001909190505061127b565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001848152602001806020018315151515815260200182810382528481815460018160011615610100020316600290048152602001915080546001816001161561010002031660029004801561056e5780601f106105435761010080835404028352916020019161056e565b820191906000526020600020905b81548152906001019060200180831161055157829003601f168201915b50509550505050505060405180910390f35b341561058b57600080fd5b6105936112d7565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156105d65780820151818401526020810190506105bb565b505050509050019250505060405180910390f35b34156105f557600080fd5b61062a60048080359060200190919080359060200190919080351515906020019091908035151590602001909190505061136b565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561066d578082015181840152602081019050610652565b505050509050019250505060405180910390f35b341561068c57600080fd5b6106a260048080359060200190919050506114c7565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106e55780820151818401526020810190506106ca565b505050509050019250505060405180910390f35b341561070457600080fd5b61070c6116f1565b6040518082815260200191505060405180910390f35b341561072d57600080fd5b61074360048080359060200190919050506116f7565b005b341561075057600080fd5b61076660048080359060200190919050506117b1565b005b341561077357600080fd5b6107eb600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190505061198e565b6040518082815260200191505060405180910390f35b341561080c57600080fd5b61082260048080359060200190919050506119ad565b005b341561082f57600080fd5b610837611a28565b6040518082815260200191505060405180910390f35b341561085857600080fd5b610860611a2d565b6040518082815260200191505060405180910390f35b341561088157600080fd5b6108cc600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611a33565b005b34156108d957600080fd5b6108ef6004808035906020019091905050611d4a565b005b34156108fc57600080fd5b610904612042565b6040518082815260200191505060405180910390f35b60038181548110151561092957fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561099557600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156109ee57600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600091505b600160038054905003821015610b76578273ffffffffffffffffffffffffffffffffffffffff16600383815481101515610a8157fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610b69576003600160038054905003815481101515610ae057fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600383815481101515610b1b57fe5b906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610b76565b8180600101925050610a4b565b6001600381818054905003915081610b8e91906121ec565b506003805490506004541115610bad57610bac6003805490506116f7565b5b8273ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a2505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610c4e57600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610cb957600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff16151515610ce957600080fd5b60006001600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35050505050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b60006201518060075401421115610e07576006549050610e26565b6008546006541015610e1c5760009050610e26565b6008546006540390505b90565b600080600090505b600554811015610eb457838015610e68575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80610e9b5750828015610e9a575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15610ea7576001820191505b8080600101915050610e31565b5092915050565b60065481565b60075481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f0157600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610f5b57600080fd5b8160008173ffffffffffffffffffffffffffffffffffffffff1614151515610f8257600080fd5b60016003805490500160045460328211158015610f9f5750818111155b8015610fac575060008114155b8015610fb9575060008214155b1515610fc457600080fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600380548060010182816110309190612218565b9160005260206000209001600087909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b6000806000809150600090505b6003805490508110156111a75760016000858152602001908152602001600020600060038381548110151561110757fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611187576001820191505b60045482141561119a57600192506111a8565b80806001019150506110d6565b5b5050919050565b600080600090505b600380549050811015611275576001600084815260200190815260200160002060006003838154811015156111e857fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611268576001820191505b80806001019150506111b7565b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169080600101549080600201908060030160009054906101000a900460ff16905084565b6112df612244565b600380548060200260200160405190810160405280929190818152602001828054801561136157602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611317575b5050505050905090565b611373612258565b61137b612258565b60008060055460405180591061138e5750595b9080825280602002602001820160405250925060009150600090505b60055481101561144a578580156113e1575060008082815260200190815260200160002060030160009054906101000a900460ff16155b806114145750848015611413575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b1561143d5780838381518110151561142857fe5b90602001906020020181815250506001820191505b80806001019150506113aa565b87870360405180591061145a5750595b908082528060200260200182016040525093508790505b868110156114bc57828181518110151561148757fe5b90602001906020020151848983038151811015156114a157fe5b90602001906020020181815250508080600101915050611471565b505050949350505050565b6114cf612244565b6114d7612244565b6000806003805490506040518059106114ed5750595b9080825280602002602001820160405250925060009150600090505b60038054905081101561164c5760016000868152602001908152602001600020600060038381548110151561153a57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561163f576003818154811015156115c257fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683838151811015156115fc57fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b8080600101915050611509565b8160405180591061165a5750595b90808252806020026020018201604052509350600090505b818110156116e957828181518110151561168857fe5b9060200190602002015184828151811015156116a057fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508080600101915050611672565b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561173157600080fd5b60038054905081603282111580156117495750818111155b8015611756575060008114155b8015611763575060008214155b151561176e57600080fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a1505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561180a57600080fd5b81600080600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561186657600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156118d257600080fd5b600180600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a361198785611d4a565b5050505050565b600061199b848484612048565b90506119a6816117b1565b9392505050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156119e757600080fd5b806006819055507fc71bdc6afaf9b1aa90a7078191d4fc1adf3bf680fca3183697df6b0dc226bca2816040518082815260200191505060405180910390a150565b603281565b60045481565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a6f57600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611ac857600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515611b2257600080fd5b600092505b600380549050831015611c0d578473ffffffffffffffffffffffffffffffffffffffff16600384815481101515611b5a57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611c005783600384815481101515611bb257fe5b906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611c0d565b8280600101935050611b27565b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b60008033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611da657600080fd5b83336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611e1157600080fd5b8560008082815260200190815260200160002060030160009054906101000a900460ff16151515611e4157600080fd5b6000808881526020019081526020016000209550611e5e876110c9565b94508480611e995750600086600201805460018160011615610100020316600290049050148015611e985750611e97866001015461219a565b5b5b156120395760018660030160006101000a81548160ff021916908315150217905550841515611ed75785600101546008600082825401925050819055505b8560000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168660010154876002016040518082805460018160011615610100020316600290048015611f805780601f10611f5557610100808354040283529160200191611f80565b820191906000526020600020905b815481529060010190602001808311611f6357829003601f168201915b505091505060006040518083038185876187965a03f19250505015611fd157867f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2612038565b867f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008660030160006101000a81548160ff0219169083151502179055508415156120375785600101546008600082825403925050819055505b5b5b50505050505050565b60085481565b60008360008173ffffffffffffffffffffffffffffffffffffffff161415151561207157600080fd5b60055491506080604051908101604052808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020016000151581525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010155604082015181600201908051906020019061213092919061226c565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a2509392505050565b600062015180600754014211156121bb574260078190555060006008819055505b600654826008540111806121d457506008548260085401105b156121e257600090506121e7565b600190505b919050565b8154818355818115116122135781836000526020600020918201910161221291906122ec565b5b505050565b81548183558181151161223f5781836000526020600020918201910161223e91906122ec565b5b505050565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106122ad57805160ff19168380011785556122db565b828001600101855582156122db579182015b828111156122da5782518255916020019190600101906122bf565b5b5090506122e891906122ec565b5090565b61230e91905b8082111561230a5760008160009055506001016122f2565b5090565b905600a165627a7a7230582061d97df6cd7fe87779d9fa28992d2fb80b4429a67017241e906d53439973c7c9002900000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000007878135c1f90db13124b104c52015b5483643ade000000000000000000000000f584653dfd866ea44328de6e000262e3c459b3020000000000000000000000001e0a96b69b6aed667438f4cd9e527f0390e5c1eb
606060405260043610610154576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c27146101ae578063173825d91461021157806320ea8d861461024a5780632f54bf6e1461026d5780633411c81c146102be5780634bc9fdc214610318578063547415251461034157806367eeba0c146103855780636b0c932d146103ae5780637065cb48146103d7578063784547a7146104105780638b51d13f1461044b5780639ace38c214610482578063a0e67e2b14610580578063a8abe69a146105ea578063b5dc40c314610681578063b77bf600146106f9578063ba51a6df14610722578063c01a8c8414610745578063c642747414610768578063cea0862114610801578063d74f8edd14610824578063dc8452cd1461084d578063e20056e614610876578063ee22610b146108ce578063f059cf2b146108f1575b60003411156101ac573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b005b34156101b957600080fd5b6101cf600480803590602001909190505061091a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561021c57600080fd5b610248600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610959565b005b341561025557600080fd5b61026b6004808035906020019091905050610bf5565b005b341561027857600080fd5b6102a4600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d9d565b604051808215151515815260200191505060405180910390f35b34156102c957600080fd5b6102fe600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610dbd565b604051808215151515815260200191505060405180910390f35b341561032357600080fd5b61032b610dec565b6040518082815260200191505060405180910390f35b341561034c57600080fd5b61036f600480803515159060200190919080351515906020019091905050610e29565b6040518082815260200191505060405180910390f35b341561039057600080fd5b610398610ebb565b6040518082815260200191505060405180910390f35b34156103b957600080fd5b6103c1610ec1565b6040518082815260200191505060405180910390f35b34156103e257600080fd5b61040e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ec7565b005b341561041b57600080fd5b61043160048080359060200190919050506110c9565b604051808215151515815260200191505060405180910390f35b341561045657600080fd5b61046c60048080359060200190919050506111af565b6040518082815260200191505060405180910390f35b341561048d57600080fd5b6104a3600480803590602001909190505061127b565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001848152602001806020018315151515815260200182810382528481815460018160011615610100020316600290048152602001915080546001816001161561010002031660029004801561056e5780601f106105435761010080835404028352916020019161056e565b820191906000526020600020905b81548152906001019060200180831161055157829003601f168201915b50509550505050505060405180910390f35b341561058b57600080fd5b6105936112d7565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156105d65780820151818401526020810190506105bb565b505050509050019250505060405180910390f35b34156105f557600080fd5b61062a60048080359060200190919080359060200190919080351515906020019091908035151590602001909190505061136b565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561066d578082015181840152602081019050610652565b505050509050019250505060405180910390f35b341561068c57600080fd5b6106a260048080359060200190919050506114c7565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106e55780820151818401526020810190506106ca565b505050509050019250505060405180910390f35b341561070457600080fd5b61070c6116f1565b6040518082815260200191505060405180910390f35b341561072d57600080fd5b61074360048080359060200190919050506116f7565b005b341561075057600080fd5b61076660048080359060200190919050506117b1565b005b341561077357600080fd5b6107eb600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190505061198e565b6040518082815260200191505060405180910390f35b341561080c57600080fd5b61082260048080359060200190919050506119ad565b005b341561082f57600080fd5b610837611a28565b6040518082815260200191505060405180910390f35b341561085857600080fd5b610860611a2d565b6040518082815260200191505060405180910390f35b341561088157600080fd5b6108cc600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611a33565b005b34156108d957600080fd5b6108ef6004808035906020019091905050611d4a565b005b34156108fc57600080fd5b610904612042565b6040518082815260200191505060405180910390f35b60038181548110151561092957fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561099557600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156109ee57600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600091505b600160038054905003821015610b76578273ffffffffffffffffffffffffffffffffffffffff16600383815481101515610a8157fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610b69576003600160038054905003815481101515610ae057fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600383815481101515610b1b57fe5b906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610b76565b8180600101925050610a4b565b6001600381818054905003915081610b8e91906121ec565b506003805490506004541115610bad57610bac6003805490506116f7565b5b8273ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a2505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610c4e57600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610cb957600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff16151515610ce957600080fd5b60006001600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35050505050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b60006201518060075401421115610e07576006549050610e26565b6008546006541015610e1c5760009050610e26565b6008546006540390505b90565b600080600090505b600554811015610eb457838015610e68575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80610e9b5750828015610e9a575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15610ea7576001820191505b8080600101915050610e31565b5092915050565b60065481565b60075481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f0157600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610f5b57600080fd5b8160008173ffffffffffffffffffffffffffffffffffffffff1614151515610f8257600080fd5b60016003805490500160045460328211158015610f9f5750818111155b8015610fac575060008114155b8015610fb9575060008214155b1515610fc457600080fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600380548060010182816110309190612218565b9160005260206000209001600087909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b6000806000809150600090505b6003805490508110156111a75760016000858152602001908152602001600020600060038381548110151561110757fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611187576001820191505b60045482141561119a57600192506111a8565b80806001019150506110d6565b5b5050919050565b600080600090505b600380549050811015611275576001600084815260200190815260200160002060006003838154811015156111e857fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611268576001820191505b80806001019150506111b7565b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169080600101549080600201908060030160009054906101000a900460ff16905084565b6112df612244565b600380548060200260200160405190810160405280929190818152602001828054801561136157602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611317575b5050505050905090565b611373612258565b61137b612258565b60008060055460405180591061138e5750595b9080825280602002602001820160405250925060009150600090505b60055481101561144a578580156113e1575060008082815260200190815260200160002060030160009054906101000a900460ff16155b806114145750848015611413575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b1561143d5780838381518110151561142857fe5b90602001906020020181815250506001820191505b80806001019150506113aa565b87870360405180591061145a5750595b908082528060200260200182016040525093508790505b868110156114bc57828181518110151561148757fe5b90602001906020020151848983038151811015156114a157fe5b90602001906020020181815250508080600101915050611471565b505050949350505050565b6114cf612244565b6114d7612244565b6000806003805490506040518059106114ed5750595b9080825280602002602001820160405250925060009150600090505b60038054905081101561164c5760016000868152602001908152602001600020600060038381548110151561153a57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561163f576003818154811015156115c257fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683838151811015156115fc57fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b8080600101915050611509565b8160405180591061165a5750595b90808252806020026020018201604052509350600090505b818110156116e957828181518110151561168857fe5b9060200190602002015184828151811015156116a057fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508080600101915050611672565b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561173157600080fd5b60038054905081603282111580156117495750818111155b8015611756575060008114155b8015611763575060008214155b151561176e57600080fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a1505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561180a57600080fd5b81600080600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561186657600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156118d257600080fd5b600180600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a361198785611d4a565b5050505050565b600061199b848484612048565b90506119a6816117b1565b9392505050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156119e757600080fd5b806006819055507fc71bdc6afaf9b1aa90a7078191d4fc1adf3bf680fca3183697df6b0dc226bca2816040518082815260200191505060405180910390a150565b603281565b60045481565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a6f57600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611ac857600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515611b2257600080fd5b600092505b600380549050831015611c0d578473ffffffffffffffffffffffffffffffffffffffff16600384815481101515611b5a57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611c005783600384815481101515611bb257fe5b906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611c0d565b8280600101935050611b27565b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b60008033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611da657600080fd5b83336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611e1157600080fd5b8560008082815260200190815260200160002060030160009054906101000a900460ff16151515611e4157600080fd5b6000808881526020019081526020016000209550611e5e876110c9565b94508480611e995750600086600201805460018160011615610100020316600290049050148015611e985750611e97866001015461219a565b5b5b156120395760018660030160006101000a81548160ff021916908315150217905550841515611ed75785600101546008600082825401925050819055505b8560000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168660010154876002016040518082805460018160011615610100020316600290048015611f805780601f10611f5557610100808354040283529160200191611f80565b820191906000526020600020905b815481529060010190602001808311611f6357829003601f168201915b505091505060006040518083038185876187965a03f19250505015611fd157867f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2612038565b867f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008660030160006101000a81548160ff0219169083151502179055508415156120375785600101546008600082825403925050819055505b5b5b50505050505050565b60085481565b60008360008173ffffffffffffffffffffffffffffffffffffffff161415151561207157600080fd5b60055491506080604051908101604052808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020016000151581525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010155604082015181600201908051906020019061213092919061226c565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a2509392505050565b600062015180600754014211156121bb574260078190555060006008819055505b600654826008540111806121d457506008548260085401105b156121e257600090506121e7565b600190505b919050565b8154818355818115116122135781836000526020600020918201910161221291906122ec565b5b505050565b81548183558181151161223f5781836000526020600020918201910161223e91906122ec565b5b505050565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106122ad57805160ff19168380011785556122db565b828001600101855582156122db579182015b828111156122da5782518255916020019190600101906122bf565b5b5090506122e891906122ec565b5090565b61230e91905b8082111561230a5760008160009055506001016122f2565b5090565b905600a165627a7a7230582061d97df6cd7fe87779d9fa28992d2fb80b4429a67017241e906d53439973c7c90029
contract Factory { /* * Events */ event ContractInstantiation(address sender, address instantiation); /* * Storage */ mapping(address => bool) public isInstantiation; mapping(address => address[]) public instantiations; /* * Public functions */ /// @dev Returns number of instantiations by creator. /// @param creator Contract creator. /// @return Returns number of instantiations by creator. function getInstantiationCount(address creator) public constant returns (uint) { return instantiations[creator].length; } /* * Internal functions */ /// @dev Registers contract in factory registry. /// @param instantiation Address of contract instantiation. function register(address instantiation) internal { isInstantiation[instantiation] = true; instantiations[msg.sender].push(instantiation); ContractInstantiation(msg.sender, instantiation); } } /// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution. /// @author Stefan George - <[email protected]> contract MultiSigWallet { /* * Events */ event Confirmation(address indexed sender, uint indexed transactionId); event Revocation(address indexed sender, uint indexed transactionId); event Submission(uint indexed transactionId); event Execution(uint indexed transactionId); event ExecutionFailure(uint indexed transactionId); event Deposit(address indexed sender, uint value); event OwnerAddition(address indexed owner); event OwnerRemoval(address indexed owner); event RequirementChange(uint required); /* * Constants */ uint constant public MAX_OWNER_COUNT = 50; /* * Storage */ mapping (uint => Transaction) public transactions; mapping (uint => mapping (address => bool)) public confirmations; mapping (address => bool) public isOwner; address[] public owners; uint public required; uint public transactionCount; struct Transaction { address destination; uint value; bytes data; bool executed; } /* * Modifiers */ modifier onlyWallet() { require(msg.sender == address(this)); _; } modifier ownerDoesNotExist(address owner) { require(!isOwner[owner]); _; } modifier ownerExists(address owner) { require(isOwner[owner]); _; } modifier transactionExists(uint transactionId) { require(transactions[transactionId].destination != 0); _; } modifier confirmed(uint transactionId, address owner) { require(confirmations[transactionId][owner]); _; } modifier notConfirmed(uint transactionId, address owner) { require(!confirmations[transactionId][owner]); _; } modifier notExecuted(uint transactionId) { require(!transactions[transactionId].executed); _; } modifier notNull(address _address) { require(_address != 0); _; } modifier validRequirement(uint ownerCount, uint _required) { require(ownerCount <= MAX_OWNER_COUNT && _required <= ownerCount && _required != 0 && ownerCount != 0); _; } /// @dev Fallback function allows to deposit ether. function() payable { if (msg.value > 0) Deposit(msg.sender, msg.value); } /* * Public functions */ /// @dev Contract constructor sets initial owners and required number of confirmations. /// @param _owners List of initial owners. /// @param _required Number of required confirmations. function MultiSigWallet(address[] _owners, uint _required) public validRequirement(_owners.length, _required) { for (uint i=0; i<_owners.length; i++) { require(!isOwner[_owners[i]] && _owners[i] != 0); isOwner[_owners[i]] = true; } owners = _owners; required = _required; } /// @dev Allows to add a new owner. Transaction has to be sent by wallet. /// @param owner Address of new owner. function addOwner(address owner) public onlyWallet ownerDoesNotExist(owner) notNull(owner) validRequirement(owners.length + 1, required) { isOwner[owner] = true; owners.push(owner); OwnerAddition(owner); } /// @dev Allows to remove an owner. Transaction has to be sent by wallet. /// @param owner Address of owner. function removeOwner(address owner) public onlyWallet ownerExists(owner) { isOwner[owner] = false; for (uint i=0; i<owners.length - 1; i++) if (owners[i] == owner) { owners[i] = owners[owners.length - 1]; break; } owners.length -= 1; if (required > owners.length) changeRequirement(owners.length); OwnerRemoval(owner); } /// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet. /// @param owner Address of owner to be replaced. /// @param newOwner Address of new owner. function replaceOwner(address owner, address newOwner) public onlyWallet ownerExists(owner) ownerDoesNotExist(newOwner) { for (uint i=0; i<owners.length; i++) if (owners[i] == owner) { owners[i] = newOwner; break; } isOwner[owner] = false; isOwner[newOwner] = true; OwnerRemoval(owner); OwnerAddition(newOwner); } /// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet. /// @param _required Number of required confirmations. function changeRequirement(uint _required) public onlyWallet validRequirement(owners.length, _required) { required = _required; RequirementChange(_required); } /// @dev Allows an owner to submit and confirm a transaction. /// @param destination Transaction target address. /// @param value Transaction ether value. /// @param data Transaction data payload. /// @return Returns transaction ID. function submitTransaction(address destination, uint value, bytes data) public returns (uint transactionId) { transactionId = addTransaction(destination, value, data); confirmTransaction(transactionId); } /// @dev Allows an owner to confirm a transaction. /// @param transactionId Transaction ID. function confirmTransaction(uint transactionId) public ownerExists(msg.sender) transactionExists(transactionId) notConfirmed(transactionId, msg.sender) { confirmations[transactionId][msg.sender] = true; Confirmation(msg.sender, transactionId); executeTransaction(transactionId); } /// @dev Allows an owner to revoke a confirmation for a transaction. /// @param transactionId Transaction ID. function revokeConfirmation(uint transactionId) public ownerExists(msg.sender) confirmed(transactionId, msg.sender) notExecuted(transactionId) { confirmations[transactionId][msg.sender] = false; Revocation(msg.sender, transactionId); } /// @dev Allows anyone to execute a confirmed transaction. /// @param transactionId Transaction ID. function executeTransaction(uint transactionId) public ownerExists(msg.sender) confirmed(transactionId, msg.sender) notExecuted(transactionId) { if (isConfirmed(transactionId)) { Transaction storage txn = transactions[transactionId]; txn.executed = true; if (txn.destination.call.value(txn.value)(txn.data)) Execution(transactionId); else { ExecutionFailure(transactionId); txn.executed = false; } } } /// @dev Returns the confirmation status of a transaction. /// @param transactionId Transaction ID. /// @return Confirmation status. function isConfirmed(uint transactionId) public constant returns (bool) { uint count = 0; for (uint i=0; i<owners.length; i++) { if (confirmations[transactionId][owners[i]]) count += 1; if (count == required) return true; } } /* * Internal functions */ /// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet. /// @param destination Transaction target address. /// @param value Transaction ether value. /// @param data Transaction data payload. /// @return Returns transaction ID. function addTransaction(address destination, uint value, bytes data) internal notNull(destination) returns (uint transactionId) { transactionId = transactionCount; transactions[transactionId] = Transaction({ destination: destination, value: value, data: data, executed: false }); transactionCount += 1; Submission(transactionId); } /* * Web3 call functions */ /// @dev Returns number of confirmations of a transaction. /// @param transactionId Transaction ID. /// @return Number of confirmations. function getConfirmationCount(uint transactionId) public constant returns (uint count) { for (uint i=0; i<owners.length; i++) if (confirmations[transactionId][owners[i]]) count += 1; } /// @dev Returns total number of transactions after filers are applied. /// @param pending Include pending transactions. /// @param executed Include executed transactions. /// @return Total number of transactions after filters are applied. function getTransactionCount(bool pending, bool executed) public constant returns (uint count) { for (uint i=0; i<transactionCount; i++) if ( pending && !transactions[i].executed || executed && transactions[i].executed) count += 1; } /// @dev Returns list of owners. /// @return List of owner addresses. function getOwners() public constant returns (address[]) { return owners; } /// @dev Returns array with owner addresses, which confirmed transaction. /// @param transactionId Transaction ID. /// @return Returns array of owner addresses. function getConfirmations(uint transactionId) public constant returns (address[] _confirmations) { address[] memory confirmationsTemp = new address[](owners.length); uint count = 0; uint i; for (i=0; i<owners.length; i++) if (confirmations[transactionId][owners[i]]) { confirmationsTemp[count] = owners[i]; count += 1; } _confirmations = new address[](count); for (i=0; i<count; i++) _confirmations[i] = confirmationsTemp[i]; } /// @dev Returns list of transaction IDs in defined range. /// @param from Index start position of transaction array. /// @param to Index end position of transaction array. /// @param pending Include pending transactions. /// @param executed Include executed transactions. /// @return Returns array of transaction IDs. function getTransactionIds(uint from, uint to, bool pending, bool executed) public constant returns (uint[] _transactionIds) { uint[] memory transactionIdsTemp = new uint[](transactionCount); uint count = 0; uint i; for (i=0; i<transactionCount; i++) if ( pending && !transactions[i].executed || executed && transactions[i].executed) { transactionIdsTemp[count] = i; count += 1; } _transactionIds = new uint[](to - from); for (i=from; i<to; i++) _transactionIds[i - from] = transactionIdsTemp[i]; } } /// @title Multisignature wallet with daily limit - Allows an owner to withdraw a daily limit without multisig. /// @author Stefan George - <[email protected]> contract MultiSigWalletWithDailyLimit is MultiSigWallet { /* * Events */ event DailyLimitChange(uint dailyLimit); /* * Storage */ uint public dailyLimit; uint public lastDay; uint public spentToday; /* * Public functions */ /// @dev Contract constructor sets initial owners, required number of confirmations and daily withdraw limit. /// @param _owners List of initial owners. /// @param _required Number of required confirmations. /// @param _dailyLimit Amount in wei, which can be withdrawn without confirmations on a daily basis. function MultiSigWalletWithDailyLimit(address[] _owners, uint _required, uint _dailyLimit) public MultiSigWallet(_owners, _required) { dailyLimit = _dailyLimit; } /// @dev Allows to change the daily limit. Transaction has to be sent by wallet. /// @param _dailyLimit Amount in wei. function changeDailyLimit(uint _dailyLimit) public onlyWallet { dailyLimit = _dailyLimit; DailyLimitChange(_dailyLimit); } /// @dev Allows anyone to execute a confirmed transaction or ether withdraws until daily limit is reached. /// @param transactionId Transaction ID. function executeTransaction(uint transactionId) public ownerExists(msg.sender) confirmed(transactionId, msg.sender) notExecuted(transactionId) { Transaction storage txn = transactions[transactionId]; bool _confirmed = isConfirmed(transactionId); if (_confirmed || txn.data.length == 0 && isUnderLimit(txn.value)) { txn.executed = true; if (!_confirmed) spentToday += txn.value; if (txn.destination.call.value(txn.value)(txn.data)) Execution(transactionId); else { ExecutionFailure(transactionId); txn.executed = false; if (!_confirmed) spentToday -= txn.value; } } } /* * Internal functions */ /// @dev Returns if amount is within daily limit and resets spentToday after one day. /// @param amount Amount to withdraw. /// @return Returns if amount is under daily limit. function isUnderLimit(uint amount) internal returns (bool) { if (now > lastDay + 24 hours) { lastDay = now; spentToday = 0; } if (spentToday + amount > dailyLimit || spentToday + amount < spentToday) return false; return true; } /* * Web3 call functions */ /// @dev Returns maximum withdraw amount. /// @return Returns amount. function calcMaxWithdraw() public constant returns (uint) { if (now > lastDay + 24 hours) return dailyLimit; if (dailyLimit < spentToday) return 0; return dailyLimit - spentToday; } }
1
19,493,380
7b6d6d2e5ff75f13e1bf71850f6b7a056d55b6943113b4a6718bccbf9589b6d3
12185e9a03cdcd2d99c82b6cb16c956a7c643f0e73af793c88b3ef10d3dc1a37
27da98420b925cee5df233df8fdc9b03d318f20d
a6b71e26c5e0845f74c812102ca7114b6a896ab2
d5013ceba07adb77059c0119a2a1db9f78e314da
608060405234801561001057600080fd5b506040516101e63803806101e68339818101604052602081101561003357600080fd5b8101908080519060200190929190505050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156100ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806101c46022913960400191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505060ab806101196000396000f3fe608060405273ffffffffffffffffffffffffffffffffffffffff600054167fa619486e0000000000000000000000000000000000000000000000000000000060003514156050578060005260206000f35b3660008037600080366000845af43d6000803e60008114156070573d6000fd5b3d6000f3fea2646970667358221220d1429297349653a4918076d650332de1a1068c5f3e07c5c82360c277770b955264736f6c63430007060033496e76616c69642073696e676c65746f6e20616464726573732070726f7669646564000000000000000000000000d9db270c1b5e3bd161e8c8503c55ceabee709552
608060405273ffffffffffffffffffffffffffffffffffffffff600054167fa619486e0000000000000000000000000000000000000000000000000000000060003514156050578060005260206000f35b3660008037600080366000845af43d6000803e60008114156070573d6000fd5b3d6000f3fea2646970667358221220d1429297349653a4918076d650332de1a1068c5f3e07c5c82360c277770b955264736f6c63430007060033
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.7.0 <0.9.0; /// @title IProxy - Helper interface to access masterCopy of the Proxy on-chain /// @author Richard Meissner - <[email protected]> interface IProxy { function masterCopy() external view returns (address); } /// @title GnosisSafeProxy - Generic proxy contract allows to execute all transactions applying the code of a master contract. /// @author Stefan George - <[email protected]> /// @author Richard Meissner - <[email protected]> contract GnosisSafeProxy { // singleton always needs to be first declared variable, to ensure that it is at the same location in the contracts to which calls are delegated. // To reduce deployment costs this variable is internal and needs to be retrieved via `getStorageAt` address internal singleton; /// @dev Constructor function sets address of singleton contract. /// @param _singleton Singleton address. constructor(address _singleton) { require(_singleton != address(0), "Invalid singleton address provided"); singleton = _singleton; } /// @dev Fallback function forwards all transactions and returns all received return data. fallback() external payable { // solhint-disable-next-line no-inline-assembly assembly { let _singleton := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff) // 0xa619486e == keccak("masterCopy()"). The value is right padded to 32-bytes with 0s if eq(calldataload(0), 0xa619486e00000000000000000000000000000000000000000000000000000000) { mstore(0, _singleton) return(0, 0x20) } calldatacopy(0, 0, calldatasize()) let success := delegatecall(gas(), _singleton, 0, calldatasize(), 0, 0) returndatacopy(0, 0, returndatasize()) if eq(success, 0) { revert(0, returndatasize()) } return(0, returndatasize()) } } } /// @title Proxy Factory - Allows to create new proxy contact and execute a message call to the new proxy within one transaction. /// @author Stefan George - <[email protected]> contract GnosisSafeProxyFactory { event ProxyCreation(GnosisSafeProxy proxy, address singleton); /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction. /// @param singleton Address of singleton contract. /// @param data Payload for message call sent to new proxy contract. function createProxy(address singleton, bytes memory data) public returns (GnosisSafeProxy proxy) { proxy = new GnosisSafeProxy(singleton); if (data.length > 0) // solhint-disable-next-line no-inline-assembly assembly { if eq(call(gas(), proxy, 0, add(data, 0x20), mload(data), 0, 0), 0) { revert(0, 0) } } emit ProxyCreation(proxy, singleton); } /// @dev Allows to retrieve the runtime code of a deployed Proxy. This can be used to check that the expected Proxy was deployed. function proxyRuntimeCode() public pure returns (bytes memory) { return type(GnosisSafeProxy).runtimeCode; } /// @dev Allows to retrieve the creation code used for the Proxy deployment. With this it is easily possible to calculate predicted address. function proxyCreationCode() public pure returns (bytes memory) { return type(GnosisSafeProxy).creationCode; } /// @dev Allows to create new proxy contact using CREATE2 but it doesn't run the initializer. /// This method is only meant as an utility to be called from other methods /// @param _singleton Address of singleton contract. /// @param initializer Payload for message call sent to new proxy contract. /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. function deployProxyWithNonce( address _singleton, bytes memory initializer, uint256 saltNonce ) internal returns (GnosisSafeProxy proxy) { // If the initializer changes the proxy address should change too. Hashing the initializer data is cheaper than just concatinating it bytes32 salt = keccak256(abi.encodePacked(keccak256(initializer), saltNonce)); bytes memory deploymentData = abi.encodePacked(type(GnosisSafeProxy).creationCode, uint256(uint160(_singleton))); // solhint-disable-next-line no-inline-assembly assembly { proxy := create2(0x0, add(0x20, deploymentData), mload(deploymentData), salt) } require(address(proxy) != address(0), "Create2 call failed"); } /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction. /// @param _singleton Address of singleton contract. /// @param initializer Payload for message call sent to new proxy contract. /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. function createProxyWithNonce( address _singleton, bytes memory initializer, uint256 saltNonce ) public returns (GnosisSafeProxy proxy) { proxy = deployProxyWithNonce(_singleton, initializer, saltNonce); if (initializer.length > 0) // solhint-disable-next-line no-inline-assembly assembly { if eq(call(gas(), proxy, 0, add(initializer, 0x20), mload(initializer), 0, 0), 0) { revert(0, 0) } } emit ProxyCreation(proxy, _singleton); } /// @dev Allows to create new proxy contact, execute a message call to the new proxy and call a specified callback within one transaction /// @param _singleton Address of singleton contract. /// @param initializer Payload for message call sent to new proxy contract. /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. /// @param callback Callback that will be invoced after the new proxy contract has been successfully deployed and initialized. function createProxyWithCallback( address _singleton, bytes memory initializer, uint256 saltNonce, IProxyCreationCallback callback ) public returns (GnosisSafeProxy proxy) { uint256 saltNonceWithCallback = uint256(keccak256(abi.encodePacked(saltNonce, callback))); proxy = createProxyWithNonce(_singleton, initializer, saltNonceWithCallback); if (address(callback) != address(0)) callback.proxyCreated(proxy, _singleton, initializer, saltNonce); } /// @dev Allows to get the address for a new proxy contact created via `createProxyWithNonce` /// This method is only meant for address calculation purpose when you use an initializer that would revert, /// therefore the response is returned with a revert. When calling this method set `from` to the address of the proxy factory. /// @param _singleton Address of singleton contract. /// @param initializer Payload for message call sent to new proxy contract. /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. function calculateCreateProxyWithNonceAddress( address _singleton, bytes calldata initializer, uint256 saltNonce ) external returns (GnosisSafeProxy proxy) { proxy = deployProxyWithNonce(_singleton, initializer, saltNonce); revert(string(abi.encodePacked(proxy))); } } interface IProxyCreationCallback { function proxyCreated( GnosisSafeProxy proxy, address _singleton, bytes calldata initializer, uint256 saltNonce ) external; }
1
19,493,380
7b6d6d2e5ff75f13e1bf71850f6b7a056d55b6943113b4a6718bccbf9589b6d3
c24931e22d66896d8d120873a5bf43529d9790c31b8044dec0cecc5757908a01
689d210c4511b929e81158f73eeee1d9b6b75742
689d210c4511b929e81158f73eeee1d9b6b75742
262c2cb2b2c376c99becce90f9c2d9bbecac1022
60806040526200001a67058d15e17628000060001962000363565b620000289060001962000386565b6006556000600881905560196009819055600a829055600b819055600c829055600d819055600e91909155600f819055601380546001600160a01b031990811673689d210c4511b929e81158f73eeee1d9b6b757429081179092556014805490911690911790556016805461ffff60a81b1916600160b01b179055660e35fa931a000060178190556018556503a3529440009055348015620000c957600080fd5b50600080546001600160a01b031916339081178255604051909182917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3506006543360009081526002602090815260409182902092909255601580546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155815163c45a015560e01b815291519092839263c45a015592600480830193928290030181865afa15801562000187573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001ad9190620003ac565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015620001fb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002219190620003ac565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af11580156200026f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002959190620003ac565b601680546001600160a01b0319166001600160a01b03928316179055600080548216815260056020526040808220805460ff1990811660019081179092553084528284208054821683179055601354851684528284208054821683179055601454909416835291208054909216179055336001600160a01b031660006001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef67058d15e1762800006040516200035491815260200190565b60405180910390a350620003de565b6000826200038157634e487b7160e01b600052601260045260246000fd5b500690565b600082821015620003a757634e487b7160e01b600052601160045260246000fd5b500390565b600060208284031215620003bf57600080fd5b81516001600160a01b0381168114620003d757600080fd5b9392505050565b61207680620003ee6000396000f3fe6080604052600436106101f15760003560e01c80637d1db4a51161010d578063a9059cbb116100a0578063c3c8cd801161006f578063c3c8cd80146105cf578063c492f046146105e4578063dd62ed3e14610604578063ea1644d51461064a578063f2fde38b1461066a57600080fd5b8063a9059cbb1461052f578063b5a652231461054f578063bdd795ef1461056f578063bfd792841461059f57600080fd5b80638f9a55c0116100dc5780638f9a55c0146104ac57806395d89b41146104c257806398a5c315146104ef578063a2a957bb1461050f57600080fd5b80637d1db4a51461042b5780637f2feddc146104415780638da5cb5b1461046e5780638f70ccf71461048c57600080fd5b806349bd5a5e116101855780636fc3eaec116101545780636fc3eaec146103c157806370a08231146103d6578063715018a6146103f657806374010ece1461040b57600080fd5b806349bd5a5e1461034157806367aadb7e146103615780636b999053146103815780636d8aa8f8146103a157600080fd5b806318160ddd116101c157806318160ddd146102ca57806323b872dd146102ef5780632fd689e31461030f578063313ce5671461032557600080fd5b8062b8cf2a146101fd57806306fdde031461021f578063095ea7b3146102625780631694505e1461029257600080fd5b366101f857005b600080fd5b34801561020957600080fd5b5061021d610218366004611b6b565b61068a565b005b34801561022b57600080fd5b50604080518082019091526008815267526564204265616b60c01b60208201525b6040516102599190611c30565b60405180910390f35b34801561026e57600080fd5b5061028261027d366004611c85565b610729565b6040519015158152602001610259565b34801561029e57600080fd5b506015546102b2906001600160a01b031681565b6040516001600160a01b039091168152602001610259565b3480156102d657600080fd5b5067058d15e1762800005b604051908152602001610259565b3480156102fb57600080fd5b5061028261030a366004611cb1565b610740565b34801561031b57600080fd5b506102e160195481565b34801561033157600080fd5b5060405160098152602001610259565b34801561034d57600080fd5b506016546102b2906001600160a01b031681565b34801561036d57600080fd5b5061021d61037c366004611d3e565b6107a9565b34801561038d57600080fd5b5061021d61039c366004611d80565b610841565b3480156103ad57600080fd5b5061021d6103bc366004611dad565b61088c565b3480156103cd57600080fd5b5061021d6108d4565b3480156103e257600080fd5b506102e16103f1366004611d80565b61091f565b34801561040257600080fd5b5061021d610941565b34801561041757600080fd5b5061021d610426366004611dc8565b6109b5565b34801561043757600080fd5b506102e160175481565b34801561044d57600080fd5b506102e161045c366004611d80565b60116020526000908152604090205481565b34801561047a57600080fd5b506000546001600160a01b03166102b2565b34801561049857600080fd5b5061021d6104a7366004611dad565b6109e4565b3480156104b857600080fd5b506102e160185481565b3480156104ce57600080fd5b506040805180820190915260048152634245414b60e01b602082015261024c565b3480156104fb57600080fd5b5061021d61050a366004611dc8565b610a2c565b34801561051b57600080fd5b5061021d61052a366004611de1565b610a5b565b34801561053b57600080fd5b5061028261054a366004611c85565b610a99565b34801561055b57600080fd5b5061021d61056a366004611d3e565b610aa6565b34801561057b57600080fd5b5061028261058a366004611d80565b60126020526000908152604090205460ff1681565b3480156105ab57600080fd5b506102826105ba366004611d80565b60106020526000908152604090205460ff1681565b3480156105db57600080fd5b5061021d610b42565b3480156105f057600080fd5b5061021d6105ff366004611e13565b610b96565b34801561061057600080fd5b506102e161061f366004611e67565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561065657600080fd5b5061021d610665366004611dc8565b610c37565b34801561067657600080fd5b5061021d610685366004611d80565b610c66565b6000546001600160a01b031633146106bd5760405162461bcd60e51b81526004016106b490611ea0565b60405180910390fd5b60005b8151811015610725576001601060008484815181106106e1576106e1611ed5565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061071d81611f01565b9150506106c0565b5050565b6000610736338484610d50565b5060015b92915050565b600061074d848484610e74565b61079f843361079a85604051806060016040528060288152602001612019602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611405565b610d50565b5060019392505050565b6000546001600160a01b031633146107d35760405162461bcd60e51b81526004016106b490611ea0565b60005b8181101561083c57601260008484848181106107f4576107f4611ed5565b90506020020160208101906108099190611d80565b6001600160a01b031681526020810191909152604001600020805460ff191690558061083481611f01565b9150506107d6565b505050565b6000546001600160a01b0316331461086b5760405162461bcd60e51b81526004016106b490611ea0565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146108b65760405162461bcd60e51b81526004016106b490611ea0565b60168054911515600160b01b0260ff60b01b19909216919091179055565b6013546001600160a01b0316336001600160a01b0316148061090957506014546001600160a01b0316336001600160a01b0316145b61091257600080fd5b4761091c8161143f565b50565b6001600160a01b03811660009081526002602052604081205461073a90611479565b6000546001600160a01b0316331461096b5760405162461bcd60e51b81526004016106b490611ea0565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146109df5760405162461bcd60e51b81526004016106b490611ea0565b601755565b6000546001600160a01b03163314610a0e5760405162461bcd60e51b81526004016106b490611ea0565b60168054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b03163314610a565760405162461bcd60e51b81526004016106b490611ea0565b601955565b6000546001600160a01b03163314610a855760405162461bcd60e51b81526004016106b490611ea0565b600893909355600a91909155600955600b55565b6000610736338484610e74565b6000546001600160a01b03163314610ad05760405162461bcd60e51b81526004016106b490611ea0565b60005b8181101561083c57600160126000858585818110610af357610af3611ed5565b9050602002016020810190610b089190611d80565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610b3a81611f01565b915050610ad3565b6013546001600160a01b0316336001600160a01b03161480610b7757506014546001600160a01b0316336001600160a01b0316145b610b8057600080fd5b6000610b8b3061091f565b905061091c816114fd565b6000546001600160a01b03163314610bc05760405162461bcd60e51b81526004016106b490611ea0565b60005b82811015610c31578160056000868685818110610be257610be2611ed5565b9050602002016020810190610bf79190611d80565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610c2981611f01565b915050610bc3565b50505050565b6000546001600160a01b03163314610c615760405162461bcd60e51b81526004016106b490611ea0565b601855565b6000546001600160a01b03163314610c905760405162461bcd60e51b81526004016106b490611ea0565b6001600160a01b038116610cf55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016106b4565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610db25760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016106b4565b6001600160a01b038216610e135760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016106b4565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ed85760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016106b4565b6001600160a01b038216610f3a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016106b4565b60008111610f9c5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016106b4565b6000546001600160a01b03848116911614801590610fc857506000546001600160a01b03838116911614155b8015610fed57506001600160a01b03831660009081526012602052604090205460ff16155b801561101257506001600160a01b03821660009081526012602052604090205460ff16155b156112fe57601654600160a01b900460ff166110b6576001600160a01b03831660009081526012602052604090205460ff166110b65760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016106b4565b6017548111156111085760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016106b4565b6001600160a01b03831660009081526010602052604090205460ff1615801561114a57506001600160a01b03821660009081526010602052604090205460ff16155b6111a25760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016106b4565b6016546001600160a01b0383811691161461122757601854816111c48461091f565b6111ce9190611f1a565b106112275760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016106b4565b60006112323061091f565b60195460175491925082101590821061124b5760175491505b8080156112625750601654600160a81b900460ff16155b801561127c57506016546001600160a01b03868116911614155b80156112915750601654600160b01b900460ff165b80156112b657506001600160a01b03851660009081526005602052604090205460ff16155b80156112db57506001600160a01b03841660009081526005602052604090205460ff16155b156112fb576112e9826114fd565b4780156112f9576112f94761143f565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061134057506001600160a01b03831660009081526005602052604090205460ff165b8061137257506016546001600160a01b0385811691161480159061137257506016546001600160a01b03848116911614155b1561137f575060006113f9565b6016546001600160a01b0385811691161480156113aa57506015546001600160a01b03848116911614155b156113bc57600854600c55600954600d555b6016546001600160a01b0384811691161480156113e757506015546001600160a01b03858116911614155b156113f957600a54600c55600b54600d555b610c3184848484611677565b600081848411156114295760405162461bcd60e51b81526004016106b49190611c30565b5060006114368486611f32565b95945050505050565b6014546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610725573d6000803e3d6000fd5b60006006548211156114e05760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016106b4565b60006114ea6116a5565b90506114f683826116c8565b9392505050565b6016805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061154557611545611ed5565b6001600160a01b03928316602091820292909201810191909152601554604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa15801561159e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115c29190611f49565b816001815181106115d5576115d5611ed5565b6001600160a01b0392831660209182029290920101526015546115fb9130911684610d50565b60155460405163791ac94760e01b81526001600160a01b039091169063791ac94790611634908590600090869030904290600401611f66565b600060405180830381600087803b15801561164e57600080fd5b505af1158015611662573d6000803e3d6000fd5b50506016805460ff60a81b1916905550505050565b806116845761168461170a565b61168f848484611738565b80610c3157610c31600e54600c55600f54600d55565b60008060006116b261182f565b90925090506116c182826116c8565b9250505090565b60006114f683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061186f565b600c5415801561171a5750600d54155b1561172157565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061174a8761189d565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061177c90876118fa565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546117ab908661193c565b6001600160a01b0389166000908152600260205260409020556117cd8161199b565b6117d784836119e5565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161181c91815260200190565b60405180910390a3505050505050505050565b600654600090819067058d15e17628000061184a82826116c8565b8210156118665750506006549267058d15e17628000092509050565b90939092509050565b600081836118905760405162461bcd60e51b81526004016106b49190611c30565b5060006114368486611fd7565b60008060008060008060008060006118ba8a600c54600d54611a09565b92509250925060006118ca6116a5565b905060008060006118dd8e878787611a5e565b919e509c509a509598509396509194505050505091939550919395565b60006114f683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611405565b6000806119498385611f1a565b9050838110156114f65760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016106b4565b60006119a56116a5565b905060006119b38383611aae565b306000908152600260205260409020549091506119d0908261193c565b30600090815260026020526040902055505050565b6006546119f290836118fa565b600655600754611a02908261193c565b6007555050565b6000808080611a236064611a1d8989611aae565b906116c8565b90506000611a366064611a1d8a89611aae565b90506000611a4e82611a488b866118fa565b906118fa565b9992985090965090945050505050565b6000808080611a6d8886611aae565b90506000611a7b8887611aae565b90506000611a898888611aae565b90506000611a9b82611a4886866118fa565b939b939a50919850919650505050505050565b600082600003611ac05750600061073a565b6000611acc8385611ff9565b905082611ad98583611fd7565b146114f65760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016106b4565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461091c57600080fd5b8035611b6681611b46565b919050565b60006020808385031215611b7e57600080fd5b823567ffffffffffffffff80821115611b9657600080fd5b818501915085601f830112611baa57600080fd5b813581811115611bbc57611bbc611b30565b8060051b604051601f19603f83011681018181108582111715611be157611be1611b30565b604052918252848201925083810185019188831115611bff57600080fd5b938501935b82851015611c2457611c1585611b5b565b84529385019392850192611c04565b98975050505050505050565b600060208083528351808285015260005b81811015611c5d57858101830151858201604001528201611c41565b81811115611c6f576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611c9857600080fd5b8235611ca381611b46565b946020939093013593505050565b600080600060608486031215611cc657600080fd5b8335611cd181611b46565b92506020840135611ce181611b46565b929592945050506040919091013590565b60008083601f840112611d0457600080fd5b50813567ffffffffffffffff811115611d1c57600080fd5b6020830191508360208260051b8501011115611d3757600080fd5b9250929050565b60008060208385031215611d5157600080fd5b823567ffffffffffffffff811115611d6857600080fd5b611d7485828601611cf2565b90969095509350505050565b600060208284031215611d9257600080fd5b81356114f681611b46565b80358015158114611b6657600080fd5b600060208284031215611dbf57600080fd5b6114f682611d9d565b600060208284031215611dda57600080fd5b5035919050565b60008060008060808587031215611df757600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611e2857600080fd5b833567ffffffffffffffff811115611e3f57600080fd5b611e4b86828701611cf2565b9094509250611e5e905060208501611d9d565b90509250925092565b60008060408385031215611e7a57600080fd5b8235611e8581611b46565b91506020830135611e9581611b46565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611f1357611f13611eeb565b5060010190565b60008219821115611f2d57611f2d611eeb565b500190565b600082821015611f4457611f44611eeb565b500390565b600060208284031215611f5b57600080fd5b81516114f681611b46565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611fb65784516001600160a01b031683529383019391830191600101611f91565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611ff457634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561201357612013611eeb565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122018db31206020656641cfb4f8da3092d728e1d8dc77f07f2a0e6ad3f7e9ab409964736f6c634300080e0033
6080604052600436106101f15760003560e01c80637d1db4a51161010d578063a9059cbb116100a0578063c3c8cd801161006f578063c3c8cd80146105cf578063c492f046146105e4578063dd62ed3e14610604578063ea1644d51461064a578063f2fde38b1461066a57600080fd5b8063a9059cbb1461052f578063b5a652231461054f578063bdd795ef1461056f578063bfd792841461059f57600080fd5b80638f9a55c0116100dc5780638f9a55c0146104ac57806395d89b41146104c257806398a5c315146104ef578063a2a957bb1461050f57600080fd5b80637d1db4a51461042b5780637f2feddc146104415780638da5cb5b1461046e5780638f70ccf71461048c57600080fd5b806349bd5a5e116101855780636fc3eaec116101545780636fc3eaec146103c157806370a08231146103d6578063715018a6146103f657806374010ece1461040b57600080fd5b806349bd5a5e1461034157806367aadb7e146103615780636b999053146103815780636d8aa8f8146103a157600080fd5b806318160ddd116101c157806318160ddd146102ca57806323b872dd146102ef5780632fd689e31461030f578063313ce5671461032557600080fd5b8062b8cf2a146101fd57806306fdde031461021f578063095ea7b3146102625780631694505e1461029257600080fd5b366101f857005b600080fd5b34801561020957600080fd5b5061021d610218366004611b6b565b61068a565b005b34801561022b57600080fd5b50604080518082019091526008815267526564204265616b60c01b60208201525b6040516102599190611c30565b60405180910390f35b34801561026e57600080fd5b5061028261027d366004611c85565b610729565b6040519015158152602001610259565b34801561029e57600080fd5b506015546102b2906001600160a01b031681565b6040516001600160a01b039091168152602001610259565b3480156102d657600080fd5b5067058d15e1762800005b604051908152602001610259565b3480156102fb57600080fd5b5061028261030a366004611cb1565b610740565b34801561031b57600080fd5b506102e160195481565b34801561033157600080fd5b5060405160098152602001610259565b34801561034d57600080fd5b506016546102b2906001600160a01b031681565b34801561036d57600080fd5b5061021d61037c366004611d3e565b6107a9565b34801561038d57600080fd5b5061021d61039c366004611d80565b610841565b3480156103ad57600080fd5b5061021d6103bc366004611dad565b61088c565b3480156103cd57600080fd5b5061021d6108d4565b3480156103e257600080fd5b506102e16103f1366004611d80565b61091f565b34801561040257600080fd5b5061021d610941565b34801561041757600080fd5b5061021d610426366004611dc8565b6109b5565b34801561043757600080fd5b506102e160175481565b34801561044d57600080fd5b506102e161045c366004611d80565b60116020526000908152604090205481565b34801561047a57600080fd5b506000546001600160a01b03166102b2565b34801561049857600080fd5b5061021d6104a7366004611dad565b6109e4565b3480156104b857600080fd5b506102e160185481565b3480156104ce57600080fd5b506040805180820190915260048152634245414b60e01b602082015261024c565b3480156104fb57600080fd5b5061021d61050a366004611dc8565b610a2c565b34801561051b57600080fd5b5061021d61052a366004611de1565b610a5b565b34801561053b57600080fd5b5061028261054a366004611c85565b610a99565b34801561055b57600080fd5b5061021d61056a366004611d3e565b610aa6565b34801561057b57600080fd5b5061028261058a366004611d80565b60126020526000908152604090205460ff1681565b3480156105ab57600080fd5b506102826105ba366004611d80565b60106020526000908152604090205460ff1681565b3480156105db57600080fd5b5061021d610b42565b3480156105f057600080fd5b5061021d6105ff366004611e13565b610b96565b34801561061057600080fd5b506102e161061f366004611e67565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561065657600080fd5b5061021d610665366004611dc8565b610c37565b34801561067657600080fd5b5061021d610685366004611d80565b610c66565b6000546001600160a01b031633146106bd5760405162461bcd60e51b81526004016106b490611ea0565b60405180910390fd5b60005b8151811015610725576001601060008484815181106106e1576106e1611ed5565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061071d81611f01565b9150506106c0565b5050565b6000610736338484610d50565b5060015b92915050565b600061074d848484610e74565b61079f843361079a85604051806060016040528060288152602001612019602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611405565b610d50565b5060019392505050565b6000546001600160a01b031633146107d35760405162461bcd60e51b81526004016106b490611ea0565b60005b8181101561083c57601260008484848181106107f4576107f4611ed5565b90506020020160208101906108099190611d80565b6001600160a01b031681526020810191909152604001600020805460ff191690558061083481611f01565b9150506107d6565b505050565b6000546001600160a01b0316331461086b5760405162461bcd60e51b81526004016106b490611ea0565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146108b65760405162461bcd60e51b81526004016106b490611ea0565b60168054911515600160b01b0260ff60b01b19909216919091179055565b6013546001600160a01b0316336001600160a01b0316148061090957506014546001600160a01b0316336001600160a01b0316145b61091257600080fd5b4761091c8161143f565b50565b6001600160a01b03811660009081526002602052604081205461073a90611479565b6000546001600160a01b0316331461096b5760405162461bcd60e51b81526004016106b490611ea0565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146109df5760405162461bcd60e51b81526004016106b490611ea0565b601755565b6000546001600160a01b03163314610a0e5760405162461bcd60e51b81526004016106b490611ea0565b60168054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b03163314610a565760405162461bcd60e51b81526004016106b490611ea0565b601955565b6000546001600160a01b03163314610a855760405162461bcd60e51b81526004016106b490611ea0565b600893909355600a91909155600955600b55565b6000610736338484610e74565b6000546001600160a01b03163314610ad05760405162461bcd60e51b81526004016106b490611ea0565b60005b8181101561083c57600160126000858585818110610af357610af3611ed5565b9050602002016020810190610b089190611d80565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610b3a81611f01565b915050610ad3565b6013546001600160a01b0316336001600160a01b03161480610b7757506014546001600160a01b0316336001600160a01b0316145b610b8057600080fd5b6000610b8b3061091f565b905061091c816114fd565b6000546001600160a01b03163314610bc05760405162461bcd60e51b81526004016106b490611ea0565b60005b82811015610c31578160056000868685818110610be257610be2611ed5565b9050602002016020810190610bf79190611d80565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610c2981611f01565b915050610bc3565b50505050565b6000546001600160a01b03163314610c615760405162461bcd60e51b81526004016106b490611ea0565b601855565b6000546001600160a01b03163314610c905760405162461bcd60e51b81526004016106b490611ea0565b6001600160a01b038116610cf55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016106b4565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610db25760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016106b4565b6001600160a01b038216610e135760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016106b4565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ed85760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016106b4565b6001600160a01b038216610f3a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016106b4565b60008111610f9c5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016106b4565b6000546001600160a01b03848116911614801590610fc857506000546001600160a01b03838116911614155b8015610fed57506001600160a01b03831660009081526012602052604090205460ff16155b801561101257506001600160a01b03821660009081526012602052604090205460ff16155b156112fe57601654600160a01b900460ff166110b6576001600160a01b03831660009081526012602052604090205460ff166110b65760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016106b4565b6017548111156111085760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016106b4565b6001600160a01b03831660009081526010602052604090205460ff1615801561114a57506001600160a01b03821660009081526010602052604090205460ff16155b6111a25760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016106b4565b6016546001600160a01b0383811691161461122757601854816111c48461091f565b6111ce9190611f1a565b106112275760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016106b4565b60006112323061091f565b60195460175491925082101590821061124b5760175491505b8080156112625750601654600160a81b900460ff16155b801561127c57506016546001600160a01b03868116911614155b80156112915750601654600160b01b900460ff165b80156112b657506001600160a01b03851660009081526005602052604090205460ff16155b80156112db57506001600160a01b03841660009081526005602052604090205460ff16155b156112fb576112e9826114fd565b4780156112f9576112f94761143f565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061134057506001600160a01b03831660009081526005602052604090205460ff165b8061137257506016546001600160a01b0385811691161480159061137257506016546001600160a01b03848116911614155b1561137f575060006113f9565b6016546001600160a01b0385811691161480156113aa57506015546001600160a01b03848116911614155b156113bc57600854600c55600954600d555b6016546001600160a01b0384811691161480156113e757506015546001600160a01b03858116911614155b156113f957600a54600c55600b54600d555b610c3184848484611677565b600081848411156114295760405162461bcd60e51b81526004016106b49190611c30565b5060006114368486611f32565b95945050505050565b6014546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610725573d6000803e3d6000fd5b60006006548211156114e05760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016106b4565b60006114ea6116a5565b90506114f683826116c8565b9392505050565b6016805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061154557611545611ed5565b6001600160a01b03928316602091820292909201810191909152601554604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa15801561159e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115c29190611f49565b816001815181106115d5576115d5611ed5565b6001600160a01b0392831660209182029290920101526015546115fb9130911684610d50565b60155460405163791ac94760e01b81526001600160a01b039091169063791ac94790611634908590600090869030904290600401611f66565b600060405180830381600087803b15801561164e57600080fd5b505af1158015611662573d6000803e3d6000fd5b50506016805460ff60a81b1916905550505050565b806116845761168461170a565b61168f848484611738565b80610c3157610c31600e54600c55600f54600d55565b60008060006116b261182f565b90925090506116c182826116c8565b9250505090565b60006114f683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061186f565b600c5415801561171a5750600d54155b1561172157565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061174a8761189d565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061177c90876118fa565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546117ab908661193c565b6001600160a01b0389166000908152600260205260409020556117cd8161199b565b6117d784836119e5565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161181c91815260200190565b60405180910390a3505050505050505050565b600654600090819067058d15e17628000061184a82826116c8565b8210156118665750506006549267058d15e17628000092509050565b90939092509050565b600081836118905760405162461bcd60e51b81526004016106b49190611c30565b5060006114368486611fd7565b60008060008060008060008060006118ba8a600c54600d54611a09565b92509250925060006118ca6116a5565b905060008060006118dd8e878787611a5e565b919e509c509a509598509396509194505050505091939550919395565b60006114f683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611405565b6000806119498385611f1a565b9050838110156114f65760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016106b4565b60006119a56116a5565b905060006119b38383611aae565b306000908152600260205260409020549091506119d0908261193c565b30600090815260026020526040902055505050565b6006546119f290836118fa565b600655600754611a02908261193c565b6007555050565b6000808080611a236064611a1d8989611aae565b906116c8565b90506000611a366064611a1d8a89611aae565b90506000611a4e82611a488b866118fa565b906118fa565b9992985090965090945050505050565b6000808080611a6d8886611aae565b90506000611a7b8887611aae565b90506000611a898888611aae565b90506000611a9b82611a4886866118fa565b939b939a50919850919650505050505050565b600082600003611ac05750600061073a565b6000611acc8385611ff9565b905082611ad98583611fd7565b146114f65760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016106b4565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461091c57600080fd5b8035611b6681611b46565b919050565b60006020808385031215611b7e57600080fd5b823567ffffffffffffffff80821115611b9657600080fd5b818501915085601f830112611baa57600080fd5b813581811115611bbc57611bbc611b30565b8060051b604051601f19603f83011681018181108582111715611be157611be1611b30565b604052918252848201925083810185019188831115611bff57600080fd5b938501935b82851015611c2457611c1585611b5b565b84529385019392850192611c04565b98975050505050505050565b600060208083528351808285015260005b81811015611c5d57858101830151858201604001528201611c41565b81811115611c6f576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611c9857600080fd5b8235611ca381611b46565b946020939093013593505050565b600080600060608486031215611cc657600080fd5b8335611cd181611b46565b92506020840135611ce181611b46565b929592945050506040919091013590565b60008083601f840112611d0457600080fd5b50813567ffffffffffffffff811115611d1c57600080fd5b6020830191508360208260051b8501011115611d3757600080fd5b9250929050565b60008060208385031215611d5157600080fd5b823567ffffffffffffffff811115611d6857600080fd5b611d7485828601611cf2565b90969095509350505050565b600060208284031215611d9257600080fd5b81356114f681611b46565b80358015158114611b6657600080fd5b600060208284031215611dbf57600080fd5b6114f682611d9d565b600060208284031215611dda57600080fd5b5035919050565b60008060008060808587031215611df757600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611e2857600080fd5b833567ffffffffffffffff811115611e3f57600080fd5b611e4b86828701611cf2565b9094509250611e5e905060208501611d9d565b90509250925092565b60008060408385031215611e7a57600080fd5b8235611e8581611b46565b91506020830135611e9581611b46565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611f1357611f13611eeb565b5060010190565b60008219821115611f2d57611f2d611eeb565b500190565b600082821015611f4457611f44611eeb565b500390565b600060208284031215611f5b57600080fd5b81516114f681611b46565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611fb65784516001600160a01b031683529383019391830191600101611f91565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611ff457634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561201357612013611eeb565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122018db31206020656641cfb4f8da3092d728e1d8dc77f07f2a0e6ad3f7e9ab409964736f6c634300080e0033
1
19,493,380
7b6d6d2e5ff75f13e1bf71850f6b7a056d55b6943113b4a6718bccbf9589b6d3
c24931e22d66896d8d120873a5bf43529d9790c31b8044dec0cecc5757908a01
689d210c4511b929e81158f73eeee1d9b6b75742
5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f
bea2a575d3ae06578783dba059ab019d65f625b7
60806040526001600c5534801561001557600080fd5b506040514690806052612d228239604080519182900360520182208282018252600a8352692ab734b9bbb0b8102b1960b11b6020938401528151808301835260018152603160f81b908401528151808401919091527fbfcc8ef98ffbf7b6c3fec7bf5185b566b9863e35a9d83acd49ad6824b5969738818301527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606082015260808101949094523060a0808601919091528151808603909101815260c09094019052825192019190912060035550600580546001600160a01b03191633179055612c1d806101056000396000f3fe608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a7146105da578063d505accf146105e2578063dd62ed3e14610640578063fff6cae91461067b576101b9565b8063ba9a7a5614610597578063bc25cf771461059f578063c45a0155146105d2576101b9565b80637ecebe00116100d35780637ecebe00146104d757806389afcb441461050a57806395d89b4114610556578063a9059cbb1461055e576101b9565b80636a6278421461046957806370a082311461049c5780637464fc3d146104cf576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610416578063485cc9551461041e5780635909c0d5146104595780635a3d549314610461576101b9565b806323b872dd146103ad57806330adf81f146103f0578063313ce567146103f8576101b9565b8063095ea7b311610197578063095ea7b3146103155780630dfe16811461036257806318160ddd14610393576101b9565b8063022c0d9f146101be57806306fdde03146102595780630902f1ac146102d6575b600080fd5b610257600480360360808110156101d457600080fd5b81359160208101359173ffffffffffffffffffffffffffffffffffffffff604083013516919081019060808101606082013564010000000081111561021857600080fd5b82018360208201111561022a57600080fd5b8035906020019184600183028401116401000000008311171561024c57600080fd5b509092509050610683565b005b610261610d57565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029b578181015183820152602001610283565b50505050905090810190601f1680156102c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102de610d90565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b61034e6004803603604081101561032b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de5565b604080519115158252519081900360200190f35b61036a610dfc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61039b610e18565b60408051918252519081900360200190f35b61034e600480360360608110156103c357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e1e565b61039b610efd565b610400610f21565b6040805160ff9092168252519081900360200190f35b61039b610f26565b6102576004803603604081101561043457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610f2c565b61039b611005565b61039b61100b565b61039b6004803603602081101561047f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611011565b61039b600480360360208110156104b257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113cb565b61039b6113dd565b61039b600480360360208110156104ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113e3565b61053d6004803603602081101561052057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113f5565b6040805192835260208301919091528051918290030190f35b610261611892565b61034e6004803603604081101561057457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356118cb565b61039b6118d8565b610257600480360360208110156105b557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166118de565b61036a611ad4565b61036a611af0565b610257600480360360e08110156105f857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b0c565b61039b6004803603604081101561065657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611dd8565b610257611df5565b600c546001146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55841515806107075750600084115b61075c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b2f6025913960400191505060405180910390fd5b600080610767610d90565b5091509150816dffffffffffffffffffffffffffff168710801561079a5750806dffffffffffffffffffffffffffff1686105b6107ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b786021913960400191505060405180910390fd5b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff91821691908116908916821480159061085457508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b6108bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a156108d0576108d0828a8d611fdb565b89156108e1576108e1818a8c611fdb565b86156109c3578873ffffffffffffffffffffffffffffffffffffffff166310d1e85c338d8d8c8c6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050505b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8416916370a08231916024808301926020929190829003018186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191955073ffffffffffffffffffffffffffffffffffffffff8316916370a0823191602480820192602092909190829003018186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d6020811015610af557600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a90038311610b1f576000610b35565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610b59576000610b6f565b89856dffffffffffffffffffffffffffff160383035b90506000821180610b805750600081115b610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b546024913960400191505060405180910390fd5b6000610c09610beb84600363ffffffff6121e816565b610bfd876103e863ffffffff6121e816565b9063ffffffff61226e16565b90506000610c21610beb84600363ffffffff6121e816565b9050610c59620f4240610c4d6dffffffffffffffffffffffffffff8b8116908b1663ffffffff6121e816565b9063ffffffff6121e816565b610c69838363ffffffff6121e816565b1015610cd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610ce4848488886122e0565b60408051838152602081018390528082018d9052606081018c9052905173ffffffffffffffffffffffffffffffffffffffff8b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a81526020017f556e69737761702056320000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610df233848461259c565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610ee85773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610eb6908363ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610ef384848461260b565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610fb257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c5460011461108457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611094610d90565b50600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905193955091935060009273ffffffffffffffffffffffffffffffffffffffff909116916370a08231916024808301926020929190829003018186803b15801561110e57600080fd5b505afa158015611122573d6000803e3d6000fd5b505050506040513d602081101561113857600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905192935060009273ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d60208110156111db57600080fd5b505190506000611201836dffffffffffffffffffffffffffff871663ffffffff61226e16565b90506000611225836dffffffffffffffffffffffffffff871663ffffffff61226e16565b9050600061123387876126ec565b600054909150806112705761125c6103e8610bfd611257878763ffffffff6121e816565b612878565b985061126b60006103e86128ca565b6112cd565b6112ca6dffffffffffffffffffffffffffff8916611294868463ffffffff6121e816565b8161129b57fe5b046dffffffffffffffffffffffffffff89166112bd868563ffffffff6121e816565b816112c457fe5b0461297a565b98505b60008911611326576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612bc16028913960400191505060405180910390fd5b6113308a8a6128ca565b61133c86868a8a6122e0565b811561137e5760085461137a906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461146957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611479610d90565b50600654600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905194965092945073ffffffffffffffffffffffffffffffffffffffff9182169391169160009184916370a08231916024808301926020929190829003018186803b1580156114fb57600080fd5b505afa15801561150f573d6000803e3d6000fd5b505050506040513d602081101561152557600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191925060009173ffffffffffffffffffffffffffffffffffffffff8516916370a08231916024808301926020929190829003018186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d60208110156115c357600080fd5b5051306000908152600160205260408120549192506115e288886126ec565b600054909150806115f9848763ffffffff6121e816565b8161160057fe5b049a5080611614848663ffffffff6121e816565b8161161b57fe5b04995060008b11801561162e575060008a115b611683576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612b996028913960400191505060405180910390fd5b61168d3084612992565b611698878d8d611fdb565b6116a3868d8c611fdb565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8916916370a08231916024808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d602081101561173957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191965073ffffffffffffffffffffffffffffffffffffffff8816916370a0823191602480820192602092909190829003018186803b1580156117ab57600080fd5b505afa1580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b505193506117e585858b8b6122e0565b811561182757600854611823906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b604080518c8152602081018c9052815173ffffffffffffffffffffffffffffffffffffffff8f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f554e492d5632000000000000000000000000000000000000000000000000000081525081565b6000610df233848461260b565b6103e881565b600c5460011461194f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654600754600854604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff9485169490931692611a2b9285928792611a26926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff61226e16565b611fdb565b600854604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611aca9284928792611a26926e01000000000000000000000000000090046dffffffffffffffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff8616916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611b7b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff80891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e2808201937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019281900390910190855afa158015611cdc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611d5757508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611dc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611dcd89898961259c565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611e6657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611fd49273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b158015611f7a57600080fd5b505afa158015611f8e573d6000803e3d6000fd5b505050506040513d6020811015611fa457600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166122e0565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e743235362900000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b602083106120e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016120a4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612143576040519150601f19603f3d011682016040523d82523d6000602084013e612148565b606091505b5091509150818015612176575080511580612176575080806020019051602081101561217357600080fd5b50515b6121e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b60008115806122035750508082028282828161220057fe5b04145b610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061230c57506dffffffffffffffffffffffffffff8311155b61237757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906123c757506dffffffffffffffffffffffffffff841615155b80156123e257506dffffffffffffffffffffffffffff831615155b15612492578063ffffffff16612425856123fb86612a57565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169063ffffffff612a7b16565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff8116612465846123fb87612a57565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054612641908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160205260408082209390935590841681522054612683908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561275757600080fd5b505afa15801561276b573d6000803e3d6000fd5b505050506040513d602081101561278157600080fd5b5051600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061286457801561285f5760006127d86112576dffffffffffffffffffffffffffff88811690881663ffffffff6121e816565b905060006127e583612878565b90508082111561285c576000612813612804848463ffffffff61226e16565b6000549063ffffffff6121e816565b905060006128388361282c86600563ffffffff6121e816565b9063ffffffff612abc16565b9050600081838161284557fe5b04905080156128585761285887826128ca565b5050505b50505b612870565b8015612870576000600b555b505092915050565b600060038211156128bb575080600160028204015b818110156128b5578091506002818285816128a457fe5b0401816128ad57fe5b04905061288d565b506128c5565b81156128c5575060015b919050565b6000546128dd908263ffffffff612abc16565b600090815573ffffffffffffffffffffffffffffffffffffffff8316815260016020526040902054612915908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000818310612989578161298b565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020546129c8908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081209190915554612a02908263ffffffff61226e16565b600090815560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff841681612ab457fe5b049392505050565b80820182811015610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158207dca18479e58487606bf70c79e44d8dee62353c9ee6d01f9a9d70885b8765f2264736f6c63430005100032454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e747261637429
608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a7146105da578063d505accf146105e2578063dd62ed3e14610640578063fff6cae91461067b576101b9565b8063ba9a7a5614610597578063bc25cf771461059f578063c45a0155146105d2576101b9565b80637ecebe00116100d35780637ecebe00146104d757806389afcb441461050a57806395d89b4114610556578063a9059cbb1461055e576101b9565b80636a6278421461046957806370a082311461049c5780637464fc3d146104cf576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610416578063485cc9551461041e5780635909c0d5146104595780635a3d549314610461576101b9565b806323b872dd146103ad57806330adf81f146103f0578063313ce567146103f8576101b9565b8063095ea7b311610197578063095ea7b3146103155780630dfe16811461036257806318160ddd14610393576101b9565b8063022c0d9f146101be57806306fdde03146102595780630902f1ac146102d6575b600080fd5b610257600480360360808110156101d457600080fd5b81359160208101359173ffffffffffffffffffffffffffffffffffffffff604083013516919081019060808101606082013564010000000081111561021857600080fd5b82018360208201111561022a57600080fd5b8035906020019184600183028401116401000000008311171561024c57600080fd5b509092509050610683565b005b610261610d57565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029b578181015183820152602001610283565b50505050905090810190601f1680156102c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102de610d90565b604080516dffffffffffffffffffffffffffff948516815292909316602083015263ffffffff168183015290519081900360600190f35b61034e6004803603604081101561032b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de5565b604080519115158252519081900360200190f35b61036a610dfc565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61039b610e18565b60408051918252519081900360200190f35b61034e600480360360608110156103c357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610e1e565b61039b610efd565b610400610f21565b6040805160ff9092168252519081900360200190f35b61039b610f26565b6102576004803603604081101561043457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610f2c565b61039b611005565b61039b61100b565b61039b6004803603602081101561047f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611011565b61039b600480360360208110156104b257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113cb565b61039b6113dd565b61039b600480360360208110156104ed57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113e3565b61053d6004803603602081101561052057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166113f5565b6040805192835260208301919091528051918290030190f35b610261611892565b61034e6004803603604081101561057457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356118cb565b61039b6118d8565b610257600480360360208110156105b557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166118de565b61036a611ad4565b61036a611af0565b610257600480360360e08110156105f857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b0c565b61039b6004803603604081101561065657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611dd8565b610257611df5565b600c546001146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55841515806107075750600084115b61075c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b2f6025913960400191505060405180910390fd5b600080610767610d90565b5091509150816dffffffffffffffffffffffffffff168710801561079a5750806dffffffffffffffffffffffffffff1686105b6107ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b786021913960400191505060405180910390fd5b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff91821691908116908916821480159061085457508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b6108bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f556e697377617056323a20494e56414c49445f544f0000000000000000000000604482015290519081900360640190fd5b8a156108d0576108d0828a8d611fdb565b89156108e1576108e1818a8c611fdb565b86156109c3578873ffffffffffffffffffffffffffffffffffffffff166310d1e85c338d8d8c8c6040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050505b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8416916370a08231916024808301926020929190829003018186803b158015610a2f57600080fd5b505afa158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191955073ffffffffffffffffffffffffffffffffffffffff8316916370a0823191602480820192602092909190829003018186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d6020811015610af557600080fd5b5051925060009150506dffffffffffffffffffffffffffff85168a90038311610b1f576000610b35565b89856dffffffffffffffffffffffffffff160383035b9050600089856dffffffffffffffffffffffffffff16038311610b59576000610b6f565b89856dffffffffffffffffffffffffffff160383035b90506000821180610b805750600081115b610bd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b546024913960400191505060405180910390fd5b6000610c09610beb84600363ffffffff6121e816565b610bfd876103e863ffffffff6121e816565b9063ffffffff61226e16565b90506000610c21610beb84600363ffffffff6121e816565b9050610c59620f4240610c4d6dffffffffffffffffffffffffffff8b8116908b1663ffffffff6121e816565b9063ffffffff6121e816565b610c69838363ffffffff6121e816565b1015610cd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f556e697377617056323a204b0000000000000000000000000000000000000000604482015290519081900360640190fd5b5050610ce4848488886122e0565b60408051838152602081018390528082018d9052606081018c9052905173ffffffffffffffffffffffffffffffffffffffff8b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a81526020017f556e69737761702056320000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610df233848461259c565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610ee85773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610eb6908363ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610ef384848461260b565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610fb257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f556e697377617056323a20464f5242494444454e000000000000000000000000604482015290519081900360640190fd5b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c5460011461108457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611094610d90565b50600654604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905193955091935060009273ffffffffffffffffffffffffffffffffffffffff909116916370a08231916024808301926020929190829003018186803b15801561110e57600080fd5b505afa158015611122573d6000803e3d6000fd5b505050506040513d602081101561113857600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905192935060009273ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b1580156111b157600080fd5b505afa1580156111c5573d6000803e3d6000fd5b505050506040513d60208110156111db57600080fd5b505190506000611201836dffffffffffffffffffffffffffff871663ffffffff61226e16565b90506000611225836dffffffffffffffffffffffffffff871663ffffffff61226e16565b9050600061123387876126ec565b600054909150806112705761125c6103e8610bfd611257878763ffffffff6121e816565b612878565b985061126b60006103e86128ca565b6112cd565b6112ca6dffffffffffffffffffffffffffff8916611294868463ffffffff6121e816565b8161129b57fe5b046dffffffffffffffffffffffffffff89166112bd868563ffffffff6121e816565b816112c457fe5b0461297a565b98505b60008911611326576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612bc16028913960400191505060405180910390fd5b6113308a8a6128ca565b61133c86868a8a6122e0565b811561137e5760085461137a906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461146957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c81905580611479610d90565b50600654600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905194965092945073ffffffffffffffffffffffffffffffffffffffff9182169391169160009184916370a08231916024808301926020929190829003018186803b1580156114fb57600080fd5b505afa15801561150f573d6000803e3d6000fd5b505050506040513d602081101561152557600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191925060009173ffffffffffffffffffffffffffffffffffffffff8516916370a08231916024808301926020929190829003018186803b15801561159957600080fd5b505afa1580156115ad573d6000803e3d6000fd5b505050506040513d60208110156115c357600080fd5b5051306000908152600160205260408120549192506115e288886126ec565b600054909150806115f9848763ffffffff6121e816565b8161160057fe5b049a5080611614848663ffffffff6121e816565b8161161b57fe5b04995060008b11801561162e575060008a115b611683576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180612b996028913960400191505060405180910390fd5b61168d3084612992565b611698878d8d611fdb565b6116a3868d8c611fdb565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8916916370a08231916024808301926020929190829003018186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d602081101561173957600080fd5b5051604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905191965073ffffffffffffffffffffffffffffffffffffffff8816916370a0823191602480820192602092909190829003018186803b1580156117ab57600080fd5b505afa1580156117bf573d6000803e3d6000fd5b505050506040513d60208110156117d557600080fd5b505193506117e585858b8b6122e0565b811561182757600854611823906dffffffffffffffffffffffffffff808216916e01000000000000000000000000000090041663ffffffff6121e816565b600b555b604080518c8152602081018c9052815173ffffffffffffffffffffffffffffffffffffffff8f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f554e492d5632000000000000000000000000000000000000000000000000000081525081565b6000610df233848461260b565b6103e881565b600c5460011461194f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654600754600854604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff9485169490931692611a2b9285928792611a26926dffffffffffffffffffffffffffff169185916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b505afa158015611a02573d6000803e3d6000fd5b505050506040513d6020811015611a1857600080fd5b50519063ffffffff61226e16565b611fdb565b600854604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611aca9284928792611a26926e01000000000000000000000000000090046dffffffffffffffffffffffffffff169173ffffffffffffffffffffffffffffffffffffffff8616916370a0823191602480820192602092909190829003018186803b1580156119ee57600080fd5b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611b7b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f556e697377617056323a20455850495245440000000000000000000000000000604482015290519081900360640190fd5b60035473ffffffffffffffffffffffffffffffffffffffff80891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e0850182528051908301207f19010000000000000000000000000000000000000000000000000000000000006101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e2808201937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019281900390910190855afa158015611cdc573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611d5757508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611dc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611dcd89898961259c565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611e6657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f556e697377617056323a204c4f434b4544000000000000000000000000000000604482015290519081900360640190fd5b6000600c55600654604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051611fd49273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d6020811015611f0757600080fd5b5051600754604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff909216916370a0823191602480820192602092909190829003018186803b158015611f7a57600080fd5b505afa158015611f8e573d6000803e3d6000fd5b505050506040513d6020811015611fa457600080fd5b50516008546dffffffffffffffffffffffffffff808216916e0100000000000000000000000000009004166122e0565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e743235362900000000000000602091820152815173ffffffffffffffffffffffffffffffffffffffff85811660248301526044808301869052845180840390910181526064909201845291810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251815160009460609489169392918291908083835b602083106120e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016120a4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612143576040519150601f19603f3d011682016040523d82523d6000602084013e612148565b606091505b5091509150818015612176575080511580612176575080806020019051602081101561217357600080fd5b50515b6121e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b60008115806122035750508082028282828161220057fe5b04145b610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b80820382811115610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b6dffffffffffffffffffffffffffff841180159061230c57506dffffffffffffffffffffffffffff8311155b61237757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f556e697377617056323a204f564552464c4f5700000000000000000000000000604482015290519081900360640190fd5b60085463ffffffff428116917c0100000000000000000000000000000000000000000000000000000000900481168203908116158015906123c757506dffffffffffffffffffffffffffff841615155b80156123e257506dffffffffffffffffffffffffffff831615155b15612492578063ffffffff16612425856123fb86612a57565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169063ffffffff612a7b16565b600980547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff929092169290920201905563ffffffff8116612465846123fb87612a57565b600a80547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff92909216929092020190555b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054612641908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff8085166000908152600160205260408082209390935590841681522054612683908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561275757600080fd5b505afa15801561276b573d6000803e3d6000fd5b505050506040513d602081101561278157600080fd5b5051600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061286457801561285f5760006127d86112576dffffffffffffffffffffffffffff88811690881663ffffffff6121e816565b905060006127e583612878565b90508082111561285c576000612813612804848463ffffffff61226e16565b6000549063ffffffff6121e816565b905060006128388361282c86600563ffffffff6121e816565b9063ffffffff612abc16565b9050600081838161284557fe5b04905080156128585761285887826128ca565b5050505b50505b612870565b8015612870576000600b555b505092915050565b600060038211156128bb575080600160028204015b818110156128b5578091506002818285816128a457fe5b0401816128ad57fe5b04905061288d565b506128c5565b81156128c5575060015b919050565b6000546128dd908263ffffffff612abc16565b600090815573ffffffffffffffffffffffffffffffffffffffff8316815260016020526040902054612915908263ffffffff612abc16565b73ffffffffffffffffffffffffffffffffffffffff831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6000818310612989578161298b565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600160205260409020546129c8908263ffffffff61226e16565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081209190915554612a02908263ffffffff61226e16565b600090815560408051838152905173ffffffffffffffffffffffffffffffffffffffff8516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6dffffffffffffffffffffffffffff166e0100000000000000000000000000000290565b60006dffffffffffffffffffffffffffff82167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff841681612ab457fe5b049392505050565b80820182811015610df657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158207dca18479e58487606bf70c79e44d8dee62353c9ee6d01f9a9d70885b8765f2264736f6c63430005100032
// File: contracts/interfaces/IUniswapV2Pair.sol pragma solidity >=0.5.0; interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; } // File: contracts/interfaces/IUniswapV2ERC20.sol pragma solidity >=0.5.0; interface IUniswapV2ERC20 { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; } // File: contracts/libraries/SafeMath.sol pragma solidity =0.5.16; // a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math) library SafeMath { function add(uint x, uint y) internal pure returns (uint z) { require((z = x + y) >= x, 'ds-math-add-overflow'); } function sub(uint x, uint y) internal pure returns (uint z) { require((z = x - y) <= x, 'ds-math-sub-underflow'); } function mul(uint x, uint y) internal pure returns (uint z) { require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow'); } } // File: contracts/UniswapV2ERC20.sol pragma solidity =0.5.16; contract UniswapV2ERC20 is IUniswapV2ERC20 { using SafeMath for uint; string public constant name = 'Uniswap V2'; string public constant symbol = 'UNI-V2'; uint8 public constant decimals = 18; uint public totalSupply; mapping(address => uint) public balanceOf; mapping(address => mapping(address => uint)) public allowance; bytes32 public DOMAIN_SEPARATOR; // keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9; mapping(address => uint) public nonces; event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); constructor() public { uint chainId; assembly { chainId := chainid } DOMAIN_SEPARATOR = keccak256( abi.encode( keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'), keccak256(bytes(name)), keccak256(bytes('1')), chainId, address(this) ) ); } function _mint(address to, uint value) internal { totalSupply = totalSupply.add(value); balanceOf[to] = balanceOf[to].add(value); emit Transfer(address(0), to, value); } function _burn(address from, uint value) internal { balanceOf[from] = balanceOf[from].sub(value); totalSupply = totalSupply.sub(value); emit Transfer(from, address(0), value); } function _approve(address owner, address spender, uint value) private { allowance[owner][spender] = value; emit Approval(owner, spender, value); } function _transfer(address from, address to, uint value) private { balanceOf[from] = balanceOf[from].sub(value); balanceOf[to] = balanceOf[to].add(value); emit Transfer(from, to, value); } function approve(address spender, uint value) external returns (bool) { _approve(msg.sender, spender, value); return true; } function transfer(address to, uint value) external returns (bool) { _transfer(msg.sender, to, value); return true; } function transferFrom(address from, address to, uint value) external returns (bool) { if (allowance[from][msg.sender] != uint(-1)) { allowance[from][msg.sender] = allowance[from][msg.sender].sub(value); } _transfer(from, to, value); return true; } function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external { require(deadline >= block.timestamp, 'UniswapV2: EXPIRED'); bytes32 digest = keccak256( abi.encodePacked( '\x19\x01', DOMAIN_SEPARATOR, keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline)) ) ); address recoveredAddress = ecrecover(digest, v, r, s); require(recoveredAddress != address(0) && recoveredAddress == owner, 'UniswapV2: INVALID_SIGNATURE'); _approve(owner, spender, value); } } // File: contracts/libraries/Math.sol pragma solidity =0.5.16; // a library for performing various math operations library Math { function min(uint x, uint y) internal pure returns (uint z) { z = x < y ? x : y; } // babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method) function sqrt(uint y) internal pure returns (uint z) { if (y > 3) { z = y; uint x = y / 2 + 1; while (x < z) { z = x; x = (y / x + x) / 2; } } else if (y != 0) { z = 1; } } } // File: contracts/libraries/UQ112x112.sol pragma solidity =0.5.16; // a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format)) // range: [0, 2**112 - 1] // resolution: 1 / 2**112 library UQ112x112 { uint224 constant Q112 = 2**112; // encode a uint112 as a UQ112x112 function encode(uint112 y) internal pure returns (uint224 z) { z = uint224(y) * Q112; // never overflows } // divide a UQ112x112 by a uint112, returning a UQ112x112 function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) { z = x / uint224(y); } } // File: contracts/interfaces/IERC20.sol pragma solidity >=0.5.0; interface IERC20 { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); } // File: contracts/interfaces/IUniswapV2Factory.sol pragma solidity >=0.5.0; interface IUniswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint) external view returns (address pair); function allPairsLength() external view returns (uint); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; } // File: contracts/interfaces/IUniswapV2Callee.sol pragma solidity >=0.5.0; interface IUniswapV2Callee { function uniswapV2Call(address sender, uint amount0, uint amount1, bytes calldata data) external; } // File: contracts/UniswapV2Pair.sol pragma solidity =0.5.16; contract UniswapV2Pair is IUniswapV2Pair, UniswapV2ERC20 { using SafeMath for uint; using UQ112x112 for uint224; uint public constant MINIMUM_LIQUIDITY = 10**3; bytes4 private constant SELECTOR = bytes4(keccak256(bytes('transfer(address,uint256)'))); address public factory; address public token0; address public token1; uint112 private reserve0; // uses single storage slot, accessible via getReserves uint112 private reserve1; // uses single storage slot, accessible via getReserves uint32 private blockTimestampLast; // uses single storage slot, accessible via getReserves uint public price0CumulativeLast; uint public price1CumulativeLast; uint public kLast; // reserve0 * reserve1, as of immediately after the most recent liquidity event uint private unlocked = 1; modifier lock() { require(unlocked == 1, 'UniswapV2: LOCKED'); unlocked = 0; _; unlocked = 1; } function getReserves() public view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast) { _reserve0 = reserve0; _reserve1 = reserve1; _blockTimestampLast = blockTimestampLast; } function _safeTransfer(address token, address to, uint value) private { (bool success, bytes memory data) = token.call(abi.encodeWithSelector(SELECTOR, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'UniswapV2: TRANSFER_FAILED'); } event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); constructor() public { factory = msg.sender; } // called once by the factory at time of deployment function initialize(address _token0, address _token1) external { require(msg.sender == factory, 'UniswapV2: FORBIDDEN'); // sufficient check token0 = _token0; token1 = _token1; } // update reserves and, on the first call per block, price accumulators function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private { require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'UniswapV2: OVERFLOW'); uint32 blockTimestamp = uint32(block.timestamp % 2**32); uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) { // * never overflows, and + overflow is desired price0CumulativeLast += uint(UQ112x112.encode(_reserve1).uqdiv(_reserve0)) * timeElapsed; price1CumulativeLast += uint(UQ112x112.encode(_reserve0).uqdiv(_reserve1)) * timeElapsed; } reserve0 = uint112(balance0); reserve1 = uint112(balance1); blockTimestampLast = blockTimestamp; emit Sync(reserve0, reserve1); } // if fee is on, mint liquidity equivalent to 1/6th of the growth in sqrt(k) function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) { address feeTo = IUniswapV2Factory(factory).feeTo(); feeOn = feeTo != address(0); uint _kLast = kLast; // gas savings if (feeOn) { if (_kLast != 0) { uint rootK = Math.sqrt(uint(_reserve0).mul(_reserve1)); uint rootKLast = Math.sqrt(_kLast); if (rootK > rootKLast) { uint numerator = totalSupply.mul(rootK.sub(rootKLast)); uint denominator = rootK.mul(5).add(rootKLast); uint liquidity = numerator / denominator; if (liquidity > 0) _mint(feeTo, liquidity); } } } else if (_kLast != 0) { kLast = 0; } } // this low-level function should be called from a contract which performs important safety checks function mint(address to) external lock returns (uint liquidity) { (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings uint balance0 = IERC20(token0).balanceOf(address(this)); uint balance1 = IERC20(token1).balanceOf(address(this)); uint amount0 = balance0.sub(_reserve0); uint amount1 = balance1.sub(_reserve1); bool feeOn = _mintFee(_reserve0, _reserve1); uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee if (_totalSupply == 0) { liquidity = Math.sqrt(amount0.mul(amount1)).sub(MINIMUM_LIQUIDITY); _mint(address(0), MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens } else { liquidity = Math.min(amount0.mul(_totalSupply) / _reserve0, amount1.mul(_totalSupply) / _reserve1); } require(liquidity > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED'); _mint(to, liquidity); _update(balance0, balance1, _reserve0, _reserve1); if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date emit Mint(msg.sender, amount0, amount1); } // this low-level function should be called from a contract which performs important safety checks function burn(address to) external lock returns (uint amount0, uint amount1) { (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings address _token0 = token0; // gas savings address _token1 = token1; // gas savings uint balance0 = IERC20(_token0).balanceOf(address(this)); uint balance1 = IERC20(_token1).balanceOf(address(this)); uint liquidity = balanceOf[address(this)]; bool feeOn = _mintFee(_reserve0, _reserve1); uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee amount0 = liquidity.mul(balance0) / _totalSupply; // using balances ensures pro-rata distribution amount1 = liquidity.mul(balance1) / _totalSupply; // using balances ensures pro-rata distribution require(amount0 > 0 && amount1 > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED'); _burn(address(this), liquidity); _safeTransfer(_token0, to, amount0); _safeTransfer(_token1, to, amount1); balance0 = IERC20(_token0).balanceOf(address(this)); balance1 = IERC20(_token1).balanceOf(address(this)); _update(balance0, balance1, _reserve0, _reserve1); if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date emit Burn(msg.sender, amount0, amount1, to); } // this low-level function should be called from a contract which performs important safety checks function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external lock { require(amount0Out > 0 || amount1Out > 0, 'UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT'); (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings require(amount0Out < _reserve0 && amount1Out < _reserve1, 'UniswapV2: INSUFFICIENT_LIQUIDITY'); uint balance0; uint balance1; { // scope for _token{0,1}, avoids stack too deep errors address _token0 = token0; address _token1 = token1; require(to != _token0 && to != _token1, 'UniswapV2: INVALID_TO'); if (amount0Out > 0) _safeTransfer(_token0, to, amount0Out); // optimistically transfer tokens if (amount1Out > 0) _safeTransfer(_token1, to, amount1Out); // optimistically transfer tokens if (data.length > 0) IUniswapV2Callee(to).uniswapV2Call(msg.sender, amount0Out, amount1Out, data); balance0 = IERC20(_token0).balanceOf(address(this)); balance1 = IERC20(_token1).balanceOf(address(this)); } uint amount0In = balance0 > _reserve0 - amount0Out ? balance0 - (_reserve0 - amount0Out) : 0; uint amount1In = balance1 > _reserve1 - amount1Out ? balance1 - (_reserve1 - amount1Out) : 0; require(amount0In > 0 || amount1In > 0, 'UniswapV2: INSUFFICIENT_INPUT_AMOUNT'); { // scope for reserve{0,1}Adjusted, avoids stack too deep errors uint balance0Adjusted = balance0.mul(1000).sub(amount0In.mul(3)); uint balance1Adjusted = balance1.mul(1000).sub(amount1In.mul(3)); require(balance0Adjusted.mul(balance1Adjusted) >= uint(_reserve0).mul(_reserve1).mul(1000**2), 'UniswapV2: K'); } _update(balance0, balance1, _reserve0, _reserve1); emit Swap(msg.sender, amount0In, amount1In, amount0Out, amount1Out, to); } // force balances to match reserves function skim(address to) external lock { address _token0 = token0; // gas savings address _token1 = token1; // gas savings _safeTransfer(_token0, to, IERC20(_token0).balanceOf(address(this)).sub(reserve0)); _safeTransfer(_token1, to, IERC20(_token1).balanceOf(address(this)).sub(reserve1)); } // force reserves to match balances function sync() external lock { _update(IERC20(token0).balanceOf(address(this)), IERC20(token1).balanceOf(address(this)), reserve0, reserve1); } }
1
19,493,385
c6960d819efe44f440023aa1f0a02f836517e211a34272b7664c11fc5993bcad
c91e0cabc1c46ea7f2d97c23735420d67d1569ffdc536d4ba8d9d4011031f4d9
c0ef4b07e7334abd2cb613e1de40d292e312ea06
2269bceb3f4e0aa53d2fc43b1b7c5c5d13b119a5
77f5e0668759e2c679ec545ab243d38b512e5f6e
3d602d80600a3d3981f3363d3d373d3d3d363d73de9a07e5f1eaf3236e84724e0a221ce44d7b26575af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73de9a07e5f1eaf3236e84724e0a221ce44d7b26575af43d82803e903d91602b57fd5bf3
{{ "language": "Solidity", "sources": { "@nfts2me/contracts/important/README.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * .::. //\n * ...... //\n * .... ::. //\n * .:.. :: ... //\n * ..:. :: ... //\n * ::. ..:-- ::. ... //\n * .: ..:::::-==: :::::.. : //\n * .: :::::::-====: :::::::: : //\n * .: :::::::-======. :::::::: : //\n * .: :::::::-=======-:::::::: : //\n * .: :::::::-========-::::::: : //\n * .: ::::::::========-::::::: : //\n * .: :::::::. .======-::::::: : //\n * .: :::::::. :====-::::::: : //\n * .: .:::::. -==-:::::. : //\n * .:. .:. .--:.. ... //\n * .:. :. ... //\n * .... :. .... //\n * .:. .:. //\n * .::::. //\n * :--. //\n * //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * More info at: https://docs.nfts2me.com/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\n/// @title NFTs2Me.com Smart Contracts README\n/// @author The NFTs2Me Team\n/// @notice Read our terms of service\n/// @custom:security-contact [email protected]\n/// @custom:terms-of-service https://nfts2me.com/terms-of-service/\n/// @custom:website https://nfts2me.com/\ninterface Readme {\n function n2mVersion() external pure returns (uint256);\n }\n" }, "@nfts2me/contracts/interfaces/IN2M_ERCBase.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol\";\nimport \"./IN2M_ERCStorage.sol\";\n\ninterface IN2M_ERCBase is IERC2981Upgradeable, IN2M_ERCStorage {\n /// @notice To be called to create the collection. Can only be called once.\n function initialize\n (\n string memory tokenName,\n string memory tokenSymbol,\n uint256 iMintPrice,\n bytes32 baseURICIDHash,\n bytes32 placeholderImageCIDHash,\n RevenueAddress[] calldata revenueAddresses,\n address iErc20PaymentAddress,\n uint32 iTotalSupply,\n uint16 iRoyaltyFee,\n bool soulboundCollection,\n MintingType iMintingType\n ) external payable;\n\n /// @notice A descriptive name for a collection of NFTs in this contract\n function name() external view returns (string memory);\n\n /// @notice An abbreviated name for NFTs in this contract\n /// @return the collection symbol\n function symbol() external view returns (string memory);\n\n /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.\n /// @dev Throws if `_tokenId` is not a valid NFT. URIs are defined in RFC\n /// 3986. The URI may point to a JSON file that conforms to the \"ERC721\n /// Metadata JSON Schema\".\n function tokenURI(uint256 tokenId) external view returns (string memory);\n\n /// @notice Mints one NFT to the caller (msg.sender). Requires `minting type` to be `sequential` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n function mint() external payable;\n\n /// @notice Mints `amount` NFTs to the caller (msg.sender). Requires `minting type` to be `sequential` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n /// @param amount The number of NFTs to mint\n function mint(uint256 amount) external payable;\n\n /// @notice Mints `amount` NFTs to the caller (msg.sender) with a given `affiliate`. Requires `minting type` to be `sequential` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n /// @param amount The number of NFTs to mint\n /// @param affiliate The affiliate address\n function mint(uint256 amount, address affiliate) external payable;\n\n /// @notice Mints `amount` NFTs to `to` address. Requires `minting type` to be `sequential` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n /// @param to The address of the NFTs receiver\n /// @param amount The number of NFTs to mint \n function mintTo(address to, uint256 amount) external payable;\n\n /// @notice Mints `amount` NFTs to `to` address with a given `affiliate`. Requires `minting type` to be `sequential` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n /// @param to The address of the NFTs receiver\n /// @param amount The number of NFTs to mint \n /// @param affiliate The affiliate address\n function mintTo(address to, uint256 amount, address affiliate) external payable;\n\n /// @notice Two phases on-chain random minting. Mints `amount` NFTs tickets to `to` address. Requires `minting type` to be `random` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment). Once minted, those tickets must be redeemed for an actual token calling `redeemRandom()`.\n /// @param to The address of the NFTs receiver\n /// @param amount The number of NFTs to mint \n function mintRandomTo(address to, uint256 amount) external payable; \n\n /// @notice Two phases on-chain random minting. Mints `amount` NFTs tickets to `to` address with a given `affiliate`. Requires `minting type` to be `random` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment). Once minted, those tickets must be redeemed for an actual token calling `redeemRandom()`.\n /// @param to The address of the NFTs receiver\n /// @param amount The number of NFTs to mint \n /// @param affiliate The affiliate address\n function mintRandomTo(address to, uint256 amount, address affiliate) external payable;\n\n /// @notice Redeems remaining random tickets generated from `msg.sender` by calling `mintRandomTo` for actual NFTs.\n function redeemRandom() external payable;\n\n /// @notice Mints `amount` NFTs to `to` address. Requires `minting type` to be `specify` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n /// @param to The address of the NFTs receiver\n /// @param tokenIds An array of the specified tokens. They must not be minted, otherwise, it will revert.\n function mintSpecifyTo(address to, uint256[] memory tokenIds) external payable; \n\n /// @notice Mints `amount` NFTs to `to` address with a given `affiliate`. Requires `minting type` to be `specify` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n /// @param to The address of the NFTs receiver\n /// @param tokenIds An array of the specified tokens. They must not be minted, otherwise, it will revert.\n /// @param affiliate The affiliate address\n function mintSpecifyTo(address to, uint256[] memory tokenIds, address affiliate) external payable; \n\n /// @notice Mints one NFT to `to` address. Requires `minting type` to be `customURI`.\n /// @param to The address of the NFTs receiver\n /// @param customURICIDHash The CID of the given token.\n /// @param soulbound True if the NFT is a Soulbound Token (SBT). If set, it can't be transferred.\n function mintCustomURITo(address to, bytes32 customURICIDHash, bool soulbound) external payable;\n\n /// @notice Only owner can call this function. Free of charge. Mints sizeof(`to`) to `to` addresses. Requires `minting type` to be `sequential`.\n /// @param to The addresses of the NFTs receivers\n /// @param soulbound True if the NFT is a Soulbound Token (SBT). If set, it can't be transferred.\n function airdropSequential(address[] memory to, bool soulbound) external payable;\n\n /// @notice Only owner can call this function. Free of charge. Mints sizeof(`to`) to `to` addresses with random tokenIds. Requires `minting type` to be `random`.\n /// @param to The addresses of the NFTs receivers\n /// @param soulbound True if the NFT is a Soulbound Token (SBT). If set, it can't be transferred.\n function airdropRandom(address[] memory to, bool soulbound) external payable;\n\n /// @notice Only owner can call this function. Free of charge. Mints sizeof(`to`) to `to` addresses with specified tokenIds. Requires `minting type` to be `specify`.\n /// @param to The addresses of the NFTs receivers\n /// @param tokenIds An array of the specified tokens. They must not be minted, otherwise, it will revert.\n /// @param soulbound True if the NFT is a Soulbound Token (SBT). If set, it can't be transferred.\n function airdropSpecify(address[] memory to, uint256[] memory tokenIds, bool soulbound) external payable;\n\n /// @notice Mints `amount` of NFTs to `to` address with optional specified tokenIds. This function must be called only if a valid `signature` is given during a whitelisting/presale.\n /// @param to The addresses of the NFTs receivers\n /// @param tokenIds An optional array of the specified tokens. They must not be minted, otherwise, it will revert. Only used if minting type is `specify`.\n /// @param freeMinting True is minting is free\n /// @param customFee Zero is fee is different from `mintingPrice`.\n /// @param maxAmount Max Amount to be minted with the given `signature`.\n /// @param amount Amount to mint.\n /// @param soulbound True if the NFT is a Soulbound Token (SBT). If set, it can't be transferred.\n /// @param signature Valid `signature` for the presale/whitelist.\n function mintPresale (\n address to, \n uint256[] memory tokenIds,\n bool freeMinting, \n uint256 customFee, \n uint256 maxAmount,\n uint256 amount, \n bool soulbound,\n bytes calldata signature) payable external;\n\n /// @notice Returns the minting price of one NFT.\n /// @return Mint price for one NFT in native coin or ERC-20.\n function mintPrice() external view returns (uint256);\n\n /// @notice Returns the current total supply.\n /// @return Current total supply.\n function totalSupply() external view returns (uint256);\n\n /// @notice Max amount of NFTs to be hold per address.\n /// @return Max per address allowed.\n function maxPerAddress() external view returns (uint16);\n\n}\n\n" }, "@nfts2me/contracts/interfaces/IN2M_ERCStorage.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"../important/README.sol\";\n\ninterface IN2M_ERCStorage is Readme {\n /// @notice This event is emitted when a token is minted using an affiliate\n /// @param affiliate The affiliate address\n event AffiliateSell(address indexed affiliate);\n\n /// @notice Error thrown when trying to mint a token with a given id which is already minted\n error TokenAlreadyMinted();\n\n /// @notice Error thrown when input variable differ in length\n error InvalidInputSizesDontMatch();\n\n /// @notice Error thrown when input variable differ in length\n error InputSizeMismatch();\n\n /// @notice Error thrown when trying to mint a token with a given invalid id\n error InvalidTokenId();\n\n /// @notice Error thrown when trying to redeem random tickets with no amount to redeem\n error NothingToRedeem();\n\n /// @notice Error thrown when trying to redeem random tickets too soon\n error CantRevealYetWaitABitToBeAbleToRedeem();\n\n /// @notice Error thrown when the input amount is not valid\n error InvalidAmount();\n\n /// @notice Error thrown when trying to mint a sold out collection or the amount to mint exceeds the remaining supply\n error CollectionSoldOut();\n\n /// @notice Error thrown when trying to presale/whitelist mint and the collection current phase is `closed`\n error PresaleNotOpen();\n\n /// @notice Error thrown when trying to mint and the collection current phase is not `open`\n error PublicSaleNotOpen();\n\n /// @notice Error thrown when trying to mint but the sale has already finished\n error SaleFinished();\n\n /// @notice Error thrown when trying to mint more than the allowance to mint\n error NotEnoughAmountToMint();\n\n /// @notice Error thrown when sending funds to a free minting\n error InvalidMintFeeForFreeMinting();\n\n /// @notice Error thrown when the sent amount is not valid\n error InvalidMintFee();\n\n /// @notice Royalty fee can't be higher than 10%\n error RoyaltyFeeTooHigh();\n\n /// @notice Invalid input. Total supply must be greater than zero\n error TotalSupplyMustBeGreaterThanZero();\n\n /// @notice Can't set BaseURI and Placeholder at the same time\n error CantSetBaseURIAndPlaceholderAtTheSameTime();\n\n /// @notice No BaseURI nor Placeholder set\n error NoBaseURINorPlaceholderSet();\n\n /// @notice Can't transfer a Soulbound Token (SBT)\n error NonTransferrableSoulboundNFT();\n\n /// @notice The input revenue percentages are not valid\n error InvalidRevenuePercentage();\n\n /// @notice Can't mint until specified drop date\n error WaitUntilDropDate();\n\n /// @notice Trying to use mintPresale method in a collection with a minting type that doesn't support whitelist\n error PresaleInvalidMintingType();\n\n /// @notice Metadata is already fixed. Can't change metadata once fixed\n error MetadataAlreadyFixed();\n\n /// @notice Invalid collection minting type for the current minting function\n error InvalidMintingType();\n\n /// @notice The address exceeded the max per address amount\n error MaxPerAddressExceeded();\n\n /// @notice The given signature doesn't match the input values\n error SignatureMismatch();\n\n /// @notice Reentrancy Guard protection\n error ReentrancyGuard();\n\n /// @notice New Placeholder can't be empty\n error NewPlaceholderCantBeEmpty();\n\n /// @notice New BaseURI can't be empty\n error NewBaseURICantBeEmpty(); \n\n /// @notice Invalid percentage or discount values\n error InvalidPercentageOrDiscountValues();\n\n /// @notice Can't lower current percentages\n error CantLowerCurrentPercentages();\n\n /// @notice Contract MetadataURI already fixed\n error ContractMetadataURIAlreadyFixed();\n\n /// @notice Only owner of N2M can call this function\n error OnlyOwnerOrN2M();\n\n /// @notice Only the given affiliate or N2M can call this function\n error OnlyAffiliateOrN2M();\n\n /// @notice The signature has expired\n error SignatureExpired();\n\n /// @notice Invalid phase can't be set without giving a date, use the proper functions\n error InvalidPhaseWithoutDate();\n\n /// @notice Invalid drop date\n error InvalidDropDate();\n\n /// @notice Operator address is filtered\n error AddressFiltered(address filtered);\n\n struct RandomTicket {\n uint256 amount;\n uint256 blockNumberToReveal;\n }\n\n struct RevenueAddress {\n address to;\n uint16 percentage;\n }\n\n struct AffiliateInformation {\n bool enabled;\n uint16 affiliatePercentage;\n uint16 userDiscount;\n }\n\n enum SalePhase { \n CLOSED,\n PRESALE,\n PUBLIC,\n DROP_DATE,\n DROP_AND_END_DATE\n }\n\n enum MintingType { \n SEQUENTIAL, \n RANDOM, \n SPECIFY, \n CUSTOM_URI \n }\n\n enum OperatorFilterStatus { \n ENABLED_NOT_INITIALIZED, \n ENABLED_EXISTS, \n DISABLED_NOT_INITIALIZED,\n DISABLED_EXISTS \n }\n\n /// @notice Returns true if the metadata is fixed and immutable. If the metadata hasn't been fixed yet it will return false. Once fixed, it can't be changed by anyone.\n function isMetadataFixed() external view returns (bool);\n\n}\n\n" }, "@nfts2me/contracts/interfaces/IN2MBeaconFactory.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\ninterface IN2MBeaconFactory {\n function getERC721Implementation() external view returns (address);\n function getERC1155Implementation() external view returns (address);\n}\n" }, "@nfts2me/contracts/interfaces/IN2MCrossFactory.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\ninterface IN2MCrossFactory {\n function getN2MTreasuryAddress() external pure returns (address);\n function ownerOf(uint256 tokenId) external view returns (address);\n function strictOwnerOf(uint256 tokenId) external view returns (address);\n}\n" }, "@nfts2me/contracts/interfaces/IOperatorFilterRegistry.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\ninterface IOperatorFilterRegistry {\n function isOperatorAllowed(address registrant, address operator) external view returns (bool);\n function register(address registrant) external;\n function registerAndSubscribe(address registrant, address subscription) external;\n function registerAndCopyEntries(address registrant, address registrantToCopy) external;\n function updateOperator(address registrant, address operator, bool filtered) external;\n function updateOperators(address registrant, address[] calldata operators, bool filtered) external;\n function updateCodeHash(address registrant, bytes32 codehash, bool filtered) external;\n function updateCodeHashes(address registrant, bytes32[] calldata codeHashes, bool filtered) external;\n function subscribe(address registrant, address registrantToSubscribe) external;\n function unsubscribe(address registrant, bool copyExistingEntries) external;\n function subscriptionOf(address addr) external returns (address registrant);\n function subscribers(address registrant) external returns (address[] memory);\n function subscriberAt(address registrant, uint256 index) external returns (address);\n function copyEntriesOf(address registrant, address registrantToCopy) external;\n function isOperatorFiltered(address registrant, address operator) external returns (bool);\n function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool);\n function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool);\n function filteredOperators(address addr) external returns (address[] memory);\n function filteredCodeHashes(address addr) external returns (bytes32[] memory);\n function filteredOperatorAt(address registrant, uint256 index) external returns (address);\n function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32);\n function isRegistered(address addr) external view returns (bool);\n function codeHashOf(address addr) external view returns (bytes32);\n}" }, "@nfts2me/contracts/ownable/NFTOwnableUpgradeable.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\";\n\n/// @title NFTs2Me.com Smart Contracts\n/// @author The NFTs2Me Team\n/// @notice Read our terms of service\n/// @custom:security-contact [email protected]\n/// @custom:terms-of-service https://nfts2me.com/terms-of-service/\n/// @custom:website https://nfts2me.com/\nabstract contract NFTOwnableUpgradeable is Initializable, ContextUpgradeable {\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n modifier onlyStrictOwner() {\n _checkStrictOwner();\n _;\n }\n\n modifier onlyOwnerOrN2M() {\n _checkOwnerOrN2M();\n _;\n }\n\n modifier onlyN2M() {\n _checkN2M();\n _;\n }\n\n /// @notice Returns the address of the current collection owner.\n /// @return The address of the owner.\n function owner() public view virtual returns (address);\n function _strictOwner() internal view virtual returns (address);\n function _getN2MFeeAddress() internal view virtual returns (address);\n\n function _checkOwner() internal view virtual {\n require(owner() == msg.sender, \"Ownable: caller is not the owner\");\n }\n\n function _checkStrictOwner() internal view virtual {\n require(_strictOwner() == msg.sender, \"Ownable: caller is not the owner\");\n }\n\n function _checkOwnerOrN2M() internal view virtual {\n require(owner() == msg.sender || _getN2MFeeAddress() == msg.sender, \"Ownable: caller is not the owner\");\n }\n\n function _checkN2M() internal view virtual {\n require(_getN2MFeeAddress() == msg.sender, \"Ownable: caller is not the owner\");\n }\n\n}" }, "@openzeppelin/contracts-upgradeable/governance/utils/IVotesUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (governance/utils/IVotes.sol)\npragma solidity ^0.8.0;\n\n/**\n * @dev Common interface for {ERC20Votes}, {ERC721Votes}, and other {Votes}-enabled contracts.\n *\n * _Available since v4.5._\n */\ninterface IVotesUpgradeable {\n /**\n * @dev Emitted when an account changes their delegate.\n */\n event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);\n\n /**\n * @dev Emitted when a token transfer or delegate change results in changes to a delegate's number of votes.\n */\n event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);\n\n /**\n * @dev Returns the current amount of votes that `account` has.\n */\n function getVotes(address account) external view returns (uint256);\n\n /**\n * @dev Returns the amount of votes that `account` had at the end of a past block (`blockNumber`).\n */\n function getPastVotes(address account, uint256 blockNumber) external view returns (uint256);\n\n /**\n * @dev Returns the total supply of votes available at the end of a past block (`blockNumber`).\n *\n * NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes.\n * Votes that have not been delegated are still part of total supply, even though they would not participate in a\n * vote.\n */\n function getPastTotalSupply(uint256 blockNumber) external view returns (uint256);\n\n /**\n * @dev Returns the delegate that `account` has chosen.\n */\n function delegates(address account) external view returns (address);\n\n /**\n * @dev Delegates votes from the sender to `delegatee`.\n */\n function delegate(address delegatee) external;\n\n /**\n * @dev Delegates votes from signer to `delegatee`.\n */\n function delegateBySig(\n address delegatee,\n uint256 nonce,\n uint256 expiry,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n}\n" }, "@openzeppelin/contracts-upgradeable/governance/utils/VotesUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (governance/utils/Votes.sol)\npragma solidity ^0.8.0;\n\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../utils/CountersUpgradeable.sol\";\nimport \"../../utils/CheckpointsUpgradeable.sol\";\nimport \"../../utils/cryptography/EIP712Upgradeable.sol\";\nimport \"./IVotesUpgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev This is a base abstract contract that tracks voting units, which are a measure of voting power that can be\n * transferred, and provides a system of vote delegation, where an account can delegate its voting units to a sort of\n * \"representative\" that will pool delegated voting units from different accounts and can then use it to vote in\n * decisions. In fact, voting units _must_ be delegated in order to count as actual votes, and an account has to\n * delegate those votes to itself if it wishes to participate in decisions and does not have a trusted representative.\n *\n * This contract is often combined with a token contract such that voting units correspond to token units. For an\n * example, see {ERC721Votes}.\n *\n * The full history of delegate votes is tracked on-chain so that governance protocols can consider votes as distributed\n * at a particular block number to protect against flash loans and double voting. The opt-in delegate system makes the\n * cost of this history tracking optional.\n *\n * When using this module the derived contract must implement {_getVotingUnits} (for example, make it return\n * {ERC721-balanceOf}), and can use {_transferVotingUnits} to track a change in the distribution of those units (in the\n * previous example, it would be included in {ERC721-_beforeTokenTransfer}).\n *\n * _Available since v4.5._\n */\nabstract contract VotesUpgradeable is Initializable, IVotesUpgradeable, ContextUpgradeable, EIP712Upgradeable {\n function __Votes_init() internal onlyInitializing {\n }\n\n function __Votes_init_unchained() internal onlyInitializing {\n }\n using CheckpointsUpgradeable for CheckpointsUpgradeable.History;\n using CountersUpgradeable for CountersUpgradeable.Counter;\n\n bytes32 private constant _DELEGATION_TYPEHASH =\n keccak256(\"Delegation(address delegatee,uint256 nonce,uint256 expiry)\");\n\n mapping(address => address) private _delegation;\n mapping(address => CheckpointsUpgradeable.History) private _delegateCheckpoints;\n CheckpointsUpgradeable.History private _totalCheckpoints;\n\n mapping(address => CountersUpgradeable.Counter) private _nonces;\n\n /**\n * @dev Returns the current amount of votes that `account` has.\n */\n function getVotes(address account) public view virtual override returns (uint256) {\n return _delegateCheckpoints[account].latest();\n }\n\n /**\n * @dev Returns the amount of votes that `account` had at the end of a past block (`blockNumber`).\n *\n * Requirements:\n *\n * - `blockNumber` must have been already mined\n */\n function getPastVotes(address account, uint256 blockNumber) public view virtual override returns (uint256) {\n return _delegateCheckpoints[account].getAtProbablyRecentBlock(blockNumber);\n }\n\n /**\n * @dev Returns the total supply of votes available at the end of a past block (`blockNumber`).\n *\n * NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes.\n * Votes that have not been delegated are still part of total supply, even though they would not participate in a\n * vote.\n *\n * Requirements:\n *\n * - `blockNumber` must have been already mined\n */\n function getPastTotalSupply(uint256 blockNumber) public view virtual override returns (uint256) {\n require(blockNumber < block.number, \"Votes: block not yet mined\");\n return _totalCheckpoints.getAtProbablyRecentBlock(blockNumber);\n }\n\n /**\n * @dev Returns the current total supply of votes.\n */\n function _getTotalSupply() internal view virtual returns (uint256) {\n return _totalCheckpoints.latest();\n }\n\n /**\n * @dev Returns the delegate that `account` has chosen.\n */\n function delegates(address account) public view virtual override returns (address) {\n return _delegation[account];\n }\n\n /**\n * @dev Delegates votes from the sender to `delegatee`.\n */\n function delegate(address delegatee) public virtual override {\n address account = _msgSender();\n _delegate(account, delegatee);\n }\n\n /**\n * @dev Delegates votes from signer to `delegatee`.\n */\n function delegateBySig(\n address delegatee,\n uint256 nonce,\n uint256 expiry,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public virtual override {\n require(block.timestamp <= expiry, \"Votes: signature expired\");\n address signer = ECDSAUpgradeable.recover(\n _hashTypedDataV4(keccak256(abi.encode(_DELEGATION_TYPEHASH, delegatee, nonce, expiry))),\n v,\n r,\n s\n );\n require(nonce == _useNonce(signer), \"Votes: invalid nonce\");\n _delegate(signer, delegatee);\n }\n\n /**\n * @dev Delegate all of `account`'s voting units to `delegatee`.\n *\n * Emits events {IVotes-DelegateChanged} and {IVotes-DelegateVotesChanged}.\n */\n function _delegate(address account, address delegatee) internal virtual {\n address oldDelegate = delegates(account);\n _delegation[account] = delegatee;\n\n emit DelegateChanged(account, oldDelegate, delegatee);\n _moveDelegateVotes(oldDelegate, delegatee, _getVotingUnits(account));\n }\n\n /**\n * @dev Transfers, mints, or burns voting units. To register a mint, `from` should be zero. To register a burn, `to`\n * should be zero. Total supply of voting units will be adjusted with mints and burns.\n */\n function _transferVotingUnits(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n if (from == address(0)) {\n _totalCheckpoints.push(_add, amount);\n }\n if (to == address(0)) {\n _totalCheckpoints.push(_subtract, amount);\n }\n _moveDelegateVotes(delegates(from), delegates(to), amount);\n }\n\n /**\n * @dev Moves delegated votes from one delegate to another.\n */\n function _moveDelegateVotes(\n address from,\n address to,\n uint256 amount\n ) private {\n if (from != to && amount > 0) {\n if (from != address(0)) {\n (uint256 oldValue, uint256 newValue) = _delegateCheckpoints[from].push(_subtract, amount);\n emit DelegateVotesChanged(from, oldValue, newValue);\n }\n if (to != address(0)) {\n (uint256 oldValue, uint256 newValue) = _delegateCheckpoints[to].push(_add, amount);\n emit DelegateVotesChanged(to, oldValue, newValue);\n }\n }\n }\n\n function _add(uint256 a, uint256 b) private pure returns (uint256) {\n return a + b;\n }\n\n function _subtract(uint256 a, uint256 b) private pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev Consumes a nonce.\n *\n * Returns the current value and increments nonce.\n */\n function _useNonce(address owner) internal virtual returns (uint256 current) {\n CountersUpgradeable.Counter storage nonce = _nonces[owner];\n current = nonce.current();\n nonce.increment();\n }\n\n /**\n * @dev Returns an address nonce.\n */\n function nonces(address owner) public view virtual returns (uint256) {\n return _nonces[owner].current();\n }\n\n /**\n * @dev Returns the contract's {EIP712} domain separator.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32) {\n return _domainSeparatorV4();\n }\n\n /**\n * @dev Must return the voting units held by an account.\n */\n function _getVotingUnits(address) internal view virtual returns (uint256);\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[46] private __gap;\n}\n" }, "@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Interface for the NFT Royalty Standard.\n *\n * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal\n * support for royalty payments across all NFT marketplaces and ecosystem participants.\n *\n * _Available since v4.5._\n */\ninterface IERC2981Upgradeable is IERC165Upgradeable {\n /**\n * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of\n * exchange. The royalty amount is denominated and should be paid in that same unit of exchange.\n */\n function royaltyInfo(uint256 tokenId, uint256 salePrice)\n external\n view\n returns (address receiver, uint256 royaltyAmount);\n}\n" }, "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Internal function that returns the initialized version. Returns `_initialized`\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Internal function that returns the initialized version. Returns `_initializing`\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" }, "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC1155/ERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC1155Upgradeable.sol\";\nimport \"./IERC1155ReceiverUpgradeable.sol\";\nimport \"./extensions/IERC1155MetadataURIUpgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the basic standard multi-token.\n * See https://eips.ethereum.org/EIPS/eip-1155\n * Originally based on code by Enjin: https://github.com/enjin/erc-1155\n *\n * _Available since v3.1._\n */\ncontract ERC1155Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC1155Upgradeable, IERC1155MetadataURIUpgradeable {\n using AddressUpgradeable for address;\n\n // Mapping from token ID to account balances\n mapping(uint256 => mapping(address => uint256)) private _balances;\n\n // Mapping from account to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json\n string private _uri;\n\n /**\n * @dev See {_setURI}.\n */\n function __ERC1155_init(string memory uri_) internal onlyInitializing {\n __ERC1155_init_unchained(uri_);\n }\n\n function __ERC1155_init_unchained(string memory uri_) internal onlyInitializing {\n _setURI(uri_);\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n return\n interfaceId == type(IERC1155Upgradeable).interfaceId ||\n interfaceId == type(IERC1155MetadataURIUpgradeable).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC1155MetadataURI-uri}.\n *\n * This implementation returns the same URI for *all* token types. It relies\n * on the token type ID substitution mechanism\n * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].\n *\n * Clients calling this function must replace the `\\{id\\}` substring with the\n * actual token type ID.\n */\n function uri(uint256) public view virtual override returns (string memory) {\n return _uri;\n }\n\n /**\n * @dev See {IERC1155-balanceOf}.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {\n require(account != address(0), \"ERC1155: address zero is not a valid owner\");\n return _balances[id][account];\n }\n\n /**\n * @dev See {IERC1155-balanceOfBatch}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] memory accounts, uint256[] memory ids)\n public\n view\n virtual\n override\n returns (uint256[] memory)\n {\n require(accounts.length == ids.length, \"ERC1155: accounts and ids length mismatch\");\n\n uint256[] memory batchBalances = new uint256[](accounts.length);\n\n for (uint256 i = 0; i < accounts.length; ++i) {\n batchBalances[i] = balanceOf(accounts[i], ids[i]);\n }\n\n return batchBalances;\n }\n\n /**\n * @dev See {IERC1155-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC1155-isApprovedForAll}.\n */\n function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[account][operator];\n }\n\n /**\n * @dev See {IERC1155-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public virtual override {\n require(\n from == _msgSender() || isApprovedForAll(from, _msgSender()),\n \"ERC1155: caller is not token owner or approved\"\n );\n _safeTransferFrom(from, to, id, amount, data);\n }\n\n /**\n * @dev See {IERC1155-safeBatchTransferFrom}.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public virtual override {\n require(\n from == _msgSender() || isApprovedForAll(from, _msgSender()),\n \"ERC1155: caller is not token owner or approved\"\n );\n _safeBatchTransferFrom(from, to, ids, amounts, data);\n }\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function _safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal virtual {\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n\n address operator = _msgSender();\n uint256[] memory ids = _asSingletonArray(id);\n uint256[] memory amounts = _asSingletonArray(amount);\n\n _beforeTokenTransfer(operator, from, to, ids, amounts, data);\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: insufficient balance for transfer\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n _balances[id][to] += amount;\n\n emit TransferSingle(operator, from, to, id, amount);\n\n _afterTokenTransfer(operator, from, to, ids, amounts, data);\n\n _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);\n }\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function _safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\n require(to != address(0), \"ERC1155: transfer to the zero address\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, from, to, ids, amounts, data);\n\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: insufficient balance for transfer\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n _balances[id][to] += amount;\n }\n\n emit TransferBatch(operator, from, to, ids, amounts);\n\n _afterTokenTransfer(operator, from, to, ids, amounts, data);\n\n _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);\n }\n\n /**\n * @dev Sets a new URI for all token types, by relying on the token type ID\n * substitution mechanism\n * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].\n *\n * By this mechanism, any occurrence of the `\\{id\\}` substring in either the\n * URI or any of the amounts in the JSON file at said URI will be replaced by\n * clients with the token type ID.\n *\n * For example, the `https://token-cdn-domain/\\{id\\}.json` URI would be\n * interpreted by clients as\n * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`\n * for token type ID 0x4cce0.\n *\n * See {uri}.\n *\n * Because these URIs cannot be meaningfully represented by the {URI} event,\n * this function emits no events.\n */\n function _setURI(string memory newuri) internal virtual {\n _uri = newuri;\n }\n\n /**\n * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function _mint(\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) internal virtual {\n require(to != address(0), \"ERC1155: mint to the zero address\");\n\n address operator = _msgSender();\n uint256[] memory ids = _asSingletonArray(id);\n uint256[] memory amounts = _asSingletonArray(amount);\n\n _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n _balances[id][to] += amount;\n emit TransferSingle(operator, address(0), to, id, amount);\n\n _afterTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);\n }\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function _mintBatch(\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {\n require(to != address(0), \"ERC1155: mint to the zero address\");\n require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n for (uint256 i = 0; i < ids.length; i++) {\n _balances[ids[i]][to] += amounts[i];\n }\n\n emit TransferBatch(operator, address(0), to, ids, amounts);\n\n _afterTokenTransfer(operator, address(0), to, ids, amounts, data);\n\n _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);\n }\n\n /**\n * @dev Destroys `amount` tokens of token type `id` from `from`\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `from` must have at least `amount` tokens of token type `id`.\n */\n function _burn(\n address from,\n uint256 id,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC1155: burn from the zero address\");\n\n address operator = _msgSender();\n uint256[] memory ids = _asSingletonArray(id);\n uint256[] memory amounts = _asSingletonArray(amount);\n\n _beforeTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: burn amount exceeds balance\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n\n emit TransferSingle(operator, from, address(0), id, amount);\n\n _afterTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n }\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n */\n function _burnBatch(\n address from,\n uint256[] memory ids,\n uint256[] memory amounts\n ) internal virtual {\n require(from != address(0), \"ERC1155: burn from the zero address\");\n require(ids.length == amounts.length, \"ERC1155: ids and amounts length mismatch\");\n\n address operator = _msgSender();\n\n _beforeTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n\n for (uint256 i = 0; i < ids.length; i++) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n\n uint256 fromBalance = _balances[id][from];\n require(fromBalance >= amount, \"ERC1155: burn amount exceeds balance\");\n unchecked {\n _balances[id][from] = fromBalance - amount;\n }\n }\n\n emit TransferBatch(operator, from, address(0), ids, amounts);\n\n _afterTokenTransfer(operator, from, address(0), ids, amounts, \"\");\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC1155: setting approval status for self\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting\n * and burning, as well as batched variants.\n *\n * The same hook is called on both single and batched variants. For single\n * transfers, the length of the `ids` and `amounts` arrays will be 1.\n *\n * Calling conditions (for each `id` and `amount` pair):\n *\n * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * of token type `id` will be transferred to `to`.\n * - When `from` is zero, `amount` tokens of token type `id` will be minted\n * for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`\n * will be burned.\n * - `from` and `to` are never both zero.\n * - `ids` and `amounts` have the same, non-zero length.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting\n * and burning, as well as batched variants.\n *\n * The same hook is called on both single and batched variants. For single\n * transfers, the length of the `id` and `amount` arrays will be 1.\n *\n * Calling conditions (for each `id` and `amount` pair):\n *\n * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * of token type `id` will be transferred to `to`.\n * - When `from` is zero, `amount` tokens of token type `id` will be minted\n * for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`\n * will be burned.\n * - `from` and `to` are never both zero.\n * - `ids` and `amounts` have the same, non-zero length.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual {}\n\n function _doSafeTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try IERC1155ReceiverUpgradeable(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {\n if (response != IERC1155ReceiverUpgradeable.onERC1155Received.selector) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non-ERC1155Receiver implementer\");\n }\n }\n }\n\n function _doSafeBatchTransferAcceptanceCheck(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) private {\n if (to.isContract()) {\n try IERC1155ReceiverUpgradeable(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (\n bytes4 response\n ) {\n if (response != IERC1155ReceiverUpgradeable.onERC1155BatchReceived.selector) {\n revert(\"ERC1155: ERC1155Receiver rejected tokens\");\n }\n } catch Error(string memory reason) {\n revert(reason);\n } catch {\n revert(\"ERC1155: transfer to non-ERC1155Receiver implementer\");\n }\n }\n }\n\n function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {\n uint256[] memory array = new uint256[](1);\n array[0] = element;\n\n return array;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[47] private __gap;\n}\n" }, "@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155SupplyUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/extensions/ERC1155Supply.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC1155Upgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Extension of ERC1155 that adds tracking of total supply per id.\n *\n * Useful for scenarios where Fungible and Non-fungible tokens have to be\n * clearly identified. Note: While a totalSupply of 1 might mean the\n * corresponding is an NFT, there is no guarantees that no other token with the\n * same id are not going to be minted.\n */\nabstract contract ERC1155SupplyUpgradeable is Initializable, ERC1155Upgradeable {\n function __ERC1155Supply_init() internal onlyInitializing {\n }\n\n function __ERC1155Supply_init_unchained() internal onlyInitializing {\n }\n mapping(uint256 => uint256) private _totalSupply;\n\n /**\n * @dev Total amount of tokens in with a given id.\n */\n function totalSupply(uint256 id) public view virtual returns (uint256) {\n return _totalSupply[id];\n }\n\n /**\n * @dev Indicates whether any token exist with a given id, or not.\n */\n function exists(uint256 id) public view virtual returns (bool) {\n return ERC1155SupplyUpgradeable.totalSupply(id) > 0;\n }\n\n /**\n * @dev See {ERC1155-_beforeTokenTransfer}.\n */\n function _beforeTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal virtual override {\n super._beforeTokenTransfer(operator, from, to, ids, amounts, data);\n\n if (from == address(0)) {\n for (uint256 i = 0; i < ids.length; ++i) {\n _totalSupply[ids[i]] += amounts[i];\n }\n }\n\n if (to == address(0)) {\n for (uint256 i = 0; i < ids.length; ++i) {\n uint256 id = ids[i];\n uint256 amount = amounts[i];\n uint256 supply = _totalSupply[id];\n require(supply >= amount, \"ERC1155: burn amount exceeds totalSupply\");\n unchecked {\n _totalSupply[id] = supply - amount;\n }\n }\n }\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" }, "@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/IERC1155MetadataURIUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155Upgradeable.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURIUpgradeable is IERC1155Upgradeable {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" }, "@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155ReceiverUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev _Available since v3.1._\n */\ninterface IERC1155ReceiverUpgradeable is IERC165Upgradeable {\n /**\n * @dev Handles the receipt of a single ERC1155 token type. This function is\n * called at the end of a `safeTransferFrom` after the balance has been updated.\n *\n * NOTE: To accept the transfer, this must return\n * `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))`\n * (i.e. 0xf23a6e61, or its own function selector).\n *\n * @param operator The address which initiated the transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param id The ID of the token being transferred\n * @param value The amount of tokens being transferred\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155Received(address,address,uint256,uint256,bytes)\"))` if transfer is allowed\n */\n function onERC1155Received(\n address operator,\n address from,\n uint256 id,\n uint256 value,\n bytes calldata data\n ) external returns (bytes4);\n\n /**\n * @dev Handles the receipt of a multiple ERC1155 token types. This function\n * is called at the end of a `safeBatchTransferFrom` after the balances have\n * been updated.\n *\n * NOTE: To accept the transfer(s), this must return\n * `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))`\n * (i.e. 0xbc197c81, or its own function selector).\n *\n * @param operator The address which initiated the batch transfer (i.e. msg.sender)\n * @param from The address which previously owned the token\n * @param ids An array containing ids of each token being transferred (order and length must match values array)\n * @param values An array containing amounts of each token being transferred (order and length must match ids array)\n * @param data Additional data with no specified format\n * @return `bytes4(keccak256(\"onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)\"))` if transfer is allowed\n */\n function onERC1155BatchReceived(\n address operator,\n address from,\n uint256[] calldata ids,\n uint256[] calldata values,\n bytes calldata data\n ) external returns (bytes4);\n}\n" }, "@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155Upgradeable is IERC165Upgradeable {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" }, "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" }, "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" }, "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\nimport \"../extensions/draft-IERC20PermitUpgradeable.sol\";\nimport \"../../../utils/AddressUpgradeable.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20Upgradeable {\n using AddressUpgradeable for address;\n\n function safeTransfer(\n IERC20Upgradeable token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20Upgradeable token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20PermitUpgradeable token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" }, "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721Upgradeable.sol\";\nimport \"./IERC721ReceiverUpgradeable.sol\";\nimport \"./extensions/IERC721MetadataUpgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../utils/StringsUpgradeable.sol\";\nimport \"../../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\n using AddressUpgradeable for address;\n using StringsUpgradeable for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __ERC721_init_unchained(name_, symbol_);\n }\n\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n return\n interfaceId == type(IERC721Upgradeable).interfaceId ||\n interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721Upgradeable.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256, /* firstTokenId */\n uint256 batchSize\n ) internal virtual {\n if (batchSize > 1) {\n if (from != address(0)) {\n _balances[from] -= batchSize;\n }\n if (to != address(0)) {\n _balances[to] += batchSize;\n }\n }\n }\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual {}\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[44] private __gap;\n}\n" }, "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721URIStorageUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/extensions/ERC721URIStorage.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC721Upgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev ERC721 token with storage based token URI management.\n */\nabstract contract ERC721URIStorageUpgradeable is Initializable, ERC721Upgradeable {\n function __ERC721URIStorage_init() internal onlyInitializing {\n }\n\n function __ERC721URIStorage_init_unchained() internal onlyInitializing {\n }\n using StringsUpgradeable for uint256;\n\n // Optional mapping for token URIs\n mapping(uint256 => string) private _tokenURIs;\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory _tokenURI = _tokenURIs[tokenId];\n string memory base = _baseURI();\n\n // If there is no base URI, return the token URI.\n if (bytes(base).length == 0) {\n return _tokenURI;\n }\n // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).\n if (bytes(_tokenURI).length > 0) {\n return string(abi.encodePacked(base, _tokenURI));\n }\n\n return super.tokenURI(tokenId);\n }\n\n /**\n * @dev Sets `_tokenURI` as the tokenURI of `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {\n require(_exists(tokenId), \"ERC721URIStorage: URI set of nonexistent token\");\n _tokenURIs[tokenId] = _tokenURI;\n }\n\n /**\n * @dev See {ERC721-_burn}. This override additionally checks to see if a\n * token-specific URI was set for the token, and if so, it deletes the token URI from\n * the storage mapping.\n */\n function _burn(uint256 tokenId) internal virtual override {\n super._burn(tokenId);\n\n if (bytes(_tokenURIs[tokenId]).length != 0) {\n delete _tokenURIs[tokenId];\n }\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" }, "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721VotesUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/ERC721Votes.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC721Upgradeable.sol\";\nimport \"../../../governance/utils/VotesUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Extension of ERC721 to support voting and delegation as implemented by {Votes}, where each individual NFT counts\n * as 1 vote unit.\n *\n * Tokens do not count as votes until they are delegated, because votes must be tracked which incurs an additional cost\n * on every transfer. Token holders can either delegate to a trusted representative who will decide how to make use of\n * the votes in governance decisions, or they can delegate to themselves to be their own representative.\n *\n * _Available since v4.5._\n */\nabstract contract ERC721VotesUpgradeable is Initializable, ERC721Upgradeable, VotesUpgradeable {\n function __ERC721Votes_init() internal onlyInitializing {\n }\n\n function __ERC721Votes_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {ERC721-_afterTokenTransfer}. Adjusts votes when tokens are transferred.\n *\n * Emits a {IVotes-DelegateVotesChanged} event.\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual override {\n _transferVotingUnits(from, to, batchSize);\n super._afterTokenTransfer(from, to, firstTokenId, batchSize);\n }\n\n /**\n * @dev Returns the balance of `account`.\n */\n function _getVotingUnits(address account) internal view virtual override returns (uint256) {\n return balanceOf(account);\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" }, "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721Upgradeable.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721MetadataUpgradeable is IERC721Upgradeable {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" }, "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721ReceiverUpgradeable {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" }, "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721Upgradeable is IERC165Upgradeable {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" }, "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n}\n" }, "@openzeppelin/contracts-upgradeable/utils/CheckpointsUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Checkpoints.sol)\n// This file was procedurally generated from scripts/generate/templates/Checkpoints.js.\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\nimport \"./math/SafeCastUpgradeable.sol\";\n\n/**\n * @dev This library defines the `History` struct, for checkpointing values as they change at different points in\n * time, and later looking up past values by block number. See {Votes} as an example.\n *\n * To create a history of checkpoints define a variable type `Checkpoints.History` in your contract, and store a new\n * checkpoint for the current transaction block using the {push} function.\n *\n * _Available since v4.5._\n */\nlibrary CheckpointsUpgradeable {\n struct History {\n Checkpoint[] _checkpoints;\n }\n\n struct Checkpoint {\n uint32 _blockNumber;\n uint224 _value;\n }\n\n /**\n * @dev Returns the value at a given block number. If a checkpoint is not available at that block, the closest one\n * before it is returned, or zero otherwise.\n */\n function getAtBlock(History storage self, uint256 blockNumber) internal view returns (uint256) {\n require(blockNumber < block.number, \"Checkpoints: block not yet mined\");\n uint32 key = SafeCastUpgradeable.toUint32(blockNumber);\n\n uint256 len = self._checkpoints.length;\n uint256 pos = _upperBinaryLookup(self._checkpoints, key, 0, len);\n return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;\n }\n\n /**\n * @dev Returns the value at a given block number. If a checkpoint is not available at that block, the closest one\n * before it is returned, or zero otherwise. Similar to {upperLookup} but optimized for the case when the searched\n * checkpoint is probably \"recent\", defined as being among the last sqrt(N) checkpoints where N is the number of\n * checkpoints.\n */\n function getAtProbablyRecentBlock(History storage self, uint256 blockNumber) internal view returns (uint256) {\n require(blockNumber < block.number, \"Checkpoints: block not yet mined\");\n uint32 key = SafeCastUpgradeable.toUint32(blockNumber);\n\n uint256 len = self._checkpoints.length;\n\n uint256 low = 0;\n uint256 high = len;\n\n if (len > 5) {\n uint256 mid = len - MathUpgradeable.sqrt(len);\n if (key < _unsafeAccess(self._checkpoints, mid)._blockNumber) {\n high = mid;\n } else {\n low = mid + 1;\n }\n }\n\n uint256 pos = _upperBinaryLookup(self._checkpoints, key, low, high);\n\n return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;\n }\n\n /**\n * @dev Pushes a value onto a History so that it is stored as the checkpoint for the current block.\n *\n * Returns previous value and new value.\n */\n function push(History storage self, uint256 value) internal returns (uint256, uint256) {\n return _insert(self._checkpoints, SafeCastUpgradeable.toUint32(block.number), SafeCastUpgradeable.toUint224(value));\n }\n\n /**\n * @dev Pushes a value onto a History, by updating the latest value using binary operation `op`. The new value will\n * be set to `op(latest, delta)`.\n *\n * Returns previous value and new value.\n */\n function push(\n History storage self,\n function(uint256, uint256) view returns (uint256) op,\n uint256 delta\n ) internal returns (uint256, uint256) {\n return push(self, op(latest(self), delta));\n }\n\n /**\n * @dev Returns the value in the most recent checkpoint, or zero if there are no checkpoints.\n */\n function latest(History storage self) internal view returns (uint224) {\n uint256 pos = self._checkpoints.length;\n return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;\n }\n\n /**\n * @dev Returns whether there is a checkpoint in the structure (i.e. it is not empty), and if so the key and value\n * in the most recent checkpoint.\n */\n function latestCheckpoint(History storage self)\n internal\n view\n returns (\n bool exists,\n uint32 _blockNumber,\n uint224 _value\n )\n {\n uint256 pos = self._checkpoints.length;\n if (pos == 0) {\n return (false, 0, 0);\n } else {\n Checkpoint memory ckpt = _unsafeAccess(self._checkpoints, pos - 1);\n return (true, ckpt._blockNumber, ckpt._value);\n }\n }\n\n /**\n * @dev Returns the number of checkpoint.\n */\n function length(History storage self) internal view returns (uint256) {\n return self._checkpoints.length;\n }\n\n /**\n * @dev Pushes a (`key`, `value`) pair into an ordered list of checkpoints, either by inserting a new checkpoint,\n * or by updating the last one.\n */\n function _insert(\n Checkpoint[] storage self,\n uint32 key,\n uint224 value\n ) private returns (uint224, uint224) {\n uint256 pos = self.length;\n\n if (pos > 0) {\n // Copying to memory is important here.\n Checkpoint memory last = _unsafeAccess(self, pos - 1);\n\n // Checkpoints keys must be increasing.\n require(last._blockNumber <= key, \"Checkpoint: invalid key\");\n\n // Update or push new checkpoint\n if (last._blockNumber == key) {\n _unsafeAccess(self, pos - 1)._value = value;\n } else {\n self.push(Checkpoint({_blockNumber: key, _value: value}));\n }\n return (last._value, value);\n } else {\n self.push(Checkpoint({_blockNumber: key, _value: value}));\n return (0, value);\n }\n }\n\n /**\n * @dev Return the index of the oldest checkpoint whose key is greater than the search key, or `high` if there is none.\n * `low` and `high` define a section where to do the search, with inclusive `low` and exclusive `high`.\n *\n * WARNING: `high` should not be greater than the array's length.\n */\n function _upperBinaryLookup(\n Checkpoint[] storage self,\n uint32 key,\n uint256 low,\n uint256 high\n ) private view returns (uint256) {\n while (low < high) {\n uint256 mid = MathUpgradeable.average(low, high);\n if (_unsafeAccess(self, mid)._blockNumber > key) {\n high = mid;\n } else {\n low = mid + 1;\n }\n }\n return high;\n }\n\n /**\n * @dev Return the index of the oldest checkpoint whose key is greater or equal than the search key, or `high` if there is none.\n * `low` and `high` define a section where to do the search, with inclusive `low` and exclusive `high`.\n *\n * WARNING: `high` should not be greater than the array's length.\n */\n function _lowerBinaryLookup(\n Checkpoint[] storage self,\n uint32 key,\n uint256 low,\n uint256 high\n ) private view returns (uint256) {\n while (low < high) {\n uint256 mid = MathUpgradeable.average(low, high);\n if (_unsafeAccess(self, mid)._blockNumber < key) {\n low = mid + 1;\n } else {\n high = mid;\n }\n }\n return high;\n }\n\n function _unsafeAccess(Checkpoint[] storage self, uint256 pos) private pure returns (Checkpoint storage result) {\n assembly {\n mstore(0, self.slot)\n result.slot := add(keccak256(0, 0x20), pos)\n }\n }\n\n struct Trace224 {\n Checkpoint224[] _checkpoints;\n }\n\n struct Checkpoint224 {\n uint32 _key;\n uint224 _value;\n }\n\n /**\n * @dev Pushes a (`key`, `value`) pair into a Trace224 so that it is stored as the checkpoint.\n *\n * Returns previous value and new value.\n */\n function push(\n Trace224 storage self,\n uint32 key,\n uint224 value\n ) internal returns (uint224, uint224) {\n return _insert(self._checkpoints, key, value);\n }\n\n /**\n * @dev Returns the value in the oldest checkpoint with key greater or equal than the search key, or zero if there is none.\n */\n function lowerLookup(Trace224 storage self, uint32 key) internal view returns (uint224) {\n uint256 len = self._checkpoints.length;\n uint256 pos = _lowerBinaryLookup(self._checkpoints, key, 0, len);\n return pos == len ? 0 : _unsafeAccess(self._checkpoints, pos)._value;\n }\n\n /**\n * @dev Returns the value in the most recent checkpoint with key lower or equal than the search key.\n */\n function upperLookup(Trace224 storage self, uint32 key) internal view returns (uint224) {\n uint256 len = self._checkpoints.length;\n uint256 pos = _upperBinaryLookup(self._checkpoints, key, 0, len);\n return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;\n }\n\n /**\n * @dev Returns the value in the most recent checkpoint, or zero if there are no checkpoints.\n */\n function latest(Trace224 storage self) internal view returns (uint224) {\n uint256 pos = self._checkpoints.length;\n return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;\n }\n\n /**\n * @dev Returns whether there is a checkpoint in the structure (i.e. it is not empty), and if so the key and value\n * in the most recent checkpoint.\n */\n function latestCheckpoint(Trace224 storage self)\n internal\n view\n returns (\n bool exists,\n uint32 _key,\n uint224 _value\n )\n {\n uint256 pos = self._checkpoints.length;\n if (pos == 0) {\n return (false, 0, 0);\n } else {\n Checkpoint224 memory ckpt = _unsafeAccess(self._checkpoints, pos - 1);\n return (true, ckpt._key, ckpt._value);\n }\n }\n\n /**\n * @dev Returns the number of checkpoint.\n */\n function length(Trace224 storage self) internal view returns (uint256) {\n return self._checkpoints.length;\n }\n\n /**\n * @dev Pushes a (`key`, `value`) pair into an ordered list of checkpoints, either by inserting a new checkpoint,\n * or by updating the last one.\n */\n function _insert(\n Checkpoint224[] storage self,\n uint32 key,\n uint224 value\n ) private returns (uint224, uint224) {\n uint256 pos = self.length;\n\n if (pos > 0) {\n // Copying to memory is important here.\n Checkpoint224 memory last = _unsafeAccess(self, pos - 1);\n\n // Checkpoints keys must be increasing.\n require(last._key <= key, \"Checkpoint: invalid key\");\n\n // Update or push new checkpoint\n if (last._key == key) {\n _unsafeAccess(self, pos - 1)._value = value;\n } else {\n self.push(Checkpoint224({_key: key, _value: value}));\n }\n return (last._value, value);\n } else {\n self.push(Checkpoint224({_key: key, _value: value}));\n return (0, value);\n }\n }\n\n /**\n * @dev Return the index of the oldest checkpoint whose key is greater than the search key, or `high` if there is none.\n * `low` and `high` define a section where to do the search, with inclusive `low` and exclusive `high`.\n *\n * WARNING: `high` should not be greater than the array's length.\n */\n function _upperBinaryLookup(\n Checkpoint224[] storage self,\n uint32 key,\n uint256 low,\n uint256 high\n ) private view returns (uint256) {\n while (low < high) {\n uint256 mid = MathUpgradeable.average(low, high);\n if (_unsafeAccess(self, mid)._key > key) {\n high = mid;\n } else {\n low = mid + 1;\n }\n }\n return high;\n }\n\n /**\n * @dev Return the index of the oldest checkpoint whose key is greater or equal than the search key, or `high` if there is none.\n * `low` and `high` define a section where to do the search, with inclusive `low` and exclusive `high`.\n *\n * WARNING: `high` should not be greater than the array's length.\n */\n function _lowerBinaryLookup(\n Checkpoint224[] storage self,\n uint32 key,\n uint256 low,\n uint256 high\n ) private view returns (uint256) {\n while (low < high) {\n uint256 mid = MathUpgradeable.average(low, high);\n if (_unsafeAccess(self, mid)._key < key) {\n low = mid + 1;\n } else {\n high = mid;\n }\n }\n return high;\n }\n\n function _unsafeAccess(Checkpoint224[] storage self, uint256 pos)\n private\n pure\n returns (Checkpoint224 storage result)\n {\n assembly {\n mstore(0, self.slot)\n result.slot := add(keccak256(0, 0x20), pos)\n }\n }\n\n struct Trace160 {\n Checkpoint160[] _checkpoints;\n }\n\n struct Checkpoint160 {\n uint96 _key;\n uint160 _value;\n }\n\n /**\n * @dev Pushes a (`key`, `value`) pair into a Trace160 so that it is stored as the checkpoint.\n *\n * Returns previous value and new value.\n */\n function push(\n Trace160 storage self,\n uint96 key,\n uint160 value\n ) internal returns (uint160, uint160) {\n return _insert(self._checkpoints, key, value);\n }\n\n /**\n * @dev Returns the value in the oldest checkpoint with key greater or equal than the search key, or zero if there is none.\n */\n function lowerLookup(Trace160 storage self, uint96 key) internal view returns (uint160) {\n uint256 len = self._checkpoints.length;\n uint256 pos = _lowerBinaryLookup(self._checkpoints, key, 0, len);\n return pos == len ? 0 : _unsafeAccess(self._checkpoints, pos)._value;\n }\n\n /**\n * @dev Returns the value in the most recent checkpoint with key lower or equal than the search key.\n */\n function upperLookup(Trace160 storage self, uint96 key) internal view returns (uint160) {\n uint256 len = self._checkpoints.length;\n uint256 pos = _upperBinaryLookup(self._checkpoints, key, 0, len);\n return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;\n }\n\n /**\n * @dev Returns the value in the most recent checkpoint, or zero if there are no checkpoints.\n */\n function latest(Trace160 storage self) internal view returns (uint160) {\n uint256 pos = self._checkpoints.length;\n return pos == 0 ? 0 : _unsafeAccess(self._checkpoints, pos - 1)._value;\n }\n\n /**\n * @dev Returns whether there is a checkpoint in the structure (i.e. it is not empty), and if so the key and value\n * in the most recent checkpoint.\n */\n function latestCheckpoint(Trace160 storage self)\n internal\n view\n returns (\n bool exists,\n uint96 _key,\n uint160 _value\n )\n {\n uint256 pos = self._checkpoints.length;\n if (pos == 0) {\n return (false, 0, 0);\n } else {\n Checkpoint160 memory ckpt = _unsafeAccess(self._checkpoints, pos - 1);\n return (true, ckpt._key, ckpt._value);\n }\n }\n\n /**\n * @dev Returns the number of checkpoint.\n */\n function length(Trace160 storage self) internal view returns (uint256) {\n return self._checkpoints.length;\n }\n\n /**\n * @dev Pushes a (`key`, `value`) pair into an ordered list of checkpoints, either by inserting a new checkpoint,\n * or by updating the last one.\n */\n function _insert(\n Checkpoint160[] storage self,\n uint96 key,\n uint160 value\n ) private returns (uint160, uint160) {\n uint256 pos = self.length;\n\n if (pos > 0) {\n // Copying to memory is important here.\n Checkpoint160 memory last = _unsafeAccess(self, pos - 1);\n\n // Checkpoints keys must be increasing.\n require(last._key <= key, \"Checkpoint: invalid key\");\n\n // Update or push new checkpoint\n if (last._key == key) {\n _unsafeAccess(self, pos - 1)._value = value;\n } else {\n self.push(Checkpoint160({_key: key, _value: value}));\n }\n return (last._value, value);\n } else {\n self.push(Checkpoint160({_key: key, _value: value}));\n return (0, value);\n }\n }\n\n /**\n * @dev Return the index of the oldest checkpoint whose key is greater than the search key, or `high` if there is none.\n * `low` and `high` define a section where to do the search, with inclusive `low` and exclusive `high`.\n *\n * WARNING: `high` should not be greater than the array's length.\n */\n function _upperBinaryLookup(\n Checkpoint160[] storage self,\n uint96 key,\n uint256 low,\n uint256 high\n ) private view returns (uint256) {\n while (low < high) {\n uint256 mid = MathUpgradeable.average(low, high);\n if (_unsafeAccess(self, mid)._key > key) {\n high = mid;\n } else {\n low = mid + 1;\n }\n }\n return high;\n }\n\n /**\n * @dev Return the index of the oldest checkpoint whose key is greater or equal than the search key, or `high` if there is none.\n * `low` and `high` define a section where to do the search, with inclusive `low` and exclusive `high`.\n *\n * WARNING: `high` should not be greater than the array's length.\n */\n function _lowerBinaryLookup(\n Checkpoint160[] storage self,\n uint96 key,\n uint256 low,\n uint256 high\n ) private view returns (uint256) {\n while (low < high) {\n uint256 mid = MathUpgradeable.average(low, high);\n if (_unsafeAccess(self, mid)._key < key) {\n low = mid + 1;\n } else {\n high = mid;\n }\n }\n return high;\n }\n\n function _unsafeAccess(Checkpoint160[] storage self, uint256 pos)\n private\n pure\n returns (Checkpoint160 storage result)\n {\n assembly {\n mstore(0, self.slot)\n result.slot := add(keccak256(0, 0x20), pos)\n }\n }\n}\n" }, "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" }, "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title Counters\n * @author Matt Condon (@shrugs)\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\n *\n * Include with `using Counters for Counters.Counter;`\n */\nlibrary CountersUpgradeable {\n struct Counter {\n // This variable should never be directly accessed by users of the library: interactions must be restricted to\n // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\n // this feature: see https://github.com/ethereum/solidity/issues/4637\n uint256 _value; // default: 0\n }\n\n function current(Counter storage counter) internal view returns (uint256) {\n return counter._value;\n }\n\n function increment(Counter storage counter) internal {\n unchecked {\n counter._value += 1;\n }\n }\n\n function decrement(Counter storage counter) internal {\n uint256 value = counter._value;\n require(value > 0, \"Counter: decrement overflow\");\n unchecked {\n counter._value = value - 1;\n }\n }\n\n function reset(Counter storage counter) internal {\n counter._value = 0;\n }\n}\n" }, "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../StringsUpgradeable.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSAUpgradeable {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV // Deprecated in v4.8\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", StringsUpgradeable.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" }, "@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/EIP712.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSAUpgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * _Available since v3.4._\n *\n * @custom:storage-size 52\n */\nabstract contract EIP712Upgradeable is Initializable {\n /* solhint-disable var-name-mixedcase */\n bytes32 private _HASHED_NAME;\n bytes32 private _HASHED_VERSION;\n bytes32 private constant _TYPE_HASH = keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n\n /* solhint-enable var-name-mixedcase */\n\n /**\n * @dev Initializes the domain separator and parameter caches.\n *\n * The meaning of `name` and `version` is specified in\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\n *\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n * - `version`: the current major version of the signing domain.\n *\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n * contract upgrade].\n */\n function __EIP712_init(string memory name, string memory version) internal onlyInitializing {\n __EIP712_init_unchained(name, version);\n }\n\n function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing {\n bytes32 hashedName = keccak256(bytes(name));\n bytes32 hashedVersion = keccak256(bytes(version));\n _HASHED_NAME = hashedName;\n _HASHED_VERSION = hashedVersion;\n }\n\n /**\n * @dev Returns the domain separator for the current chain.\n */\n function _domainSeparatorV4() internal view returns (bytes32) {\n return _buildDomainSeparator(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash());\n }\n\n function _buildDomainSeparator(\n bytes32 typeHash,\n bytes32 nameHash,\n bytes32 versionHash\n ) private view returns (bytes32) {\n return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));\n }\n\n /**\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n * function returns the hash of the fully encoded EIP712 message for this domain.\n *\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n *\n * ```solidity\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n * keccak256(\"Mail(address to,string contents)\"),\n * mailTo,\n * keccak256(bytes(mailContents))\n * )));\n * address signer = ECDSA.recover(digest, signature);\n * ```\n */\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n return ECDSAUpgradeable.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n\n /**\n * @dev The hash of the name parameter for the EIP712 domain.\n *\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n * are a concern.\n */\n function _EIP712NameHash() internal virtual view returns (bytes32) {\n return _HASHED_NAME;\n }\n\n /**\n * @dev The hash of the version parameter for the EIP712 domain.\n *\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n * are a concern.\n */\n function _EIP712VersionHash() internal virtual view returns (bytes32) {\n return _HASHED_VERSION;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" }, "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\n function __ERC165_init() internal onlyInitializing {\n }\n\n function __ERC165_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165Upgradeable).interfaceId;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" }, "@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165Upgradeable {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" }, "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary MathUpgradeable {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" }, "@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\n * checks.\n *\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\n * easily result in undesired exploitation or bugs, since developers usually\n * assume that overflows raise errors. `SafeCast` restores this intuition by\n * reverting the transaction when such an operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n *\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\n * all math on `uint256` and `int256` and then downcasting.\n */\nlibrary SafeCastUpgradeable {\n /**\n * @dev Returns the downcasted uint248 from uint256, reverting on\n * overflow (when the input is greater than largest uint248).\n *\n * Counterpart to Solidity's `uint248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n *\n * _Available since v4.7._\n */\n function toUint248(uint256 value) internal pure returns (uint248) {\n require(value <= type(uint248).max, \"SafeCast: value doesn't fit in 248 bits\");\n return uint248(value);\n }\n\n /**\n * @dev Returns the downcasted uint240 from uint256, reverting on\n * overflow (when the input is greater than largest uint240).\n *\n * Counterpart to Solidity's `uint240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n *\n * _Available since v4.7._\n */\n function toUint240(uint256 value) internal pure returns (uint240) {\n require(value <= type(uint240).max, \"SafeCast: value doesn't fit in 240 bits\");\n return uint240(value);\n }\n\n /**\n * @dev Returns the downcasted uint232 from uint256, reverting on\n * overflow (when the input is greater than largest uint232).\n *\n * Counterpart to Solidity's `uint232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n *\n * _Available since v4.7._\n */\n function toUint232(uint256 value) internal pure returns (uint232) {\n require(value <= type(uint232).max, \"SafeCast: value doesn't fit in 232 bits\");\n return uint232(value);\n }\n\n /**\n * @dev Returns the downcasted uint224 from uint256, reverting on\n * overflow (when the input is greater than largest uint224).\n *\n * Counterpart to Solidity's `uint224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n *\n * _Available since v4.2._\n */\n function toUint224(uint256 value) internal pure returns (uint224) {\n require(value <= type(uint224).max, \"SafeCast: value doesn't fit in 224 bits\");\n return uint224(value);\n }\n\n /**\n * @dev Returns the downcasted uint216 from uint256, reverting on\n * overflow (when the input is greater than largest uint216).\n *\n * Counterpart to Solidity's `uint216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n *\n * _Available since v4.7._\n */\n function toUint216(uint256 value) internal pure returns (uint216) {\n require(value <= type(uint216).max, \"SafeCast: value doesn't fit in 216 bits\");\n return uint216(value);\n }\n\n /**\n * @dev Returns the downcasted uint208 from uint256, reverting on\n * overflow (when the input is greater than largest uint208).\n *\n * Counterpart to Solidity's `uint208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n *\n * _Available since v4.7._\n */\n function toUint208(uint256 value) internal pure returns (uint208) {\n require(value <= type(uint208).max, \"SafeCast: value doesn't fit in 208 bits\");\n return uint208(value);\n }\n\n /**\n * @dev Returns the downcasted uint200 from uint256, reverting on\n * overflow (when the input is greater than largest uint200).\n *\n * Counterpart to Solidity's `uint200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n *\n * _Available since v4.7._\n */\n function toUint200(uint256 value) internal pure returns (uint200) {\n require(value <= type(uint200).max, \"SafeCast: value doesn't fit in 200 bits\");\n return uint200(value);\n }\n\n /**\n * @dev Returns the downcasted uint192 from uint256, reverting on\n * overflow (when the input is greater than largest uint192).\n *\n * Counterpart to Solidity's `uint192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n *\n * _Available since v4.7._\n */\n function toUint192(uint256 value) internal pure returns (uint192) {\n require(value <= type(uint192).max, \"SafeCast: value doesn't fit in 192 bits\");\n return uint192(value);\n }\n\n /**\n * @dev Returns the downcasted uint184 from uint256, reverting on\n * overflow (when the input is greater than largest uint184).\n *\n * Counterpart to Solidity's `uint184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n *\n * _Available since v4.7._\n */\n function toUint184(uint256 value) internal pure returns (uint184) {\n require(value <= type(uint184).max, \"SafeCast: value doesn't fit in 184 bits\");\n return uint184(value);\n }\n\n /**\n * @dev Returns the downcasted uint176 from uint256, reverting on\n * overflow (when the input is greater than largest uint176).\n *\n * Counterpart to Solidity's `uint176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n *\n * _Available since v4.7._\n */\n function toUint176(uint256 value) internal pure returns (uint176) {\n require(value <= type(uint176).max, \"SafeCast: value doesn't fit in 176 bits\");\n return uint176(value);\n }\n\n /**\n * @dev Returns the downcasted uint168 from uint256, reverting on\n * overflow (when the input is greater than largest uint168).\n *\n * Counterpart to Solidity's `uint168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n *\n * _Available since v4.7._\n */\n function toUint168(uint256 value) internal pure returns (uint168) {\n require(value <= type(uint168).max, \"SafeCast: value doesn't fit in 168 bits\");\n return uint168(value);\n }\n\n /**\n * @dev Returns the downcasted uint160 from uint256, reverting on\n * overflow (when the input is greater than largest uint160).\n *\n * Counterpart to Solidity's `uint160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n *\n * _Available since v4.7._\n */\n function toUint160(uint256 value) internal pure returns (uint160) {\n require(value <= type(uint160).max, \"SafeCast: value doesn't fit in 160 bits\");\n return uint160(value);\n }\n\n /**\n * @dev Returns the downcasted uint152 from uint256, reverting on\n * overflow (when the input is greater than largest uint152).\n *\n * Counterpart to Solidity's `uint152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n *\n * _Available since v4.7._\n */\n function toUint152(uint256 value) internal pure returns (uint152) {\n require(value <= type(uint152).max, \"SafeCast: value doesn't fit in 152 bits\");\n return uint152(value);\n }\n\n /**\n * @dev Returns the downcasted uint144 from uint256, reverting on\n * overflow (when the input is greater than largest uint144).\n *\n * Counterpart to Solidity's `uint144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n *\n * _Available since v4.7._\n */\n function toUint144(uint256 value) internal pure returns (uint144) {\n require(value <= type(uint144).max, \"SafeCast: value doesn't fit in 144 bits\");\n return uint144(value);\n }\n\n /**\n * @dev Returns the downcasted uint136 from uint256, reverting on\n * overflow (when the input is greater than largest uint136).\n *\n * Counterpart to Solidity's `uint136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n *\n * _Available since v4.7._\n */\n function toUint136(uint256 value) internal pure returns (uint136) {\n require(value <= type(uint136).max, \"SafeCast: value doesn't fit in 136 bits\");\n return uint136(value);\n }\n\n /**\n * @dev Returns the downcasted uint128 from uint256, reverting on\n * overflow (when the input is greater than largest uint128).\n *\n * Counterpart to Solidity's `uint128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n *\n * _Available since v2.5._\n */\n function toUint128(uint256 value) internal pure returns (uint128) {\n require(value <= type(uint128).max, \"SafeCast: value doesn't fit in 128 bits\");\n return uint128(value);\n }\n\n /**\n * @dev Returns the downcasted uint120 from uint256, reverting on\n * overflow (when the input is greater than largest uint120).\n *\n * Counterpart to Solidity's `uint120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n *\n * _Available since v4.7._\n */\n function toUint120(uint256 value) internal pure returns (uint120) {\n require(value <= type(uint120).max, \"SafeCast: value doesn't fit in 120 bits\");\n return uint120(value);\n }\n\n /**\n * @dev Returns the downcasted uint112 from uint256, reverting on\n * overflow (when the input is greater than largest uint112).\n *\n * Counterpart to Solidity's `uint112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n *\n * _Available since v4.7._\n */\n function toUint112(uint256 value) internal pure returns (uint112) {\n require(value <= type(uint112).max, \"SafeCast: value doesn't fit in 112 bits\");\n return uint112(value);\n }\n\n /**\n * @dev Returns the downcasted uint104 from uint256, reverting on\n * overflow (when the input is greater than largest uint104).\n *\n * Counterpart to Solidity's `uint104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n *\n * _Available since v4.7._\n */\n function toUint104(uint256 value) internal pure returns (uint104) {\n require(value <= type(uint104).max, \"SafeCast: value doesn't fit in 104 bits\");\n return uint104(value);\n }\n\n /**\n * @dev Returns the downcasted uint96 from uint256, reverting on\n * overflow (when the input is greater than largest uint96).\n *\n * Counterpart to Solidity's `uint96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n *\n * _Available since v4.2._\n */\n function toUint96(uint256 value) internal pure returns (uint96) {\n require(value <= type(uint96).max, \"SafeCast: value doesn't fit in 96 bits\");\n return uint96(value);\n }\n\n /**\n * @dev Returns the downcasted uint88 from uint256, reverting on\n * overflow (when the input is greater than largest uint88).\n *\n * Counterpart to Solidity's `uint88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n *\n * _Available since v4.7._\n */\n function toUint88(uint256 value) internal pure returns (uint88) {\n require(value <= type(uint88).max, \"SafeCast: value doesn't fit in 88 bits\");\n return uint88(value);\n }\n\n /**\n * @dev Returns the downcasted uint80 from uint256, reverting on\n * overflow (when the input is greater than largest uint80).\n *\n * Counterpart to Solidity's `uint80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n *\n * _Available since v4.7._\n */\n function toUint80(uint256 value) internal pure returns (uint80) {\n require(value <= type(uint80).max, \"SafeCast: value doesn't fit in 80 bits\");\n return uint80(value);\n }\n\n /**\n * @dev Returns the downcasted uint72 from uint256, reverting on\n * overflow (when the input is greater than largest uint72).\n *\n * Counterpart to Solidity's `uint72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n *\n * _Available since v4.7._\n */\n function toUint72(uint256 value) internal pure returns (uint72) {\n require(value <= type(uint72).max, \"SafeCast: value doesn't fit in 72 bits\");\n return uint72(value);\n }\n\n /**\n * @dev Returns the downcasted uint64 from uint256, reverting on\n * overflow (when the input is greater than largest uint64).\n *\n * Counterpart to Solidity's `uint64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n *\n * _Available since v2.5._\n */\n function toUint64(uint256 value) internal pure returns (uint64) {\n require(value <= type(uint64).max, \"SafeCast: value doesn't fit in 64 bits\");\n return uint64(value);\n }\n\n /**\n * @dev Returns the downcasted uint56 from uint256, reverting on\n * overflow (when the input is greater than largest uint56).\n *\n * Counterpart to Solidity's `uint56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n *\n * _Available since v4.7._\n */\n function toUint56(uint256 value) internal pure returns (uint56) {\n require(value <= type(uint56).max, \"SafeCast: value doesn't fit in 56 bits\");\n return uint56(value);\n }\n\n /**\n * @dev Returns the downcasted uint48 from uint256, reverting on\n * overflow (when the input is greater than largest uint48).\n *\n * Counterpart to Solidity's `uint48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n *\n * _Available since v4.7._\n */\n function toUint48(uint256 value) internal pure returns (uint48) {\n require(value <= type(uint48).max, \"SafeCast: value doesn't fit in 48 bits\");\n return uint48(value);\n }\n\n /**\n * @dev Returns the downcasted uint40 from uint256, reverting on\n * overflow (when the input is greater than largest uint40).\n *\n * Counterpart to Solidity's `uint40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n *\n * _Available since v4.7._\n */\n function toUint40(uint256 value) internal pure returns (uint40) {\n require(value <= type(uint40).max, \"SafeCast: value doesn't fit in 40 bits\");\n return uint40(value);\n }\n\n /**\n * @dev Returns the downcasted uint32 from uint256, reverting on\n * overflow (when the input is greater than largest uint32).\n *\n * Counterpart to Solidity's `uint32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n *\n * _Available since v2.5._\n */\n function toUint32(uint256 value) internal pure returns (uint32) {\n require(value <= type(uint32).max, \"SafeCast: value doesn't fit in 32 bits\");\n return uint32(value);\n }\n\n /**\n * @dev Returns the downcasted uint24 from uint256, reverting on\n * overflow (when the input is greater than largest uint24).\n *\n * Counterpart to Solidity's `uint24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n *\n * _Available since v4.7._\n */\n function toUint24(uint256 value) internal pure returns (uint24) {\n require(value <= type(uint24).max, \"SafeCast: value doesn't fit in 24 bits\");\n return uint24(value);\n }\n\n /**\n * @dev Returns the downcasted uint16 from uint256, reverting on\n * overflow (when the input is greater than largest uint16).\n *\n * Counterpart to Solidity's `uint16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n *\n * _Available since v2.5._\n */\n function toUint16(uint256 value) internal pure returns (uint16) {\n require(value <= type(uint16).max, \"SafeCast: value doesn't fit in 16 bits\");\n return uint16(value);\n }\n\n /**\n * @dev Returns the downcasted uint8 from uint256, reverting on\n * overflow (when the input is greater than largest uint8).\n *\n * Counterpart to Solidity's `uint8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n *\n * _Available since v2.5._\n */\n function toUint8(uint256 value) internal pure returns (uint8) {\n require(value <= type(uint8).max, \"SafeCast: value doesn't fit in 8 bits\");\n return uint8(value);\n }\n\n /**\n * @dev Converts a signed int256 into an unsigned uint256.\n *\n * Requirements:\n *\n * - input must be greater than or equal to 0.\n *\n * _Available since v3.0._\n */\n function toUint256(int256 value) internal pure returns (uint256) {\n require(value >= 0, \"SafeCast: value must be positive\");\n return uint256(value);\n }\n\n /**\n * @dev Returns the downcasted int248 from int256, reverting on\n * overflow (when the input is less than smallest int248 or\n * greater than largest int248).\n *\n * Counterpart to Solidity's `int248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n *\n * _Available since v4.7._\n */\n function toInt248(int256 value) internal pure returns (int248 downcasted) {\n downcasted = int248(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 248 bits\");\n }\n\n /**\n * @dev Returns the downcasted int240 from int256, reverting on\n * overflow (when the input is less than smallest int240 or\n * greater than largest int240).\n *\n * Counterpart to Solidity's `int240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n *\n * _Available since v4.7._\n */\n function toInt240(int256 value) internal pure returns (int240 downcasted) {\n downcasted = int240(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 240 bits\");\n }\n\n /**\n * @dev Returns the downcasted int232 from int256, reverting on\n * overflow (when the input is less than smallest int232 or\n * greater than largest int232).\n *\n * Counterpart to Solidity's `int232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n *\n * _Available since v4.7._\n */\n function toInt232(int256 value) internal pure returns (int232 downcasted) {\n downcasted = int232(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 232 bits\");\n }\n\n /**\n * @dev Returns the downcasted int224 from int256, reverting on\n * overflow (when the input is less than smallest int224 or\n * greater than largest int224).\n *\n * Counterpart to Solidity's `int224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n *\n * _Available since v4.7._\n */\n function toInt224(int256 value) internal pure returns (int224 downcasted) {\n downcasted = int224(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 224 bits\");\n }\n\n /**\n * @dev Returns the downcasted int216 from int256, reverting on\n * overflow (when the input is less than smallest int216 or\n * greater than largest int216).\n *\n * Counterpart to Solidity's `int216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n *\n * _Available since v4.7._\n */\n function toInt216(int256 value) internal pure returns (int216 downcasted) {\n downcasted = int216(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 216 bits\");\n }\n\n /**\n * @dev Returns the downcasted int208 from int256, reverting on\n * overflow (when the input is less than smallest int208 or\n * greater than largest int208).\n *\n * Counterpart to Solidity's `int208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n *\n * _Available since v4.7._\n */\n function toInt208(int256 value) internal pure returns (int208 downcasted) {\n downcasted = int208(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 208 bits\");\n }\n\n /**\n * @dev Returns the downcasted int200 from int256, reverting on\n * overflow (when the input is less than smallest int200 or\n * greater than largest int200).\n *\n * Counterpart to Solidity's `int200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n *\n * _Available since v4.7._\n */\n function toInt200(int256 value) internal pure returns (int200 downcasted) {\n downcasted = int200(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 200 bits\");\n }\n\n /**\n * @dev Returns the downcasted int192 from int256, reverting on\n * overflow (when the input is less than smallest int192 or\n * greater than largest int192).\n *\n * Counterpart to Solidity's `int192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n *\n * _Available since v4.7._\n */\n function toInt192(int256 value) internal pure returns (int192 downcasted) {\n downcasted = int192(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 192 bits\");\n }\n\n /**\n * @dev Returns the downcasted int184 from int256, reverting on\n * overflow (when the input is less than smallest int184 or\n * greater than largest int184).\n *\n * Counterpart to Solidity's `int184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n *\n * _Available since v4.7._\n */\n function toInt184(int256 value) internal pure returns (int184 downcasted) {\n downcasted = int184(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 184 bits\");\n }\n\n /**\n * @dev Returns the downcasted int176 from int256, reverting on\n * overflow (when the input is less than smallest int176 or\n * greater than largest int176).\n *\n * Counterpart to Solidity's `int176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n *\n * _Available since v4.7._\n */\n function toInt176(int256 value) internal pure returns (int176 downcasted) {\n downcasted = int176(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 176 bits\");\n }\n\n /**\n * @dev Returns the downcasted int168 from int256, reverting on\n * overflow (when the input is less than smallest int168 or\n * greater than largest int168).\n *\n * Counterpart to Solidity's `int168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n *\n * _Available since v4.7._\n */\n function toInt168(int256 value) internal pure returns (int168 downcasted) {\n downcasted = int168(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 168 bits\");\n }\n\n /**\n * @dev Returns the downcasted int160 from int256, reverting on\n * overflow (when the input is less than smallest int160 or\n * greater than largest int160).\n *\n * Counterpart to Solidity's `int160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n *\n * _Available since v4.7._\n */\n function toInt160(int256 value) internal pure returns (int160 downcasted) {\n downcasted = int160(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 160 bits\");\n }\n\n /**\n * @dev Returns the downcasted int152 from int256, reverting on\n * overflow (when the input is less than smallest int152 or\n * greater than largest int152).\n *\n * Counterpart to Solidity's `int152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n *\n * _Available since v4.7._\n */\n function toInt152(int256 value) internal pure returns (int152 downcasted) {\n downcasted = int152(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 152 bits\");\n }\n\n /**\n * @dev Returns the downcasted int144 from int256, reverting on\n * overflow (when the input is less than smallest int144 or\n * greater than largest int144).\n *\n * Counterpart to Solidity's `int144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n *\n * _Available since v4.7._\n */\n function toInt144(int256 value) internal pure returns (int144 downcasted) {\n downcasted = int144(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 144 bits\");\n }\n\n /**\n * @dev Returns the downcasted int136 from int256, reverting on\n * overflow (when the input is less than smallest int136 or\n * greater than largest int136).\n *\n * Counterpart to Solidity's `int136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n *\n * _Available since v4.7._\n */\n function toInt136(int256 value) internal pure returns (int136 downcasted) {\n downcasted = int136(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 136 bits\");\n }\n\n /**\n * @dev Returns the downcasted int128 from int256, reverting on\n * overflow (when the input is less than smallest int128 or\n * greater than largest int128).\n *\n * Counterpart to Solidity's `int128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n *\n * _Available since v3.1._\n */\n function toInt128(int256 value) internal pure returns (int128 downcasted) {\n downcasted = int128(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 128 bits\");\n }\n\n /**\n * @dev Returns the downcasted int120 from int256, reverting on\n * overflow (when the input is less than smallest int120 or\n * greater than largest int120).\n *\n * Counterpart to Solidity's `int120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n *\n * _Available since v4.7._\n */\n function toInt120(int256 value) internal pure returns (int120 downcasted) {\n downcasted = int120(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 120 bits\");\n }\n\n /**\n * @dev Returns the downcasted int112 from int256, reverting on\n * overflow (when the input is less than smallest int112 or\n * greater than largest int112).\n *\n * Counterpart to Solidity's `int112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n *\n * _Available since v4.7._\n */\n function toInt112(int256 value) internal pure returns (int112 downcasted) {\n downcasted = int112(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 112 bits\");\n }\n\n /**\n * @dev Returns the downcasted int104 from int256, reverting on\n * overflow (when the input is less than smallest int104 or\n * greater than largest int104).\n *\n * Counterpart to Solidity's `int104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n *\n * _Available since v4.7._\n */\n function toInt104(int256 value) internal pure returns (int104 downcasted) {\n downcasted = int104(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 104 bits\");\n }\n\n /**\n * @dev Returns the downcasted int96 from int256, reverting on\n * overflow (when the input is less than smallest int96 or\n * greater than largest int96).\n *\n * Counterpart to Solidity's `int96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n *\n * _Available since v4.7._\n */\n function toInt96(int256 value) internal pure returns (int96 downcasted) {\n downcasted = int96(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 96 bits\");\n }\n\n /**\n * @dev Returns the downcasted int88 from int256, reverting on\n * overflow (when the input is less than smallest int88 or\n * greater than largest int88).\n *\n * Counterpart to Solidity's `int88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n *\n * _Available since v4.7._\n */\n function toInt88(int256 value) internal pure returns (int88 downcasted) {\n downcasted = int88(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 88 bits\");\n }\n\n /**\n * @dev Returns the downcasted int80 from int256, reverting on\n * overflow (when the input is less than smallest int80 or\n * greater than largest int80).\n *\n * Counterpart to Solidity's `int80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n *\n * _Available since v4.7._\n */\n function toInt80(int256 value) internal pure returns (int80 downcasted) {\n downcasted = int80(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 80 bits\");\n }\n\n /**\n * @dev Returns the downcasted int72 from int256, reverting on\n * overflow (when the input is less than smallest int72 or\n * greater than largest int72).\n *\n * Counterpart to Solidity's `int72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n *\n * _Available since v4.7._\n */\n function toInt72(int256 value) internal pure returns (int72 downcasted) {\n downcasted = int72(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 72 bits\");\n }\n\n /**\n * @dev Returns the downcasted int64 from int256, reverting on\n * overflow (when the input is less than smallest int64 or\n * greater than largest int64).\n *\n * Counterpart to Solidity's `int64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n *\n * _Available since v3.1._\n */\n function toInt64(int256 value) internal pure returns (int64 downcasted) {\n downcasted = int64(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 64 bits\");\n }\n\n /**\n * @dev Returns the downcasted int56 from int256, reverting on\n * overflow (when the input is less than smallest int56 or\n * greater than largest int56).\n *\n * Counterpart to Solidity's `int56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n *\n * _Available since v4.7._\n */\n function toInt56(int256 value) internal pure returns (int56 downcasted) {\n downcasted = int56(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 56 bits\");\n }\n\n /**\n * @dev Returns the downcasted int48 from int256, reverting on\n * overflow (when the input is less than smallest int48 or\n * greater than largest int48).\n *\n * Counterpart to Solidity's `int48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n *\n * _Available since v4.7._\n */\n function toInt48(int256 value) internal pure returns (int48 downcasted) {\n downcasted = int48(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 48 bits\");\n }\n\n /**\n * @dev Returns the downcasted int40 from int256, reverting on\n * overflow (when the input is less than smallest int40 or\n * greater than largest int40).\n *\n * Counterpart to Solidity's `int40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n *\n * _Available since v4.7._\n */\n function toInt40(int256 value) internal pure returns (int40 downcasted) {\n downcasted = int40(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 40 bits\");\n }\n\n /**\n * @dev Returns the downcasted int32 from int256, reverting on\n * overflow (when the input is less than smallest int32 or\n * greater than largest int32).\n *\n * Counterpart to Solidity's `int32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n *\n * _Available since v3.1._\n */\n function toInt32(int256 value) internal pure returns (int32 downcasted) {\n downcasted = int32(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 32 bits\");\n }\n\n /**\n * @dev Returns the downcasted int24 from int256, reverting on\n * overflow (when the input is less than smallest int24 or\n * greater than largest int24).\n *\n * Counterpart to Solidity's `int24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n *\n * _Available since v4.7._\n */\n function toInt24(int256 value) internal pure returns (int24 downcasted) {\n downcasted = int24(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 24 bits\");\n }\n\n /**\n * @dev Returns the downcasted int16 from int256, reverting on\n * overflow (when the input is less than smallest int16 or\n * greater than largest int16).\n *\n * Counterpart to Solidity's `int16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n *\n * _Available since v3.1._\n */\n function toInt16(int256 value) internal pure returns (int16 downcasted) {\n downcasted = int16(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 16 bits\");\n }\n\n /**\n * @dev Returns the downcasted int8 from int256, reverting on\n * overflow (when the input is less than smallest int8 or\n * greater than largest int8).\n *\n * Counterpart to Solidity's `int8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n *\n * _Available since v3.1._\n */\n function toInt8(int256 value) internal pure returns (int8 downcasted) {\n downcasted = int8(value);\n require(downcasted == value, \"SafeCast: value doesn't fit in 8 bits\");\n }\n\n /**\n * @dev Converts an unsigned uint256 into a signed int256.\n *\n * Requirements:\n *\n * - input must be less than or equal to maxInt256.\n *\n * _Available since v3.0._\n */\n function toInt256(uint256 value) internal pure returns (int256) {\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\n require(value <= uint256(type(int256).max), \"SafeCast: value doesn't fit in an int256\");\n return int256(value);\n }\n}\n" }, "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = MathUpgradeable.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, MathUpgradeable.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" }, "@openzeppelin/contracts/governance/utils/IVotes.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (governance/utils/IVotes.sol)\npragma solidity ^0.8.0;\n\n/**\n * @dev Common interface for {ERC20Votes}, {ERC721Votes}, and other {Votes}-enabled contracts.\n *\n * _Available since v4.5._\n */\ninterface IVotes {\n /**\n * @dev Emitted when an account changes their delegate.\n */\n event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);\n\n /**\n * @dev Emitted when a token transfer or delegate change results in changes to a delegate's number of votes.\n */\n event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);\n\n /**\n * @dev Returns the current amount of votes that `account` has.\n */\n function getVotes(address account) external view returns (uint256);\n\n /**\n * @dev Returns the amount of votes that `account` had at the end of a past block (`blockNumber`).\n */\n function getPastVotes(address account, uint256 blockNumber) external view returns (uint256);\n\n /**\n * @dev Returns the total supply of votes available at the end of a past block (`blockNumber`).\n *\n * NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes.\n * Votes that have not been delegated are still part of total supply, even though they would not participate in a\n * vote.\n */\n function getPastTotalSupply(uint256 blockNumber) external view returns (uint256);\n\n /**\n * @dev Returns the delegate that `account` has chosen.\n */\n function delegates(address account) external view returns (address);\n\n /**\n * @dev Delegates votes from the sender to `delegatee`.\n */\n function delegate(address delegatee) external;\n\n /**\n * @dev Delegates votes from signer to `delegatee`.\n */\n function delegateBySig(\n address delegatee,\n uint256 nonce,\n uint256 expiry,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n}\n" }, "@openzeppelin/contracts/proxy/Proxy.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\n * be specified by overriding the virtual {_implementation} function.\n *\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\n * different contract through the {_delegate} function.\n *\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\n */\nabstract contract Proxy {\n /**\n * @dev Delegates the current call to `implementation`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _delegate(address implementation) internal virtual {\n assembly {\n // Copy msg.data. We take full control of memory in this inline assembly\n // block because it will not return to Solidity code. We overwrite the\n // Solidity scratch pad at memory position 0.\n calldatacopy(0, 0, calldatasize())\n\n // Call the implementation.\n // out and outsize are 0 because we don't know the size yet.\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n // Copy the returned data.\n returndatacopy(0, 0, returndatasize())\n\n switch result\n // delegatecall returns 0 on error.\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n /**\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\n * and {_fallback} should delegate.\n */\n function _implementation() internal view virtual returns (address);\n\n /**\n * @dev Delegates the current call to the address returned by `_implementation()`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _fallback() internal virtual {\n _beforeFallback();\n _delegate(_implementation());\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n * function in the contract matches the call data.\n */\n fallback() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\n * is empty.\n */\n receive() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\n * call, or as part of the Solidity `fallback` or `receive` functions.\n *\n * If overridden should call `super._beforeFallback()`.\n */\n function _beforeFallback() internal virtual {}\n}\n" }, "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC1155.sol\";\n\n/**\n * @dev Interface of the optional ERC1155MetadataExtension interface, as defined\n * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155MetadataURI is IERC1155 {\n /**\n * @dev Returns the URI for token type `id`.\n *\n * If the `\\{id\\}` substring is present in the URI, it must be replaced by\n * clients with the actual token type ID.\n */\n function uri(uint256 id) external view returns (string memory);\n}\n" }, "@openzeppelin/contracts/token/ERC1155/IERC1155.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155 is IERC165 {\n /**\n * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n */\n event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n /**\n * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n * transfers.\n */\n event TransferBatch(\n address indexed operator,\n address indexed from,\n address indexed to,\n uint256[] ids,\n uint256[] values\n );\n\n /**\n * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n * `approved`.\n */\n event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n /**\n * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n *\n * If an {URI} event was emitted for `id`, the standard\n * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n * returned by {IERC1155MetadataURI-uri}.\n */\n event URI(string value, uint256 indexed id);\n\n /**\n * @dev Returns the amount of tokens of token type `id` owned by `account`.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function balanceOf(address account, uint256 id) external view returns (uint256);\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n *\n * Requirements:\n *\n * - `accounts` and `ids` must have the same length.\n */\n function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n *\n * Emits an {ApprovalForAll} event.\n *\n * Requirements:\n *\n * - `operator` cannot be the caller.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n *\n * See {setApprovalForAll}.\n */\n function isApprovedForAll(address account, address operator) external view returns (bool);\n\n /**\n * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n *\n * Emits a {TransferSingle} event.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n * - `from` must have a balance of tokens of type `id` of at least `amount`.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n * acceptance magic value.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes calldata data\n ) external;\n\n /**\n * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n *\n * Emits a {TransferBatch} event.\n *\n * Requirements:\n *\n * - `ids` and `amounts` must have the same length.\n * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n * acceptance magic value.\n */\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] calldata ids,\n uint256[] calldata amounts,\n bytes calldata data\n ) external;\n}\n" }, "@openzeppelin/contracts/token/ERC20/IERC20.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" }, "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" }, "@openzeppelin/contracts/token/ERC721/IERC721.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" }, "@openzeppelin/contracts/utils/introspection/IERC165.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" }, "contracts/beacon/N2MERC1155Upgradeable.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * ----------------------------------------------------------------------------- */\n\n// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"./N2MUpgradeable.sol\";\n\ncontract N2MERC1155Upgradeable is N2MUpgradeable {\n constructor(address factoryAddress) N2MUpgradeable(factoryAddress) {}\n\n function _implementation() internal view override returns (address) {\n return IN2MBeaconFactory(FACTORY_ADDRESS).getERC1155Implementation();\n }\n}\n" }, "contracts/beacon/N2MERC721Upgradeable.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"./N2MUpgradeable.sol\";\n\ncontract N2MERC721Upgradeable is N2MUpgradeable {\n constructor(address factoryAddress) N2MUpgradeable(factoryAddress) {}\n\n function _implementation() internal view override returns (address) {\n return IN2MBeaconFactory(FACTORY_ADDRESS).getERC721Implementation();\n }\n}\n" }, "contracts/beacon/N2MUpgradeable.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"@nfts2me/contracts/important/README.sol\";\nimport \"@nfts2me/contracts/interfaces/IN2MBeaconFactory.sol\";\nimport \"@openzeppelin/contracts/proxy/Proxy.sol\";\nimport \"../N2MVersion.sol\";\n\nabstract contract N2MUpgradeable is Proxy {\n address internal immutable FACTORY_ADDRESS;\n\n constructor(address factoryAddress) {\n FACTORY_ADDRESS = factoryAddress;\n }\n\n function n2mVersions() external view returns (uint256 implementationVersion, uint256 beaconVersion) {\n implementationVersion = N2MVersion(address(this)).n2mVersion();\n beaconVersion = 1000;\n }\n}\n" }, "contracts/interfaces/IN2M_ERCBase.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol\";\nimport \"./IN2M_ERCStorage.sol\";\n\ninterface IN2M_ERCBase is IERC2981Upgradeable, IN2M_ERCStorage {\n /// @notice To be called to create the collection. Can only be called once.\n function initialize\n (\n string memory tokenName,\n string memory tokenSymbol,\n uint256 iMintPrice,\n bytes32 baseURICIDHash,\n bytes32 placeholderImageCIDHash,\n RevenueAddress[] calldata revenueAddresses,\n address iErc20PaymentAddress,\n uint32 iTotalSupply,\n uint16 iRoyaltyFee,\n bool soulboundCollection,\n MintingType iMintingType\n ) external payable;\n\n /// @notice A descriptive name for a collection of NFTs in this contract\n function name() external view returns (string memory);\n\n /// @notice An abbreviated name for NFTs in this contract\n /// @return the collection symbol\n function symbol() external view returns (string memory);\n\n /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.\n /// @dev Throws if `_tokenId` is not a valid NFT. URIs are defined in RFC\n /// 3986. The URI may point to a JSON file that conforms to the \"ERC721\n /// Metadata JSON Schema\".\n function tokenURI(uint256 tokenId) external view returns (string memory);\n\n /// @notice Mints one NFT to the caller (msg.sender). Requires `minting type` to be `sequential` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n function mint() external payable;\n\n /// @notice Mints `amount` NFTs to the caller (msg.sender). Requires `minting type` to be `sequential` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n /// @param amount The number of NFTs to mint\n function mint(uint256 amount) external payable;\n\n /// @notice Mints `amount` NFTs to the caller (msg.sender) with a given `affiliate`. Requires `minting type` to be `sequential` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n /// @param amount The number of NFTs to mint\n /// @param affiliate The affiliate address\n function mint(uint256 amount, address affiliate) external payable;\n\n /// @notice Mints `amount` NFTs to `to` address. Requires `minting type` to be `sequential` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n /// @param to The address of the NFTs receiver\n /// @param amount The number of NFTs to mint \n function mintTo(address to, uint256 amount) external payable;\n\n /// @notice Mints `amount` NFTs to `to` address with a given `affiliate`. Requires `minting type` to be `sequential` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n /// @param to The address of the NFTs receiver\n /// @param amount The number of NFTs to mint \n /// @param affiliate The affiliate address\n function mintTo(address to, uint256 amount, address affiliate) external payable;\n\n /// @notice Two phases on-chain random minting. Mints `amount` NFTs tickets to `to` address. Requires `minting type` to be `random` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment). Once minted, those tickets must be redeemed for an actual token calling `redeemRandom()`.\n /// @param to The address of the NFTs receiver\n /// @param amount The number of NFTs to mint \n function mintRandomTo(address to, uint256 amount) external payable; \n\n /// @notice Two phases on-chain random minting. Mints `amount` NFTs tickets to `to` address with a given `affiliate`. Requires `minting type` to be `random` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment). Once minted, those tickets must be redeemed for an actual token calling `redeemRandom()`.\n /// @param to The address of the NFTs receiver\n /// @param amount The number of NFTs to mint \n /// @param affiliate The affiliate address\n function mintRandomTo(address to, uint256 amount, address affiliate) external payable;\n\n /// @notice Redeems remaining random tickets generated from `msg.sender` by calling `mintRandomTo` for actual NFTs.\n function redeemRandom() external payable;\n\n /// @notice Mints `amount` NFTs to `to` address. Requires `minting type` to be `specify` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n /// @param to The address of the NFTs receiver\n /// @param tokenIds An array of the specified tokens. They must not be minted, otherwise, it will revert.\n function mintSpecifyTo(address to, uint256[] memory tokenIds) external payable; \n\n /// @notice Mints `amount` NFTs to `to` address with a given `affiliate`. Requires `minting type` to be `specify` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n /// @param to The address of the NFTs receiver\n /// @param tokenIds An array of the specified tokens. They must not be minted, otherwise, it will revert.\n /// @param affiliate The affiliate address\n function mintSpecifyTo(address to, uint256[] memory tokenIds, address affiliate) external payable; \n\n /// @notice Mints one NFT to `to` address. Requires `minting type` to be `customURI`.\n /// @param to The address of the NFTs receiver\n /// @param customURICIDHash The CID of the given token.\n /// @param soulbound True if the NFT is a Soulbound Token (SBT). If set, it can't be transferred.\n function mintCustomURITo(address to, bytes32 customURICIDHash, bool soulbound) external payable;\n\n /// @notice Only owner can call this function. Free of charge. Mints sizeof(`to`) to `to` addresses. Requires `minting type` to be `sequential`.\n /// @param to The addresses of the NFTs receivers\n /// @param soulbound True if the NFT is a Soulbound Token (SBT). If set, it can't be transferred.\n function airdropSequential(address[] memory to, bool soulbound) external payable;\n\n /// @notice Only owner can call this function. Free of charge. Mints sizeof(`to`) to `to` addresses with random tokenIds. Requires `minting type` to be `random`.\n /// @param to The addresses of the NFTs receivers\n /// @param soulbound True if the NFT is a Soulbound Token (SBT). If set, it can't be transferred.\n function airdropRandom(address[] memory to, bool soulbound) external payable;\n\n /// @notice Only owner can call this function. Free of charge. Mints sizeof(`to`) to `to` addresses with specified tokenIds. Requires `minting type` to be `specify`.\n /// @param to The addresses of the NFTs receivers\n /// @param tokenIds An array of the specified tokens. They must not be minted, otherwise, it will revert.\n /// @param soulbound True if the NFT is a Soulbound Token (SBT). If set, it can't be transferred.\n function airdropSpecify(address[] memory to, uint256[] memory tokenIds, bool soulbound) external payable;\n\n /// @notice Mints `amount` of NFTs to `to` address with optional specified tokenIds. This function must be called only if a valid `signature` is given during a whitelisting/presale.\n /// @param to The addresses of the NFTs receivers\n /// @param tokenIds An optional array of the specified tokens. They must not be minted, otherwise, it will revert. Only used if minting type is `specify`.\n /// @param freeMinting True is minting is free\n /// @param customFee Zero is fee is different from `mintingPrice`.\n /// @param maxAmount Max Amount to be minted with the given `signature`.\n /// @param amount Amount to mint.\n /// @param soulbound True if the NFT is a Soulbound Token (SBT). If set, it can't be transferred.\n /// @param signature Valid `signature` for the presale/whitelist.\n function mintPresale (\n address to, \n uint256[] memory tokenIds,\n bool freeMinting, \n uint256 customFee, \n uint256 maxAmount,\n uint256 amount, \n bool soulbound,\n bytes calldata signature) payable external;\n\n /// @notice Returns the minting price of one NFT.\n /// @return Mint price for one NFT in native coin or ERC-20.\n function mintPrice() external view returns (uint256);\n\n /// @notice Returns the current total supply.\n /// @return Current total supply.\n function totalSupply() external view returns (uint256);\n\n /// @notice Max amount of NFTs to be hold per address.\n /// @return Max per address allowed.\n function maxPerAddress() external view returns (uint16);\n\n}\n\n" }, "contracts/interfaces/IN2M_ERCCommon.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"./IN2M_ERCLibrary.sol\";\nimport \"./IN2M_ERCBase.sol\";\n\ninterface IN2M_ERCCommon is IN2M_ERCBase, IN2M_ERCLibrary {\n /// @notice Returns the address of the current collection owner.\n /// @return The address of the owner.\n function owner() external view returns (address);\n}\n\n" }, "contracts/interfaces/IN2M_ERCLibrary.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"./IN2M_ERCStorage.sol\";\n\ninterface IN2M_ERCLibrary is IN2M_ERCStorage {\n function setAndRevealBaseURI(bytes32 baseURICIDHash) external;\n function changeMintPrice(uint256 newMintPrice) external;\n function contractURI() external view returns (string memory);\n function setContractURI(bytes32 newContractURIMetadataCIDHash) external;\n function setAffiliatesPercentageAndDiscount(uint16 userDiscount, uint16 affiliatePercentage, address affiliateAddress) external;\n function affiliateWithdraw(address affiliate) external;\n function withdrawERC20(address erc20Address) external;\n function withdrawERC20Pro(uint256 signatureExpireDate, uint n2mFee, address erc20Address, bytes calldata signature) external;\n function withdraw() external;\n function withdrawPro(uint256 signatureExpireDate, uint256 n2mFee, bytes calldata signature) external;\n function setReverseENSName(address rerverseResolver, string calldata collectionENSName) external;\n function initializeAndSetReverseENSName(address resolver, string calldata collectionENSName) external;\n function changePlaceholderImageCID(bytes32 newPlaceholderImageCIDHash) external;\n function setPhase(SalePhase newPhase) external;\n function setDropDate(uint256 dropDateTimestamp) external;\n function setDropAndEndDate(uint256 dropDateTimestamp, uint256 endDateTimestamp) external;\n function setMaxPerAddress(uint16 newMaxPerAddress) external;\n function isOperatorFilterRegistryEnabled() external view returns (bool);\n function enableOperatorFilterRegistry() external;\n function disableOperatorFilterRegistry() external;\n function collectionSize() external view returns (uint256);\n function randomTickets(address affiliate) external view returns (uint amount, uint blockNumberToReveal);\n function affiliatesInfo(address affiliate) external view returns (bool enabled, uint16 affiliatePercentage, uint16 userDiscount);\n function pendingAffiliateBalance(address affiliate) external view returns (uint256);\n function pendingTotalAffiliatesBalance() external view returns (uint256);\n function royaltyFee() external view returns (uint256);\n function withdrawnAmount() external view returns (uint256);\n function withdrawnERC20Amount(address erc20) external view returns (uint256);\n function erc20PaymentAddress() external view returns (address);\n function currentPhase() external view returns (SalePhase);\n function mintingType() external view returns (MintingType);\n function saleDates() external view returns (uint256 dropDateTimestamp, uint256 endDateTimestamp);\n function isOpen() external view returns (bool);\n function ownerMaxRevenue() external view returns (uint256);\n\n}\n\n" }, "contracts/interfaces/IN2M_ERCStorage.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"@nfts2me/contracts/important/README.sol\";\n\ninterface IN2M_ERCStorage is Readme {\n /// @notice This event is emitted when a token is minted using an affiliate\n /// @param affiliate The affiliate address\n event AffiliateSell(address indexed affiliate);\n\n /// @notice Error thrown when trying to mint a token with a given id which is already minted\n error TokenAlreadyMinted();\n\n /// @notice Error thrown when input variable differ in length\n error InvalidInputSizesDontMatch();\n\n /// @notice Error thrown when input variable differ in length\n error InputSizeMismatch();\n\n /// @notice Error thrown when trying to mint a token with a given invalid id\n error InvalidTokenId();\n\n /// @notice Error thrown when trying to redeem random tickets with no amount to redeem\n error NothingToRedeem();\n\n /// @notice Error thrown when trying to redeem random tickets too soon\n error CantRevealYetWaitABitToBeAbleToRedeem();\n\n /// @notice Error thrown when the input amount is not valid\n error InvalidAmount();\n\n /// @notice Error thrown when trying to mint a sold out collection or the amount to mint exceeds the remaining supply\n error CollectionSoldOut();\n\n /// @notice Error thrown when trying to presale/whitelist mint and the collection current phase is `closed`\n error PresaleNotOpen();\n\n /// @notice Error thrown when trying to mint and the collection current phase is not `open`\n error PublicSaleNotOpen();\n\n /// @notice Error thrown when trying to mint but the sale has already finished\n error SaleFinished();\n\n /// @notice Error thrown when trying to mint more than the allowance to mint\n error NotEnoughAmountToMint();\n\n /// @notice Error thrown when sending funds to a free minting\n error InvalidMintFeeForFreeMinting();\n\n /// @notice Error thrown when the sent amount is not valid\n error InvalidMintFee();\n\n /// @notice Royalty fee can't be higher than 10%\n error RoyaltyFeeTooHigh();\n\n /// @notice Invalid input. Total supply must be greater than zero\n error TotalSupplyMustBeGreaterThanZero();\n\n /// @notice Can't set BaseURI and Placeholder at the same time\n error CantSetBaseURIAndPlaceholderAtTheSameTime();\n\n /// @notice No BaseURI nor Placeholder set\n error NoBaseURINorPlaceholderSet();\n\n /// @notice Can't transfer a Soulbound Token (SBT)\n error NonTransferrableSoulboundNFT();\n\n /// @notice The input revenue percentages are not valid\n error InvalidRevenuePercentage();\n\n /// @notice Can't mint until specified drop date\n error WaitUntilDropDate();\n\n /// @notice Trying to use mintPresale method in a collection with a minting type that doesn't support whitelist\n error PresaleInvalidMintingType();\n\n /// @notice Metadata is already fixed. Can't change metadata once fixed\n error MetadataAlreadyFixed();\n\n /// @notice Invalid collection minting type for the current minting function\n error InvalidMintingType();\n\n /// @notice The address exceeded the max per address amount\n error MaxPerAddressExceeded();\n\n /// @notice The given signature doesn't match the input values\n error SignatureMismatch();\n\n /// @notice Reentrancy Guard protection\n error ReentrancyGuard();\n\n /// @notice New Placeholder can't be empty\n error NewPlaceholderCantBeEmpty();\n\n /// @notice New BaseURI can't be empty\n error NewBaseURICantBeEmpty(); \n\n /// @notice Invalid percentage or discount values\n error InvalidPercentageOrDiscountValues();\n\n /// @notice Can't lower current percentages\n error CantLowerCurrentPercentages();\n\n /// @notice Contract MetadataURI already fixed\n error ContractMetadataURIAlreadyFixed();\n\n /// @notice Only owner of N2M can call this function\n error OnlyOwnerOrN2M();\n\n /// @notice Only the given affiliate or N2M can call this function\n error OnlyAffiliateOrN2M();\n\n /// @notice The signature has expired\n error SignatureExpired();\n\n /// @notice Invalid phase can't be set without giving a date, use the proper functions\n error InvalidPhaseWithoutDate();\n\n /// @notice Invalid drop date\n error InvalidDropDate();\n\n /// @notice Operator address is filtered\n error AddressFiltered(address filtered);\n\n struct RandomTicket {\n uint256 amount;\n uint256 blockNumberToReveal;\n }\n\n struct RevenueAddress {\n address to;\n uint16 percentage;\n }\n\n struct AffiliateInformation {\n bool enabled;\n uint16 affiliatePercentage;\n uint16 userDiscount;\n }\n\n enum SalePhase { \n CLOSED,\n PRESALE,\n PUBLIC,\n DROP_DATE,\n DROP_AND_END_DATE\n }\n\n enum MintingType { \n SEQUENTIAL, \n RANDOM, \n SPECIFY, \n CUSTOM_URI \n }\n\n enum OperatorFilterStatus { \n ENABLED_NOT_INITIALIZED, \n ENABLED_EXISTS, \n DISABLED_NOT_INITIALIZED,\n DISABLED_EXISTS \n }\n\n /// @notice Returns true if the metadata is fixed and immutable. If the metadata hasn't been fixed yet it will return false. Once fixed, it can't be changed by anyone.\n function isMetadataFixed() external view returns (bool);\n\n}\n\n" }, "contracts/interfaces/IN2MBeaconFactory.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\ninterface IN2MUpgradeable {\n function getERC721Implementation() external view returns (address);\n function getERC1155Implementation() external view returns (address);\n}\n" }, "contracts/interfaces/IN2MCrossFactory.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\ninterface IN2MCrossFactory {\n function getN2MTreasuryAddress() external pure returns (address);\n function ownerOf(uint256 tokenId) external view returns (address);\n function strictOwnerOf(uint256 tokenId) external view returns (address);\n}\n" }, "contracts/interfaces/IN2MERC1155.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC1155/IERC1155.sol\";\nimport \"@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol\";\nimport \"./IN2M_ERCCommon.sol\";\n\ninterface IN2MERC1155 is IERC1155MetadataURI, IN2M_ERCCommon {\n function supportsInterface(bytes4 interfaceId) external view override(IERC165, IERC165Upgradeable) returns (bool);\n function balanceOf(address owner) external view returns (uint256 balance);\n function totalSupply(uint256 id) external view returns (uint256);\n function exists(uint256 id) external view returns (bool);\n function getSupplies(uint256 startId, uint256 endId) external view returns (uint256[] memory supplies, uint256 blockNumber, uint256 blockTimestamp);\n}\n\n" }, "contracts/interfaces/IN2MERC721.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\";\nimport \"@openzeppelin/contracts/governance/utils/IVotes.sol\";\nimport \"./IN2M_ERCCommon.sol\";\n\ninterface IN2MERC721 is IERC721Metadata, IN2M_ERCCommon, IVotes {\n function name() external view override(IERC721Metadata, IN2M_ERCBase) returns (string memory);\n function tokenURI(uint256 tokenId) external view override(IERC721Metadata, IN2M_ERCBase) returns (string memory);\n function symbol() external view override(IERC721Metadata, IN2M_ERCBase) returns (string memory);\n function supportsInterface(bytes4 interfaceId) external view override(IERC165, IERC165Upgradeable) returns (bool);\n}\n\n" }, "contracts/interfaces/IOperatorFilterRegistry.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\ninterface IOperatorFilterRegistry {\n function isOperatorAllowed(address registrant, address operator) external view returns (bool);\n function register(address registrant) external;\n function registerAndSubscribe(address registrant, address subscription) external;\n function registerAndCopyEntries(address registrant, address registrantToCopy) external;\n function updateOperator(address registrant, address operator, bool filtered) external;\n function updateOperators(address registrant, address[] calldata operators, bool filtered) external;\n function updateCodeHash(address registrant, bytes32 codehash, bool filtered) external;\n function updateCodeHashes(address registrant, bytes32[] calldata codeHashes, bool filtered) external;\n function subscribe(address registrant, address registrantToSubscribe) external;\n function unsubscribe(address registrant, bool copyExistingEntries) external;\n function subscriptionOf(address addr) external returns (address registrant);\n function subscribers(address registrant) external returns (address[] memory);\n function subscriberAt(address registrant, uint256 index) external returns (address);\n function copyEntriesOf(address registrant, address registrantToCopy) external;\n function isOperatorFiltered(address registrant, address operator) external returns (bool);\n function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool);\n function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool);\n function filteredOperators(address addr) external returns (address[] memory);\n function filteredCodeHashes(address addr) external returns (bytes32[] memory);\n function filteredOperatorAt(address registrant, uint256 index) external returns (address);\n function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32);\n function isRegistered(address addr) external view returns (bool);\n function codeHashOf(address addr) external view returns (bytes32);\n}" }, "contracts/interfaces/IReverseRegistrar.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\ninterface IReverseRegistrar {\n function setDefaultResolver(address resolver) external;\n\n function claim(address owner) external returns (bytes32);\n\n function claimForAddr(\n address addr,\n address owner,\n address resolver\n ) external returns (bytes32);\n\n function claimWithResolver(address owner, address resolver)\n external\n returns (bytes32);\n\n function setName(string memory name) external returns (bytes32);\n\n function setNameForAddr(\n address addr,\n address owner,\n address resolver,\n string memory name\n ) external returns (bytes32);\n\n function node(address addr) external pure returns (bytes32);\n}" }, "contracts/N2MCommonStorage.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"@nfts2me/contracts/interfaces/IN2M_ERCStorage.sol\";\nimport \"@nfts2me/contracts/interfaces/IN2MCrossFactory.sol\";\nimport \"@nfts2me/contracts/ownable/NFTOwnableUpgradeable.sol\";\nimport {IOperatorFilterRegistry} from \"@nfts2me/contracts/interfaces/IOperatorFilterRegistry.sol\";\nimport \"./N2MVersion.sol\";\n\n/// @title NFTs2Me.com Smart Contracts\n/// @author The NFTs2Me Team\n/// @notice Read our terms of service\n/// @custom:security-contact [email protected]\n/// @custom:terms-of-service https://nfts2me.com/terms-of-service/\n/// @custom:website https://nfts2me.com/\nabstract contract N2MCommonStorage is\n NFTOwnableUpgradeable,\n IN2M_ERCStorage,\n N2MVersion\n{\n /// CONSTANTS\n address internal constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6);\n address internal constant OPENSEA_CONDUIT = address(0x1E0049783F008A0085193E00003D00cd54003c71);\n address internal constant N2M_CONDUIT = address(0x88899DC0B84C6E726840e00DFb94ABc6248825eC);\n IOperatorFilterRegistry internal constant operatorFilterRegistry = IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E);\n address internal constant N2M_PRESALE_SIGNER = address(0xC0ffee06CE3D6689305035601a055A96acd619c6);\n address internal constant N2M_TREASURY = address(0x955aF4de9Ca03f84c9462457D075aCABf1A8AfC8);\n uint256 internal constant N2M_FEE = 5_00;\n uint256 internal constant MAX_AFFILIATE_DISCOUNT = 100_00;\n uint256 internal constant MAX_AFFILIATE_PERCENTAGE = 100_00;\n uint256 internal constant NOT_ENTERED = 0;\n\n /// IMMUTABLE \n address payable internal immutable _factory;\n\n bytes32 internal _baseURICIDHash;\n bytes32 internal _placeholderImageCIDHash;\n bytes32 internal _contractURIMetadataCIDHash;\n\n mapping(address => uint256) internal _pendingAffiliateBalance;\n uint256 internal _pendingTotalAffiliatesBalance;\n\n RevenueAddress[] internal _revenueInfo;\n mapping(address => AffiliateInformation) internal _affiliatesInfo;\n\n uint256 internal _mintPrice;\n uint256 internal _withdrawnAmount;\n uint256 internal _reentrancyEntered;\n uint256 internal _dropDateTimestamp;\n uint256 internal _endDateTimestamp; \n\n mapping(address => uint256) internal _withdrawnERC20Amount;\n address internal _erc20PaymentAddress;\n\n mapping(address => RandomTicket) internal _randomTickets;\n mapping(bytes => uint256) internal _usedAmountSignature;\n mapping(uint256 => bool) internal _soulbound;\n mapping(uint256 => bytes32) internal _customURICIDHashes;\n\n uint32 internal _soldTokens;\n SalePhase internal _currentPhase;\n OperatorFilterStatus internal _operatorFilterStatus;\n MintingType internal _mintingType; \n uint16 internal _royaltyFee;\n uint16 internal _maxPerAddress; \n uint32 internal _collectionSize;\n bool internal _isERC20Payment;\n bool internal _soulboundCollection;\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor(address payable factoryAddress) {\n _factory = factoryAddress;\n _disableInitializers();\n }\n\n /// @notice Returns the address of the current collection owner.\n function owner() public view override(NFTOwnableUpgradeable) returns (address collectionOwner) {\n try IN2MCrossFactory(_factory).ownerOf(uint256(uint160(address(this)))) returns (address ownerOf) {\n return ownerOf;\n } catch {}\n }\n\n function _strictOwner() internal view override(NFTOwnableUpgradeable) returns (address ownerStrictAddress) {\n try IN2MCrossFactory(_factory).strictOwnerOf(uint256(uint160(address(this)))) returns (address strictOwnerOf) {\n return strictOwnerOf;\n } catch {}\n }\n\n function _getN2MFeeAddress() internal view override(NFTOwnableUpgradeable) returns (address) {\n\n try IN2MCrossFactory(_factory).getN2MTreasuryAddress() returns (address n2mTreasuryAddress) {\n return n2mTreasuryAddress;\n } catch {\n return N2M_TREASURY;\n }\n } \n\n modifier nonReentrant() {\n _nonReentrantBefore();\n _;\n _nonReentrantAfter();\n }\n\n function _nonReentrantBefore() private {\n if (_reentrancyEntered != 0) revert ReentrancyGuard();\n _reentrancyEntered = 1;\n }\n\n function _nonReentrantAfter() private {\n delete(_reentrancyEntered);\n } \n\n /// @notice Returns true if the metadata is fixed and immutable. If the metadata hasn't been fixed yet it will return false. Once fixed, it can't be changed by anyone.\n function isMetadataFixed() public view override returns (bool) {\n return (_baseURICIDHash != 0 || (_mintingType == MintingType.CUSTOM_URI));\n }\n\n}\n" }, "contracts/N2MERC1155.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155SupplyUpgradeable.sol\";\n\nimport \"./N2MTokenCommon.sol\";\n\n/// @title NFTs2Me.com Smart Contracts for ERC-1155.\n/// @author The NFTs2Me Team\n/// @notice Read our terms of service\n/// @custom:security-contact [email protected]\n/// @custom:terms-of-service https://nfts2me.com/terms-of-service/\n/// @custom:website https://nfts2me.com/\ncontract N2MERC1155 is\n N2MTokenCommon,\n ERC1155Upgradeable,\n ERC1155SupplyUpgradeable\n{\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor(address libraryAddress, address payable factoryAddress) N2MTokenCommon(libraryAddress, factoryAddress) {}\n\n string private _name;\n string public override symbol;\n\n mapping(address => uint256) private _balances;\n\n /// @notice To be called to create the collection. Can only be called once.\n function initialize(\n string memory tokenName,\n string memory tokenSymbol,\n uint256 iMintPrice,\n bytes32 baseURICIDHash,\n bytes32 placeholderImageCIDHash,\n RevenueAddress[] calldata revenueAddresses,\n address iErc20PaymentAddress,\n uint32 iTotalSupply,\n uint16 iRoyaltyFee,\n bool soulboundCollection,\n MintingType iMintingType\n ) public payable override initializer {\n\n _name = tokenName;\n symbol = tokenSymbol;\n\n if (iTotalSupply == 0) revert TotalSupplyMustBeGreaterThanZero();\n if (baseURICIDHash != 0 && placeholderImageCIDHash != 0) revert CantSetBaseURIAndPlaceholderAtTheSameTime();\n if (iRoyaltyFee > 10_00) revert RoyaltyFeeTooHigh();\n\n _collectionSize = iTotalSupply;\n if (baseURICIDHash == 0) {\n if (placeholderImageCIDHash == 0) {\n if (iMintingType != MintingType.CUSTOM_URI)\n revert NoBaseURINorPlaceholderSet();\n } else {\n _placeholderImageCIDHash = placeholderImageCIDHash;\n }\n } else {\n _baseURICIDHash = baseURICIDHash;\n }\n\n _mintPrice = iMintPrice;\n _royaltyFee = iRoyaltyFee;\n if (iMintingType != MintingType.SEQUENTIAL) {\n _mintingType = iMintingType;\n }\n if (iErc20PaymentAddress != address(0)) {\n _isERC20Payment = true;\n _erc20PaymentAddress = iErc20PaymentAddress;\n }\n if (soulboundCollection == true) {\n _soulboundCollection = true;\n }\n\n if (revenueAddresses.length > 0) {\n uint256 revenuePercentageTotal;\n for (uint256 i; i < revenueAddresses.length; ) {\n revenuePercentageTotal += revenueAddresses[i].percentage;\n unchecked {\n ++i;\n }\n }\n _revenueInfo = revenueAddresses;\n if (revenuePercentageTotal > 100_00 - N2M_FEE) revert InvalidRevenuePercentage();\n }\n\n }\n\n /// @notice alias for `uri`\n function tokenURI(uint256 tokenId)\n public\n view\n override\n returns (string memory)\n {\n return uri(tokenId);\n }\n\n /// @notice tokenURI of the given token\n /// @param tokenId of the token to ask for\n /// @return tokenURI for `tokenId`\n function uri(uint256 tokenId)\n public\n view\n override(ERC1155Upgradeable)\n returns (string memory)\n {\n return IN2MLibrary(address(this)).tokenURIImpl(tokenId);\n }\n\n function _exists(uint256 tokenId) internal view override returns (bool) {\n return exists(tokenId);\n }\n\n function _mint(address to, uint256 tokenId) internal override {\n super._mint(to, tokenId, 1, \"\");\n }\n\n /// @notice Collection name\n /// @return the collection name\n function name() public view override returns (string memory) {\n return _name;\n }\n\n /// @notice Balance of a given address for ERC-1155 (non-standard).\n /// @param owner to ask for the balance\n /// @return balance of the `owner`\n function balanceOf(address owner) public view override returns (uint256 balance) {\n if (owner == address(0)) revert();\n balance = _balances[owner];\n if (_mintingType == MintingType.RANDOM) {\n balance += _randomTickets[owner].amount;\n }\n }\n\n function _mintSequential(address to, uint256 amount) internal override {\n if (amount == 1) {\n unchecked {\n _mint(to, ++_soldTokens, 1, \"\");\n }\n } else {\n uint256[] memory ids = new uint256[](amount);\n uint256[] memory amounts = new uint256[](amount);\n\n for (uint256 i; i < amount; ) {\n unchecked {\n ids[i] = ++_soldTokens;\n amounts[i] = 1;\n ++i;\n }\n }\n\n _mintBatch(to, ids, amounts, \"\");\n }\n }\n\n function _mintSpecify(address to, uint256[] memory tokenIds)\n internal\n override\n {\n uint32 amount = uint32(tokenIds.length);\n _soldTokens += amount;\n uint256[] memory amounts = new uint256[](amount);\n\n for (uint256 i; i < amount; ) {\n uint256 tokenId = tokenIds[i];\n amounts[i] = 1;\n if (_exists(tokenId)) revert TokenAlreadyMinted();\n if (tokenId <= 0 || tokenId > _collectionSize) revert InvalidTokenId();\n unchecked {\n ++i;\n }\n }\n _mintBatch(to, tokenIds, amounts, \"\");\n }\n\n function _beforeTokenTransfer(\n address operator,\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) internal override(ERC1155Upgradeable, ERC1155SupplyUpgradeable) {\n uint256 length = ids.length;\n for (uint256 i; i < length; ) {\n\n if (from != address(0)) {\n if (_soulbound[ids[i]] || _soulboundCollection) revert NonTransferrableSoulboundNFT();\n\n _balances[from] -= amounts[i];\n }\n\n if (to != address(0)) {\n\n _balances[to] += amounts[i];\n }\n\n unchecked {\n ++i;\n }\n }\n\n super._beforeTokenTransfer(operator, from, to, ids, amounts, data);\n\n if (_maxPerAddress != 0) {\n\n if (balanceOf(to) > _maxPerAddress) revert MaxPerAddressExceeded();\n } \n }\n\n /// @notice Query if a contract implements an interface\n /// @param interfaceId The interface identifier, as specified in ERC-165\n /// @dev Interface identification is specified in ERC-165. This function uses less than 30,000 gas.\n /// @return `true` if the contract implements `interfaceId` and `interfaceId` is not 0xffffffff, `false` otherwise\n function supportsInterface(bytes4 interfaceId)\n public\n view\n override(ERC1155Upgradeable, IERC165Upgradeable)\n returns (bool)\n {\n return (\n\n interfaceId == type(IERC2981Upgradeable).interfaceId || super.supportsInterface(interfaceId));\n }\n\n /// @notice Enable or disable approval for a third party (\"operator\") to manage all of the caller's tokens.\n /// @dev MUST emit the ApprovalForAll event on success.\n /// @param operator Address to add to the set of authorized operators\n /// @param approved True if the operator is approved, false to revoke approval\n function setApprovalForAll(address operator, bool approved) public override onlyAllowedOperatorApproval(operator) {\n super.setApprovalForAll(operator, approved);\n } \n\n /// @notice Queries the approval status of an operator for a given owner.\n /// @param owner The owner of the tokens\n /// @param operator Address of authorized operator\n /// @return True if the operator is approved, false if not\n function isApprovedForAll(address owner, address operator)\n public\n view\n virtual\n override\n returns (bool)\n {\n\n if (operator == N2M_CONDUIT) return true;\n if (operator == OPENSEA_CONDUIT) return true;\n\n return super.isApprovedForAll(owner, operator);\n }\n\n function safeTransferFrom(\n address from,\n address to,\n uint256 id,\n uint256 amount,\n bytes memory data\n ) public override onlyAllowedOperator() {\n super.safeTransferFrom(from, to, id, amount, data);\n }\n\n function safeBatchTransferFrom(\n address from,\n address to,\n uint256[] memory ids,\n uint256[] memory amounts,\n bytes memory data\n ) public override onlyAllowedOperator() {\n super.safeBatchTransferFrom(from, to, ids, amounts, data);\n }\n\n // ////////\n\n // ////////\n\n function getSupplies(uint256 startId, uint256 endId)\n external\n view\n returns (\n uint256[] memory supplies,\n uint256 blockNumber,\n uint256 blockTimestamp\n )\n {\n blockNumber = block.number;\n blockTimestamp = block.timestamp;\n\n if (endId >= startId) {\n uint256 total = 1 + endId - startId;\n unchecked {\n supplies = new uint256[](total);\n for (uint256 i; i < total; i++) {\n supplies[i] = totalSupply(startId + i);\n }\n }\n } else {\n uint256[] memory emptyArray;\n supplies = emptyArray;\n }\n } \n\n}\n" }, "contracts/N2MERC721.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721VotesUpgradeable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\nimport \"./N2MTokenCommon.sol\";\n\n/// @title NFTs2Me.com Smart Contracts for ERC-721.\n/// @author The NFTs2Me Team\n/// @notice Read our terms of service\n/// @custom:security-contact [email protected]\n/// @custom:terms-of-service https://nfts2me.com/terms-of-service/\n/// @custom:website https://nfts2me.com/\ncontract N2MERC721 is\n N2MTokenCommon,\n ERC721Upgradeable,\n EIP712Upgradeable,\n ERC721VotesUpgradeable\n{\n\n /// @notice To be called to create the collection. Can only be called once.\n function initialize(\n string memory tokenName,\n string memory tokenSymbol,\n uint256 iMintPrice,\n bytes32 baseURICIDHash,\n bytes32 placeholderImageCIDHash,\n RevenueAddress[] calldata revenueAddresses,\n address iErc20PaymentAddress,\n uint32 iTotalSupply,\n uint16 iRoyaltyFee,\n bool soulboundCollection,\n MintingType iMintingType\n ) public payable override initializer {\n __ERC721_init(tokenName, tokenSymbol);\n\n if (iTotalSupply == 0) revert TotalSupplyMustBeGreaterThanZero();\n if (baseURICIDHash != 0 && placeholderImageCIDHash != 0) revert CantSetBaseURIAndPlaceholderAtTheSameTime();\n if (iRoyaltyFee > 10_00) revert RoyaltyFeeTooHigh();\n\n _collectionSize = iTotalSupply;\n if (baseURICIDHash == 0) {\n if (placeholderImageCIDHash == 0) {\n if (iMintingType != MintingType.CUSTOM_URI)\n revert NoBaseURINorPlaceholderSet();\n } else {\n _placeholderImageCIDHash = placeholderImageCIDHash;\n }\n } else {\n _baseURICIDHash = baseURICIDHash;\n }\n\n _mintPrice = iMintPrice;\n _royaltyFee = iRoyaltyFee;\n if (iMintingType != MintingType.SEQUENTIAL) {\n _mintingType = iMintingType;\n }\n if (iErc20PaymentAddress != address(0)) {\n _isERC20Payment = true;\n _erc20PaymentAddress = iErc20PaymentAddress;\n }\n if (soulboundCollection == true) {\n _soulboundCollection = true;\n }\n\n if (revenueAddresses.length > 0) {\n uint256 revenuePercentageTotal;\n for (uint256 i; i < revenueAddresses.length; ) {\n revenuePercentageTotal += revenueAddresses[i].percentage;\n unchecked {\n ++i;\n }\n }\n _revenueInfo = revenueAddresses;\n if (revenuePercentageTotal > 100_00 - N2M_FEE) revert InvalidRevenuePercentage();\n }\n\n }\n\n constructor(address libraryAddress, address payable factoryAddress) N2MTokenCommon(libraryAddress, factoryAddress) {}\n\n /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.\n /// @dev Throws if `_tokenId` is not a valid NFT. URIs are defined in RFC\n /// 3986. The URI may point to a JSON file that conforms to the \"ERC721\n /// Metadata JSON Schema\".\n function tokenURI(uint256 tokenId)\n public\n view\n override(N2MTokenCommon, ERC721Upgradeable)\n returns (string memory)\n {\n _requireMinted(tokenId);\n return IN2MLibrary(address(this)).tokenURIImpl(tokenId);\n }\n\n function _exists(uint256 tokenId)\n internal\n view\n override(ERC721Upgradeable, N2MTokenCommon)\n returns (bool)\n {\n return super._exists(tokenId);\n }\n\n function _mint(address to, uint256 tokenId)\n internal\n override(ERC721Upgradeable, N2MTokenCommon)\n {\n super._mint(to, tokenId);\n }\n\n /// @notice A descriptive name for a collection of NFTs in this contract\n function name()\n public\n view\n override(ERC721Upgradeable, N2MTokenCommon)\n returns (string memory)\n {\n return super.name();\n }\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal override {\n if (\n from != address(0) &&\n (_soulbound[firstTokenId] || _soulboundCollection)\n ) revert NonTransferrableSoulboundNFT();\n\n super._beforeTokenTransfer(from, to, firstTokenId, batchSize);\n }\n\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal override(ERC721Upgradeable, ERC721VotesUpgradeable) {\n super._afterTokenTransfer(from, to, firstTokenId, batchSize);\n\n if (_maxPerAddress != 0) {\n\n if (balanceOf(to) > _maxPerAddress) revert MaxPerAddressExceeded();\n }\n }\n\n function _burn(uint256 tokenId)\n internal\n override(ERC721Upgradeable)\n {\n super._burn(tokenId);\n if (_customURICIDHashes[tokenId] != 0) {\n delete _customURICIDHashes[tokenId];\n } \n }\n\n /// @notice Query if a contract implements an interface\n /// @param interfaceId The interface identifier, as specified in ERC-165\n /// @dev Interface identification is specified in ERC-165. This function uses less than 30,000 gas.\n /// @return `true` if the contract implements `interfaceId` and `interfaceId` is not 0xffffffff, `false` otherwise\n function supportsInterface(bytes4 interfaceId)\n public\n view\n override(ERC721Upgradeable, IERC165Upgradeable)\n returns (bool)\n {\n return (\n\n interfaceId == type(IERC2981Upgradeable).interfaceId || super.supportsInterface(interfaceId));\n }\n\n /// @notice An abbreviated name for NFTs in this contract\n /// @return the collection symbol\n function symbol()\n public\n view\n virtual\n override(IN2M_ERCBase, ERC721Upgradeable)\n returns (string memory)\n {\n return super.symbol();\n }\n\n /// @notice Count all NFTs assigned to an owner\n /// @dev NFTs assigned to the zero address are considered invalid, and this\n /// function throws for queries about the zero address.\n /// @param owner An address for whom to query the balance\n /// @return balance The number of NFTs owned by `owner`, possibly zero\n function balanceOf(address owner) public view override(ERC721Upgradeable, N2MTokenCommon) returns (uint256 balance) {\n balance = super.balanceOf(owner);\n if (_mintingType == MintingType.RANDOM) {\n balance += _randomTickets[owner].amount;\n }\n }\n\n function _EIP712NameHash() internal virtual override view returns (bytes32) {\n\n return keccak256(\"NFTs2Me\");\n }\n\n function _EIP712VersionHash() internal virtual override view returns (bytes32) {\n return keccak256(\"1\");\n } \n\n /// @notice Enable or disable approval for a third party (\"operator\") to manage\n /// all of `msg.sender`'s assets\n /// @dev Emits the ApprovalForAll event. The contract MUST allow\n /// multiple operators per owner.\n /// @param operator Address to add to the set of authorized operators\n /// @param approved True if the operator is approved, false to revoke approval\n function setApprovalForAll(address operator, bool approved) public override onlyAllowedOperatorApproval(operator) {\n super.setApprovalForAll(operator, approved);\n }\n\n /// @notice Change or reaffirm the approved address for an NFT\n /// @dev The zero address indicates there is no approved address.\n /// Throws unless `msg.sender` is the current NFT owner, or an authorized\n /// operator of the current owner.\n /// @param operator The new approved NFT controller\n /// @param tokenId The NFT to approve\n function approve(address operator, uint256 tokenId) public override onlyAllowedOperatorApproval(operator) {\n super.approve(operator, tokenId);\n }\n\n /// @notice Query if an address is an authorized operator for another address\n /// @param owner The address that owns the NFTs\n /// @param operator The address that acts on behalf of the owner\n /// @return True if `operator` is an approved operator for `owner`, false otherwise\n function isApprovedForAll(address owner, address operator)\n public\n view\n virtual\n override\n returns (bool)\n {\n\n if (operator == N2M_CONDUIT) return true;\n if (operator == OPENSEA_CONDUIT) return true;\n\n return super.isApprovedForAll(owner, operator);\n }\n\n /// @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE\n /// TO CONFIRM THAT `to` IS CAPABLE OF RECEIVING NFTS OR ELSE\n /// THEY MAY BE PERMANENTLY LOST\n /// @dev Throws unless `msg.sender` is the current owner, an authorized\n /// operator, or the approved address for this NFT. Throws if `from` is\n /// not the current owner. Throws if `to` is the zero address. Throws if\n /// `tokenId` is not a valid NFT.\n /// @param from The current owner of the NFT\n /// @param to The new owner\n /// @param tokenId The NFT to transfer\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public override onlyAllowedOperator() {\n super.transferFrom(from, to, tokenId);\n }\n\n /// @notice Transfers the ownership of an NFT from one address to another address\n /// @dev This works identically to the other function with an extra data parameter,\n /// except this function just sets data to \"\".\n /// @param from The current owner of the NFT\n /// @param to The new owner\n /// @param tokenId The NFT to transfer\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public override onlyAllowedOperator() {\n super.safeTransferFrom(from, to, tokenId);\n }\n\n /// @notice Transfers the ownership of an NFT from one address to another address\n /// @dev Throws unless `msg.sender` is the current owner, an authorized\n /// operator, or the approved address for this NFT. Throws if `from` is\n /// not the current owner. Throws if `to` is the zero address. Throws if\n /// `tokenId` is not a valid NFT. When transfer is complete, this function\n /// checks if `to` is a smart contract (code size > 0). If so, it calls\n /// `onERC721Received` on `to` and throws if the return value is not\n /// `bytes4(keccak256(\"onERC721Received(address,address,uint256,bytes)\"))`.\n /// @param from The current owner of the NFT\n /// @param to The new owner\n /// @param tokenId The NFT to transfer\n /// @param data Additional data with no specified format, sent in call to `to`\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) public override onlyAllowedOperator() {\n super.safeTransferFrom(from, to, tokenId, data);\n }\n\n}\n" }, "contracts/N2MTokenCommon.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721VotesUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721URIStorageUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol\";\n\n/// Utils\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\nimport \"@nfts2me/contracts/interfaces/IN2MCrossFactory.sol\";\nimport \"@nfts2me/contracts/interfaces/IN2M_ERCBase.sol\";\nimport \"./N2MCommonStorage.sol\";\n\ninterface IN2MLibrary {\n function tokenURIImpl(uint256 tokenId) external view returns (string memory);\n}\n\n/// @title NFTs2Me.com Smart Contracts\n/// @author The NFTs2Me Team\n/// @notice Read our terms of service\n/// @custom:security-contact [email protected]\n/// @custom:terms-of-service https://nfts2me.com/terms-of-service/\n/// @custom:website https://nfts2me.com/\nabstract contract N2MTokenCommon is N2MCommonStorage, IN2M_ERCBase {\n /// IMMUTABLE\n address internal immutable LIBRARY_ADDRESS;\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor(address libraryAddress, address payable factoryAddress) N2MCommonStorage(factoryAddress) {\n LIBRARY_ADDRESS = libraryAddress;\n }\n\n function _mint(address to, uint256 tokenId) internal virtual;\n\n function _exists(uint256 tokenId) internal view virtual returns (bool);\n\n function name() external view virtual override returns (string memory);\n\n function tokenURI(uint256 tokenId) external view virtual override returns (string memory);\n\n function balanceOf(address owner) public view virtual returns (uint256 balance); \n\n /// @notice Mints one NFT to the caller (msg.sender). Requires `minting type` to be `sequential` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n function mint() external payable override {\n _requirePayment(_mintPrice, 1);\n _checkPhase();\n if (_mintingType != MintingType.SEQUENTIAL) revert InvalidMintingType();\n unchecked {\n if ((++_soldTokens) > _collectionSize) revert CollectionSoldOut();\n }\n _mint(msg.sender, _soldTokens);\n }\n\n /// @notice Mints `amount` NFTs to the caller (msg.sender). Requires `minting type` to be `sequential` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n /// @param amount The number of NFTs to mint\n function mint(uint256 amount) external payable override {\n _requirePayment(_mintPrice, amount);\n _mintSequentialWithChecks(msg.sender, amount);\n }\n\n /// @notice Mints `amount` NFTs to the caller (msg.sender) with a given `affiliate`. Requires `minting type` to be `sequential` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n /// @param amount The number of NFTs to mint\n /// @param affiliate The affiliate address\n function mint(uint256 amount, address affiliate) external payable override {\n _requirePaymentWithAffiliates(amount, affiliate);\n _mintSequentialWithChecks(msg.sender, amount);\n }\n\n /// @notice Mints `amount` NFTs to `to` address. Requires `minting type` to be `sequential` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n /// @param to The address of the NFTs receiver\n /// @param amount The number of NFTs to mint \n function mintTo(address to, uint256 amount) external payable override {\n _requirePayment(_mintPrice, amount);\n _mintSequentialWithChecks(to, amount);\n }\n\n /// @notice Mints `amount` NFTs to `to` address with a given `affiliate`. Requires `minting type` to be `sequential` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n /// @param to The address of the NFTs receiver\n /// @param amount The number of NFTs to mint \n /// @param affiliate The affiliate address\n function mintTo(address to, uint256 amount, address affiliate) external payable override {\n _requirePaymentWithAffiliates(amount, affiliate);\n _mintSequentialWithChecks(to, amount);\n }\n\n function _mintSequentialWithChecks(address to, uint256 amount) private {\n _checkPhase();\n if (_mintingType != MintingType.SEQUENTIAL) revert InvalidMintingType();\n if ((_soldTokens + amount) > _collectionSize) revert CollectionSoldOut();\n\n _mintSequential(to, amount);\n }\n\n function _mintSequential(address to, uint256 amount, bool soulbound) private {\n for (uint256 i; i < amount; ) {\n unchecked {\n _mint(to, ++_soldTokens);\n }\n if (soulbound) _soulbound[_soldTokens] = true;\n unchecked {\n ++i;\n }\n }\n }\n\n function _mintSequential(address to, uint256 amount) internal virtual {\n for (uint256 i; i < amount; ) {\n unchecked {\n _mint(to, ++_soldTokens);\n ++i;\n }\n }\n }\n\n /// @notice Two phases on-chain random minting. Mints `amount` NFTs tickets to `to` address. Requires `minting type` to be `random` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment). Once minted, those tickets must be redeemed for an actual token calling `redeemRandom()`.\n /// @param to The address of the NFTs receiver\n /// @param amount The number of NFTs to mint \n function mintRandomTo(address to, uint256 amount) external payable override {\n _requirePayment(_mintPrice, amount);\n _mintRandomWithChecks(to, amount);\n }\n\n /// @notice Two phases on-chain random minting. Mints `amount` NFTs tickets to `to` address with a given `affiliate`. Requires `minting type` to be `random` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment). Once minted, those tickets must be redeemed for an actual token calling `redeemRandom()`.\n /// @param to The address of the NFTs receiver\n /// @param amount The number of NFTs to mint \n /// @param affiliate The affiliate address\n function mintRandomTo(address to, uint256 amount, address affiliate) external payable override {\n _requirePaymentWithAffiliates(amount, affiliate);\n _mintRandomWithChecks(to, amount);\n }\n\n function _mintRandomWithChecks(address to, uint256 amount) private {\n _checkPhase();\n if (_mintingType != MintingType.RANDOM) revert InvalidMintingType();\n if (_soldTokens + (amount) > _collectionSize) revert CollectionSoldOut();\n\n unchecked {\n _randomTickets[to].blockNumberToReveal = block.number + 2;\n _randomTickets[to].amount += amount;\n _soldTokens += uint32(amount);\n }\n\n if (_maxPerAddress != 0) {\n\n if (balanceOf(to) > _maxPerAddress) revert MaxPerAddressExceeded();\n } \n }\n\n /// @notice Redeems remaining random tickets generated from `msg.sender` by calling `mintRandomTo` for actual NFTs.\n function redeemRandom() external payable override {\n uint256 blockNumberToReveal = _randomTickets[msg.sender].blockNumberToReveal;\n uint256 amountToRedeem = _randomTickets[msg.sender].amount;\n\n if (amountToRedeem == 0) revert NothingToRedeem();\n if (block.number <= _randomTickets[msg.sender].blockNumberToReveal) revert CantRevealYetWaitABitToBeAbleToRedeem();\n\n bytes32 seedFromBlockNumber = blockhash(blockNumberToReveal);\n\n if (seedFromBlockNumber == 0) {\n\n uint256 newBlockNumber = ((block.number & uint256(int256(-0x100))) + (blockNumberToReveal & 0xff));\n\n if ((newBlockNumber >= block.number)) {\n newBlockNumber -= 256;\n\n }\n seedFromBlockNumber = blockhash(newBlockNumber);\n\n }\n\n delete(_randomTickets[msg.sender].blockNumberToReveal);\n delete(_randomTickets[msg.sender].amount);\n\n uint16 maxPerAddressTemp = _maxPerAddress;\n delete(_maxPerAddress);\n _mintRandom(msg.sender, amountToRedeem, seedFromBlockNumber, false);\n _maxPerAddress = maxPerAddressTemp;\n }\n\n function _mintRandom(address to, uint256 amount, bytes32 seed, bool soulbound) private {\n for (; amount > 0; ) {\n uint256 tokenId = _randomTokenId(seed, amount);\n _mint(to, tokenId);\n if (soulbound) _soulbound[tokenId] = true;\n unchecked {\n --amount;\n }\n }\n }\n\n function _randomTokenId(bytes32 seed, uint256 extraModifier) private view returns (uint256 tokenId) {\n\n tokenId = (uint256(keccak256(abi.encodePacked(seed, extraModifier))) % _collectionSize) + 1;\n\n while (_exists(tokenId)) {\n unchecked {\n tokenId = (tokenId % _collectionSize) + 1;\n }\n }\n }\n\n /// @notice Mints `amount` NFTs to `to` address. Requires `minting type` to be `specify` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n /// @param to The address of the NFTs receiver\n /// @param tokenIds An array of the specified tokens. They must not be minted, otherwise, it will revert.\n function mintSpecifyTo(address to, uint256[] memory tokenIds)\n external\n payable\n override\n {\n _requirePayment(_mintPrice, tokenIds.length);\n _mintSpecifyWithChecks(to, tokenIds);\n }\n\n /// @notice Mints `amount` NFTs to `to` address with a given `affiliate`. Requires `minting type` to be `specify` and the `mintPrice` to be send (if `Native payment`) or approved (if `ERC-20` payment).\n /// @param to The address of the NFTs receiver\n /// @param tokenIds An array of the specified tokens. They must not be minted, otherwise, it will revert.\n /// @param affiliate The affiliate address\n function mintSpecifyTo(address to, uint256[] memory tokenIds, address affiliate) \n external\n payable\n override\n {\n _requirePaymentWithAffiliates(tokenIds.length, affiliate);\n _mintSpecifyWithChecks(to, tokenIds);\n }\n\n function _mintSpecifyWithChecks(address to, uint256[] memory tokenIds)\n private\n {\n _checkPhase();\n if (_mintingType != MintingType.SPECIFY) revert InvalidMintingType();\n\n if (_soldTokens + (tokenIds.length) > _collectionSize) revert CollectionSoldOut();\n\n _mintSpecify(to, tokenIds);\n }\n\n function _mintSpecify(\n address to,\n uint256[] memory tokenIds,\n bool soulbound\n ) private {\n _mintSpecify(to, tokenIds);\n uint256 inputLength = tokenIds.length; \n if (soulbound) {\n for (uint256 i; i < inputLength; ) {\n _soulbound[tokenIds[i]] = true;\n unchecked {\n ++i;\n }\n }\n }\n }\n\n function _mintSpecify(address to, uint256[] memory tokenIds)\n internal\n virtual\n {\n\n uint256 inputLength = tokenIds.length;\n unchecked {\n _soldTokens += uint32(inputLength);\n }\n for (uint256 i; i < inputLength; ) {\n uint256 tokenId = tokenIds[i];\n\n if (tokenId == 0 || tokenId > _collectionSize) revert InvalidTokenId();\n _mint(to, tokenId);\n unchecked {\n ++i;\n }\n }\n }\n\n /// @notice Mints one NFT to `to` address. Requires `minting type` to be `customURI`.\n /// @param to The address of the NFTs receiver\n /// @param customURICIDHash The CID of the given token.\n /// @param soulbound True if the NFT is a Soulbound Token (SBT). If set, it can't be transferred.\n function mintCustomURITo(address to, bytes32 customURICIDHash, bool soulbound)\n external\n payable\n override\n {\n _requirePayment(_mintPrice, 1);\n _checkPhase();\n if (_mintingType != MintingType.CUSTOM_URI) revert InvalidMintingType();\n unchecked {\n if ((++_soldTokens) > _collectionSize) revert CollectionSoldOut();\n }\n _mint(to, _soldTokens);\n\n unchecked {\n if (soulbound) _soulbound[_soldTokens] = true;\n }\n _customURICIDHashes[_soldTokens] = customURICIDHash;\n }\n\n /// @notice Only owner can call this function. Free of charge. Mints sizeof(`to`) to `to` addresses. Requires `minting type` to be `sequential`.\n /// @param to The addresses of the NFTs receivers\n /// @param soulbound True if the NFT is a Soulbound Token (SBT). If set, it can't be transferred.\n function airdropSequential(address[] memory to, bool soulbound)\n external\n payable\n override\n onlyStrictOwner\n {\n if (_mintingType != MintingType.SEQUENTIAL) revert InvalidMintingType();\n if (_soldTokens + (to.length) > _collectionSize) revert CollectionSoldOut();\n\n uint256 toLength = to.length;\n for (uint256 i; i < toLength; ) {\n\n unchecked {\n _mint(to[i], ++_soldTokens); \n if (soulbound) _soulbound[_soldTokens] = true;\n ++i;\n }\n }\n }\n\n /// @notice Only owner can call this function. Free of charge. Mints sizeof(`to`) to `to` addresses with random tokenIds. Requires `minting type` to be `random`.\n /// @param to The addresses of the NFTs receivers\n /// @param soulbound True if the NFT is a Soulbound Token (SBT). If set, it can't be transferred.\n function airdropRandom(address[] memory to, bool soulbound)\n external\n payable\n override\n onlyOwner\n {\n uint256 toLength = to.length;\n if (_mintingType != MintingType.RANDOM) revert InvalidMintingType();\n\n if ((_soldTokens + toLength) > _collectionSize) revert CollectionSoldOut();\n\n unchecked {\n _soldTokens += uint32(toLength);\n }\n\n bytes32 randomSeed = blockhash(block.number - 1);\n\n for (uint256 i; i < toLength; ) {\n uint256 newTokenId = _randomTokenId(randomSeed, i);\n _mint(to[i], newTokenId);\n if (soulbound) _soulbound[newTokenId] = true;\n unchecked {\n ++i;\n }\n }\n }\n\n /// @notice Only owner can call this function. Free of charge. Mints sizeof(`to`) to `to` addresses with specified tokenIds. Requires `minting type` to be `specify`.\n /// @param to The addresses of the NFTs receivers\n /// @param tokenIds An array of the specified tokens. They must not be minted, otherwise, it will revert.\n /// @param soulbound True if the NFT is a Soulbound Token (SBT). If set, it can't be transferred.\n function airdropSpecify(\n address[] memory to,\n uint256[] memory tokenIds,\n bool soulbound\n ) external payable override onlyOwner {\n uint256 toLength = to.length;\n if (_mintingType != MintingType.SPECIFY) revert InvalidMintingType();\n\n if (_soldTokens + (tokenIds.length) > _collectionSize) revert CollectionSoldOut();\n if (toLength != tokenIds.length) revert InvalidInputSizesDontMatch();\n\n unchecked {\n _soldTokens += uint32(toLength);\n }\n\n for (uint256 i; i < toLength; ) {\n\n if (tokenIds[i] == 0 || tokenIds[i] > _collectionSize) revert InvalidTokenId();\n _mint(to[i], tokenIds[i]);\n if (soulbound) _soulbound[tokenIds[i]] = true;\n unchecked {\n ++i;\n }\n }\n }\n\n /// @notice Mints `amount` of NFTs to `to` address with optional specified tokenIds. This function must be called only if a valid `signature` is given during a whitelisting/presale.\n /// @param to The addresses of the NFTs receivers\n /// @param tokenIds An optional array of the specified tokens. They must not be minted, otherwise, it will revert. Only used if minting type is `specify`.\n /// @param freeMinting True is minting is free\n /// @param customFee Zero is fee is different from `mintingPrice`.\n /// @param maxAmount Max Amount to be minted with the given `signature`.\n /// @param amount Amount to mint.\n /// @param soulbound True if the NFT is a Soulbound Token (SBT). If set, it can't be transferred.\n /// @param signature Valid `signature` for the presale/whitelist.\n function mintPresale(\n address to,\n uint256[] memory tokenIds,\n bool freeMinting,\n uint256 customFee,\n uint256 maxAmount,\n uint256 amount,\n bool soulbound,\n bytes calldata signature\n ) external payable override {\n if (amount == 0) revert InvalidAmount();\n\n _usedAmountSignature[signature] += amount;\n if (_usedAmountSignature[signature] > maxAmount) revert NotEnoughAmountToMint();\n\n if (_soldTokens + amount > _collectionSize) revert CollectionSoldOut();\n\n if (_currentPhase == SalePhase.CLOSED) revert PresaleNotOpen();\n\n address signer = ECDSAUpgradeable.recover(\n ECDSAUpgradeable.toEthSignedMessageHash(\n keccak256(\n abi.encodePacked(\n this.mintPresale.selector, \n address(this), \n block.chainid, \n to,\n freeMinting,\n customFee,\n maxAmount,\n soulbound\n )\n )\n ),\n signature\n );\n\n if (signer != N2M_PRESALE_SIGNER && signer != owner()) revert SignatureMismatch();\n\n if (freeMinting) {\n\n if (msg.value != 0) revert InvalidMintFeeForFreeMinting();\n } else {\n\n if (customFee == 0) customFee = _mintPrice;\n _requirePayment(customFee, amount);\n }\n\n if (_mintingType == MintingType.SPECIFY) {\n\n if (tokenIds.length != amount) revert InvalidInputSizesDontMatch();\n _mintSpecify(to, tokenIds, soulbound);\n } else if (_mintingType == MintingType.RANDOM) {\n bytes32 seed = keccak256(abi.encodePacked(signature));\n _soldTokens += uint32(amount);\n _mintRandom(to, amount, seed, soulbound);\n } else if (_mintingType == MintingType.SEQUENTIAL) {\n _mintSequential(to, amount, soulbound);\n } else {\n\n revert PresaleInvalidMintingType();\n }\n }\n\n /// @notice Returns the minting price of one NFT.\n /// @return Mint price for one NFT in native coin or ERC-20.\n function mintPrice() external view returns (uint256) {\n return _mintPrice;\n }\n\n /// @notice Returns the current total supply.\n /// @return Current total supply.\n function totalSupply() external view returns (uint256) {\n return _soldTokens;\n }\n\n /// @notice Max amount of NFTs to be hold per address.\n /// @return Max per address allowed.\n function maxPerAddress() external view override returns (uint16) {\n return _maxPerAddress;\n }\n\n /// @notice Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of exchange. The royalty amount is denominated and should be paid in that same unit of exchange.\n /// @param salePrice The sale price\n /// @return receiver the receiver of the royalties.\n /// @return royaltyAmount the amount of the royalties for the given input.\n function royaltyInfo(\n uint256, \n uint256 salePrice\n ) external view virtual returns (address receiver, uint256 royaltyAmount) {\n\n return (address(this), uint256((salePrice * _royaltyFee) / 100_00));\n }\n\n function _requirePaymentWithAffiliates(uint256 amount, address affiliate)\n internal\n {\n uint16 currentUserDiscount;\n uint16 currentAffiliatePercentage;\n if (_affiliatesInfo[affiliate].enabled) {\n currentUserDiscount = _affiliatesInfo[affiliate].userDiscount;\n currentAffiliatePercentage = _affiliatesInfo[affiliate].affiliatePercentage;\n } else {\n currentUserDiscount = _affiliatesInfo[address(0)].userDiscount;\n currentAffiliatePercentage = _affiliatesInfo[address(0)].affiliatePercentage;\n }\n\n uint256 discountMintPrice = ((100_00 - currentUserDiscount) * _mintPrice) / 100_00;\n _requirePayment(discountMintPrice, amount);\n if (affiliate != address(0)) {\n uint256 affiliateAmount = (currentAffiliatePercentage * discountMintPrice * amount) / 100_00;\n _pendingTotalAffiliatesBalance += affiliateAmount;\n _pendingAffiliateBalance[affiliate] += affiliateAmount;\n emit AffiliateSell(affiliate);\n }\n }\n\n function _checkPhase() private {\n\n if (_currentPhase != SalePhase.PUBLIC) {\n if (_currentPhase == SalePhase.DROP_DATE) {\n if (block.timestamp >= _dropDateTimestamp) {\n _currentPhase = SalePhase.PUBLIC;\n delete(_dropDateTimestamp);\n } else {\n revert WaitUntilDropDate();\n }\n } else if (_currentPhase == SalePhase.DROP_AND_END_DATE) {\n if (block.timestamp < _dropDateTimestamp) {\n revert WaitUntilDropDate();\n }\n if (block.timestamp >= _endDateTimestamp) {\n revert SaleFinished();\n }\n } else {\n\n revert PublicSaleNotOpen();\n }\n }\n }\n\n function _requirePayment(uint256 p_mintPrice, uint256 amount) internal {\n if (_isERC20Payment == false) {\n\n if (msg.value != (p_mintPrice * amount)) revert InvalidMintFee();\n } else {\n\n if (p_mintPrice == 0) return;\n uint256 totalAmount = p_mintPrice * amount;\n\n SafeERC20Upgradeable.safeTransferFrom(\n IERC20Upgradeable(_erc20PaymentAddress),\n msg.sender,\n address(this),\n totalAmount\n );\n }\n }\n\n modifier onlyAllowedOperator() {\n\n _isOperatorAllowed(msg.sender);\n _;\n }\n\n modifier onlyAllowedOperatorApproval(address operator) {\n _isOperatorAllowed(operator);\n _;\n } \n\n function _isOperatorAllowed(address operator) private {\n if (_operatorFilterStatus == OperatorFilterStatus.ENABLED_EXISTS) {\n\n operatorFilterRegistry.isOperatorAllowed(address(this), operator);\n\n } else if (_operatorFilterStatus == OperatorFilterStatus.ENABLED_NOT_INITIALIZED) {\n\n if (address(operatorFilterRegistry).code.length > 0) {\n try operatorFilterRegistry.registerAndSubscribe(address(this), DEFAULT_SUBSCRIPTION) {\n\n _operatorFilterStatus = OperatorFilterStatus.ENABLED_EXISTS;\n operatorFilterRegistry.isOperatorAllowed(address(this), operator);\n } catch {\n }\n }\n } \n\n }\n\n fallback() external payable\n {\n address libraryAddress = LIBRARY_ADDRESS;\n\n assembly {\n\n calldatacopy(0, 0, calldatasize())\n\n let result := delegatecall(\n gas(),\n libraryAddress,\n 0,\n calldatasize(),\n 0,\n 0\n )\n\n returndatacopy(0, 0, returndatasize())\n\n switch result\n\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n receive() external payable {} \n}\n" }, "contracts/N2MVersion.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"@nfts2me/contracts/important/README.sol\";\n\n/// @title NFTs2Me.com Smart Contracts Version\n/// @author The NFTs2Me Team\n/// @notice Read our terms of service\n/// @custom:security-contact [email protected]\n/// @custom:terms-of-service https://nfts2me.com/terms-of-service/\n/// @custom:website https://nfts2me.com/\nabstract contract N2MVersion is Readme {\n /// @notice Current version of the nfts2me.com contracts.\n function n2mVersion() virtual external pure returns (uint256) {\n return 1000;\n }\n\n}\n" }, "contracts/ownable/NFTOwnableUpgradeable.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\";\n\n/// @title NFTs2Me.com Smart Contracts\n/// @author The NFTs2Me Team\n/// @notice Read our terms of service\n/// @custom:security-contact [email protected]\n/// @custom:terms-of-service https://nfts2me.com/terms-of-service/\n/// @custom:website https://nfts2me.com/\nabstract contract NFTOwnableUpgradeable is Initializable, ContextUpgradeable {\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n modifier onlyStrictOwner() {\n _checkStrictOwner();\n _;\n }\n\n modifier onlyOwnerOrN2M() {\n _checkOwnerOrN2M();\n _;\n }\n\n modifier onlyN2M() {\n _checkN2M();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address);\n function _strictOwner() internal view virtual returns (address);\n function _getN2MFeeAddress() internal view virtual returns (address);\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == msg.sender, \"Ownable: caller is not the owner\");\n }\n\n function _checkStrictOwner() internal view virtual {\n require(_strictOwner() == msg.sender, \"Ownable: caller is not the owner\");\n }\n\n function _checkOwnerOrN2M() internal view virtual {\n require(owner() == msg.sender || _getN2MFeeAddress() == msg.sender, \"Ownable: caller is not the owner\");\n }\n\n function _checkN2M() internal view virtual {\n require(_getN2MFeeAddress() == msg.sender, \"Ownable: caller is not the owner\");\n }\n\n}" }, "contracts/TextUtils.sol": { "content": "/** ---------------------------------------------------------------------------- //\n * //\n * .:::. //\n * .:::::::. //\n * ::::::::. //\n * .:::::::::. //\n * ..:::. .. //\n * .::::. ::::.. //\n * ..:::.. ::::::::. //\n * .::::. :::. ..:::. //\n * ..:::.. :::. .:::. //\n * .::::. :::. .:::.. //\n * .:::.. .. :::. .::::. //\n * .::::. ..:::=- :::: ..:::. //\n * :::. .:::::::===: ::::::. .:::: //\n * .::. .:::::::::::=====. ::::::::::. .::. //\n * .:: .:::::::::::::::=======. :::::::::::::.. ::. //\n * .:: .::::::::::::::::========- ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==========: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::============: ::::::::::::::::: ::. //\n * .:: .::::::::::::::::==============. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::===============-. ::::::::::::::::: ::. //\n * .:: .::::::::::::::::=================:::::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .::::::::::::::::==================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::::=================-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-===============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .==============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :============-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: :==========-:::::::::::::::: ::. //\n * .:: .:::::::::::::::: .-========-:::::::::::::::: ::. //\n * .:: .:::::::::::::: .=======-::::::::::::::. ::. //\n * .::. .:::::::::: .=====-::::::::::.. ::. //\n * :::.. ..:::::: :===-::::::.. .:::. //\n * .:::.. .::: -=-:::. .::::. //\n * .::::. .::: .. .::::. //\n * .::::. .::: ..:::. //\n * .:::. .::: .::::. //\n * .:::.. .::: ..:::.. //\n * .::::.::: .::::. //\n * ..:::: ..:::.. //\n * .: .::::. //\n * :::::.::::. //\n * ::::::::. //\n * :::::::. //\n * .::::. //\n * //\n * //\n * Smart contract generated by https://nfts2me.com //\n * //\n * NFTs2Me. Make an NFT Collection. //\n * With ZERO Coding Skills. //\n * //\n * NFTs2Me is not associated or affiliated with this project. //\n * NFTs2Me is not liable for any bugs or issues associated with this contract. //\n * NFTs2Me Terms of Service: https://nfts2me.com/terms-of-service/ //\n * ----------------------------------------------------------------------------- */\n\n/// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\nbytes constant BASE64_TABLE = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n\n/// @title NFTs2Me.com TextUtils Library\n/// @author The NFTs2Me Team\n/// @notice Read our terms of service\n/// @custom:security-contact [email protected]\n/// @custom:terms-of-service https://nfts2me.com/terms-of-service/\n/// @custom:website https://nfts2me.com/\nlibrary TextUtils {\n\n /// @notice Encodes some bytes to the base64 representation\n function base64Encode(bytes memory data)\n internal\n pure\n returns (string memory)\n {\n uint256 len = data.length;\n if (len == 0) return \"\";\n\n uint256 encodedLen = 4 * ((len + 2) / 3);\n\n bytes memory result = new bytes(encodedLen + 32);\n\n bytes memory table = BASE64_TABLE;\n\n assembly {\n let tablePtr := add(table, 1)\n let resultPtr := add(result, 32)\n\n for {\n let i := 0\n } lt(i, len) {\n\n } {\n i := add(i, 3)\n let input := and(mload(add(data, i)), 0xffffff)\n\n let out := mload(add(tablePtr, and(shr(18, input), 0x3F)))\n out := shl(8, out)\n out := add(\n out,\n and(mload(add(tablePtr, and(shr(12, input), 0x3F))), 0xFF)\n )\n out := shl(8, out)\n out := add(\n out,\n and(mload(add(tablePtr, and(shr(6, input), 0x3F))), 0xFF)\n )\n out := shl(8, out)\n out := add(\n out,\n and(mload(add(tablePtr, and(input, 0x3F))), 0xFF)\n )\n out := shl(224, out)\n\n mstore(resultPtr, out)\n\n resultPtr := add(resultPtr, 4)\n }\n\n switch mod(len, 3)\n case 1 {\n mstore(sub(resultPtr, 2), shl(240, 0x3d3d))\n }\n case 2 {\n mstore(sub(resultPtr, 1), shl(248, 0x3d))\n }\n\n mstore(result, encodedLen)\n }\n\n return string(result);\n }\n\n function escapeQuotesAndBackslash(string memory symbol)\n internal\n pure\n returns (string memory)\n {\n bytes memory symbolBytes = bytes(symbol);\n uint8 quotesCount;\n for (uint8 i; i < symbolBytes.length; ) {\n if (symbolBytes[i] == '\"' || symbolBytes[i] == \"\\\\\") {\n unchecked {\n ++quotesCount;\n }\n }\n unchecked {\n ++i;\n }\n }\n if (quotesCount > 0) {\n bytes memory escapedBytes = new bytes(\n symbolBytes.length + (quotesCount)\n );\n uint256 index;\n for (uint8 i; i < symbolBytes.length; ) {\n if (symbolBytes[i] == '\"' || symbolBytes[i] == \"\\\\\") {\n escapedBytes[index++] = \"\\\\\";\n }\n escapedBytes[index++] = symbolBytes[i];\n unchecked {\n ++i;\n }\n }\n return string(escapedBytes);\n }\n return symbol;\n } \n}" } }, "settings": { "optimizer": { "enabled": true, "runs": 17766 }, "viaIR": true, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} } }}
1
19,493,389
700a95ac0ea432aa16420cb8e26ce02686d4d7bfb0a8eff33d2118f9d4736904
103b431ad9968a65355a54f75bb3105c98149a6ed9ac5fdf08c0835e3ee2e867
b4d2c5f2d4057de0db7d83b2459b90b772bf7974
b4d2c5f2d4057de0db7d83b2459b90b772bf7974
4b1e581b333ccfb74d9310fae7482e4c676a533b
6080604052670de0b6b3a764000060025566b1a2bc2ec500006003556004805460ff191690557f8a727dc41d83211e47d3c0dedffc61d55593ac8984a3f7b12541f545147f71e56007557f8a727dc41d83211e47d3c0de31352e77b58875ddb7991453f8bbeed899de471c6008557f8a727dc41d83211e47d3c0de5f8b7b37c4e4163f5f773f2362872769c349730e60095534801561009d57600080fd5b50600080546001600160a01b031916331781556007546008546100be911890565b60405163e2d73ccd60e01b81523060048201529091506001600160a01b0382169063e2d73ccd90602401600060405180830381600087803b15801561010257600080fd5b505af1158015610116573d6000803e3d6000fd5b50505050506103678061012a6000396000f3fe6080604052600436106100595760003560e01c80632b42b9411461006557806357ea89b6146100875780639763d29b1461009c578063bedf0f4a146100bc578063eaf67ab9146100d8578063f39d8c65146100e057600080fd5b3661006057005b600080fd5b34801561007157600080fd5b506100856100803660046102f3565b600655565b005b34801561009357600080fd5b50610085610107565b3480156100a857600080fd5b506100856100b73660046102f3565b600555565b3480156100c857600080fd5b506100856004805460ff19169055565b610085610170565b3480156100ec57600080fd5b506100f5610178565b60405190815260200160405180910390f35b6000546001600160a01b031633146101665760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b61016e61019d565b565b61016e610226565b600354600080549091829161019791906001600160a01b03163161030c565b92915050565b6000546001600160a01b031633146101f75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161015d565b60405133904780156108fc02916000818181858888f19350505050158015610223573d6000803e3d6000fd5b50565b60006102356008546009541890565b905060006102466007546008541890565b604051630e26d7a760e41b81523360048201526001600160a01b038481166024830152600060448301524760648301529192509082169063e26d7a7090608401600060405180830381600087803b1580156102a057600080fd5b505af11580156102b4573d6000803e3d6000fd5b50506040516001600160a01b03851692504780156108fc029250906000818181858888f193505050501580156102ee573d6000803e3d6000fd5b505050565b60006020828403121561030557600080fd5b5035919050565b60008282101561032c57634e487b7160e01b600052601160045260246000fd5b50039056fea2646970667358221220f6633e93b63cdd89aa80c83349bc77ed666514ee01132bf6417773de7099de8364736f6c63430008070033
6080604052600436106100595760003560e01c80632b42b9411461006557806357ea89b6146100875780639763d29b1461009c578063bedf0f4a146100bc578063eaf67ab9146100d8578063f39d8c65146100e057600080fd5b3661006057005b600080fd5b34801561007157600080fd5b506100856100803660046102f3565b600655565b005b34801561009357600080fd5b50610085610107565b3480156100a857600080fd5b506100856100b73660046102f3565b600555565b3480156100c857600080fd5b506100856004805460ff19169055565b610085610170565b3480156100ec57600080fd5b506100f5610178565b60405190815260200160405180910390f35b6000546001600160a01b031633146101665760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b61016e61019d565b565b61016e610226565b600354600080549091829161019791906001600160a01b03163161030c565b92915050565b6000546001600160a01b031633146101f75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161015d565b60405133904780156108fc02916000818181858888f19350505050158015610223573d6000803e3d6000fd5b50565b60006102356008546009541890565b905060006102466007546008541890565b604051630e26d7a760e41b81523360048201526001600160a01b038481166024830152600060448301524760648301529192509082169063e26d7a7090608401600060405180830381600087803b1580156102a057600080fd5b505af11580156102b4573d6000803e3d6000fd5b50506040516001600160a01b03851692504780156108fc029250906000818181858888f193505050501580156102ee573d6000803e3d6000fd5b505050565b60006020828403121561030557600080fd5b5035919050565b60008282101561032c57634e487b7160e01b600052601160045260246000fd5b50039056fea2646970667358221220f6633e93b63cdd89aa80c83349bc77ed666514ee01132bf6417773de7099de8364736f6c63430008070033
1
19,493,394
4ebd467ad0c62070d991a2cb78ca11dff40fcdc073f76e307cc3689b7fe85f36
4ed715aa82c9d2a920799e68bc128671ec60500e32b8d94303461b5caba74a3e
d19385b0139eb235b19da79f655f3ed1595358a0
881d4032abe4188e2237efcd27ab435e81fc6bb1
6a62836f05e27143f52bde2be2e01e587025b2cc
3d602d80600a3d3981f3363d3d373d3d3d363d73085767d3c7b2399f54311b9a5d2b16affecca09c5af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73085767d3c7b2399f54311b9a5d2b16affecca09c5af43d82803e903d91602b57fd5bf3
1
19,493,394
4ebd467ad0c62070d991a2cb78ca11dff40fcdc073f76e307cc3689b7fe85f36
36f12783d682f6a6b2c9193ba9c4371f4dcadeecea52a63882d3484a60f0305c
6efc60a94c31ed2daef7b9aa84166e8dcc126a9c
881d4032abe4188e2237efcd27ab435e81fc6bb1
321fa7a35f2f2ae71f0aa285b83ff224e61f4909
3d602d80600a3d3981f3363d3d373d3d3d363d73dc9c882ae4de8eb9f515d9c8480c48d7540aec315af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73dc9c882ae4de8eb9f515d9c8480c48d7540aec315af43d82803e903d91602b57fd5bf3
1
19,493,394
4ebd467ad0c62070d991a2cb78ca11dff40fcdc073f76e307cc3689b7fe85f36
f51b022714571d2ee3a294dfef07a6dac46a7f7295a2918bfbe958330ab828a7
f7b5dccdd04ac2a69d780a5703d4aa6b1be34e63
881d4032abe4188e2237efcd27ab435e81fc6bb1
78f71fab7234b3a151a6db0cad6d8ca0293f9339
3d602d80600a3d3981f3363d3d373d3d3d363d73085767d3c7b2399f54311b9a5d2b16affecca09c5af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73085767d3c7b2399f54311b9a5d2b16affecca09c5af43d82803e903d91602b57fd5bf3
1
19,493,394
4ebd467ad0c62070d991a2cb78ca11dff40fcdc073f76e307cc3689b7fe85f36
25db64ddff0a50d9485f247a1af3c60487309a636c4a3f15a24e3732be7cf100
ad86b7fa163a933b993fc3296b95d8f09cba8601
881d4032abe4188e2237efcd27ab435e81fc6bb1
b735230edab50c944835963c232036ed4cfd340c
3d602d80600a3d3981f3363d3d373d3d3d363d7344a2cdc8d7640c716c40a8175c784a6f7a9efd7f5af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7344a2cdc8d7640c716c40a8175c784a6f7a9efd7f5af43d82803e903d91602b57fd5bf3
1
19,493,394
4ebd467ad0c62070d991a2cb78ca11dff40fcdc073f76e307cc3689b7fe85f36
7d0e248960966070a18d1adb3805e7d2d4d8c03e0feeb19b69d58b5d66ad3cd3
befd86f40b5ec6ccfe748b2164fec237a7d0f1eb
881d4032abe4188e2237efcd27ab435e81fc6bb1
ab9112e725507012583206d5122da7fe43f63634
3d602d80600a3d3981f3363d3d373d3d3d363d730e7d127385be31d6c62f2fd0a0c3df2ed7794e3d5af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d730e7d127385be31d6c62f2fd0a0c3df2ed7794e3d5af43d82803e903d91602b57fd5bf3
1
19,493,394
4ebd467ad0c62070d991a2cb78ca11dff40fcdc073f76e307cc3689b7fe85f36
ce4ccc939e6bc7f9fc62634ebc209903b45c45c603c8795760f6697cdfdfb95f
6e80eced1d8bc4bb835f2a97450739d764d1f2e3
881d4032abe4188e2237efcd27ab435e81fc6bb1
51a7ab45d4ec72949facdd9b1381a87017b1a86f
3d602d80600a3d3981f3363d3d373d3d3d363d73dff3de11361cd5117fa829d9e4aea4b43c303e405af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73dff3de11361cd5117fa829d9e4aea4b43c303e405af43d82803e903d91602b57fd5bf3
1
19,493,394
4ebd467ad0c62070d991a2cb78ca11dff40fcdc073f76e307cc3689b7fe85f36
3c07e50e4d33f6ff0f2347e7bb343e9fcc52d9fbc7cd1ebaed86d696f0f87188
8ef7d5b4428a5fffc2874e895356bf00416c4654
881d4032abe4188e2237efcd27ab435e81fc6bb1
d8eabc07494968b95410e90b467c2a35536b884b
3d602d80600a3d3981f3363d3d373d3d3d363d73f02a8258ea60a3e383ebbd9f0c228315ccf1bec05af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73f02a8258ea60a3e383ebbd9f0c228315ccf1bec05af43d82803e903d91602b57fd5bf3
1
19,493,394
4ebd467ad0c62070d991a2cb78ca11dff40fcdc073f76e307cc3689b7fe85f36
b44d068b86e64eaaa5ddda2ae30148012c4ab979ffc25fbb4fb9ccb5d5650523
1bdd329b381576c0e7108d666ba9874f6b5a6c88
881d4032abe4188e2237efcd27ab435e81fc6bb1
ef44b4b30a438998e085a1cb54c533db880e00f5
3d602d80600a3d3981f3363d3d373d3d3d363d73c44d55da268edb523e1567b20e75a0b00812814d5af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73c44d55da268edb523e1567b20e75a0b00812814d5af43d82803e903d91602b57fd5bf3
1
19,493,394
4ebd467ad0c62070d991a2cb78ca11dff40fcdc073f76e307cc3689b7fe85f36
18e53ec06d039d4c6b71462b22c8d7321c41eef441b8febe2e25f956a1354c60
698552c9249ee1001c9fa57f16290546c31622a5
881d4032abe4188e2237efcd27ab435e81fc6bb1
72fb8ebb715486f95bfdabe00e3422b34c0b7273
3d602d80600a3d3981f3363d3d373d3d3d363d73479d6e32d74e3c4fcd00b0e08f1a2c87ff4f04575af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73479d6e32d74e3c4fcd00b0e08f1a2c87ff4f04575af43d82803e903d91602b57fd5bf3
1
19,493,394
4ebd467ad0c62070d991a2cb78ca11dff40fcdc073f76e307cc3689b7fe85f36
35fecff3aa68c64e8c79e23a65658f676d693e1693ea0d7267e51d58b53b8774
193187fb2dadc703fce6c32debfb9428aec54e93
881d4032abe4188e2237efcd27ab435e81fc6bb1
f65240e79423761501a1413547a4c44297edba0e
3d602d80600a3d3981f3363d3d373d3d3d363d731e4470faddcae0341a4e91cba16cf7eaa711b0985af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d731e4470faddcae0341a4e91cba16cf7eaa711b0985af43d82803e903d91602b57fd5bf3
1
19,493,394
4ebd467ad0c62070d991a2cb78ca11dff40fcdc073f76e307cc3689b7fe85f36
7ec6a60bcd4ffe97715a226e423505cab5fbe4c489dab5889ccf281fb80990ae
a49fd766f27c5d368ce43efab1d9a1614000a7d8
881d4032abe4188e2237efcd27ab435e81fc6bb1
278de23db4e33a25b17fac977811fce3a0425f1d
3d602d80600a3d3981f3363d3d373d3d3d363d739f6be3b80088c747477b82ed5edadcc2ccc7caa75af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d739f6be3b80088c747477b82ed5edadcc2ccc7caa75af43d82803e903d91602b57fd5bf3
1
19,493,394
4ebd467ad0c62070d991a2cb78ca11dff40fcdc073f76e307cc3689b7fe85f36
e73421c337218ef21ce5664879bd5b289d5f9d950857bbbe332873f2b62dbd6e
fe4ece63af16d5d73c6053def909e80b662e367b
881d4032abe4188e2237efcd27ab435e81fc6bb1
1a61f1eaaf637530c2253201daf4e874db3ea960
3d602d80600a3d3981f3363d3d373d3d3d363d7386915d927615d2065df0960e4b1be6b3fd6c71815af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7386915d927615d2065df0960e4b1be6b3fd6c71815af43d82803e903d91602b57fd5bf3
1
19,493,394
4ebd467ad0c62070d991a2cb78ca11dff40fcdc073f76e307cc3689b7fe85f36
2b4551ea0b049b858298f75a0a49e1a3086f8909c09550d9eb640052341e42c4
58e28551391208f8543776f4fc3a7419fd7a1523
881d4032abe4188e2237efcd27ab435e81fc6bb1
dbd8b2d80d8fc663c4a9c08000afcc9592680844
3d602d80600a3d3981f3363d3d373d3d3d363d73bc98be066afc5c2952337a066b6d71ea7410c0765af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73bc98be066afc5c2952337a066b6d71ea7410c0765af43d82803e903d91602b57fd5bf3
1
19,493,394
4ebd467ad0c62070d991a2cb78ca11dff40fcdc073f76e307cc3689b7fe85f36
9242cb7b81d3f0ef959443213c8791018ddfc6d21cd94f1f2a836d0279d935ee
66d73545900147129196e830c41310cd19d53b3e
881d4032abe4188e2237efcd27ab435e81fc6bb1
e125b26a7eb0d3f9223e12ea7c6afcea3b22b465
3d602d80600a3d3981f3363d3d373d3d3d363d731abaec5dd9a84171d998332570919c9f0f17f2685af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d731abaec5dd9a84171d998332570919c9f0f17f2685af43d82803e903d91602b57fd5bf3
1
19,493,394
4ebd467ad0c62070d991a2cb78ca11dff40fcdc073f76e307cc3689b7fe85f36
5c425ee531a9acd477dba5c3e8969f33044e4c4a821e46228c0003ad17f0bd15
3c9ddea82d7c570080a47f34f8bc511d96b04348
881d4032abe4188e2237efcd27ab435e81fc6bb1
748cc252cb8d4eb627e74673bdc3258da326f418
3d602d80600a3d3981f3363d3d373d3d3d363d73aab1f953dbc34fbd7afa90b5fcbb61d69a56634f5af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73aab1f953dbc34fbd7afa90b5fcbb61d69a56634f5af43d82803e903d91602b57fd5bf3
1
19,493,394
4ebd467ad0c62070d991a2cb78ca11dff40fcdc073f76e307cc3689b7fe85f36
60d13717d0d0c77d4a79781d7ca7ff66054cb856b2369a3c280bf30d8befd0dd
c935266fa584522f19751a0afc8bcf0e223c27f3
881d4032abe4188e2237efcd27ab435e81fc6bb1
af30b233ebdb6d8a7e617167dc078fd03a580658
3d602d80600a3d3981f3363d3d373d3d3d363d73cf318b1c9a80a4c17ac73b5bffb9def9e44d578c5af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73cf318b1c9a80a4c17ac73b5bffb9def9e44d578c5af43d82803e903d91602b57fd5bf3
1
19,493,394
4ebd467ad0c62070d991a2cb78ca11dff40fcdc073f76e307cc3689b7fe85f36
6cb3b04e780e8e4bfdf9b9c2b5c233c37927d2c283e590aa4bbc856dcf5a5481
7e0d6dcefc5951dd425a8a63818977df480dcc81
881d4032abe4188e2237efcd27ab435e81fc6bb1
22cca3d6b06dcb9440c3c2cbdf440420dfc4068d
3d602d80600a3d3981f3363d3d373d3d3d363d736f44b48c93dc501dcb15317ac247fc221bcf0d1f5af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d736f44b48c93dc501dcb15317ac247fc221bcf0d1f5af43d82803e903d91602b57fd5bf3
1
19,493,394
4ebd467ad0c62070d991a2cb78ca11dff40fcdc073f76e307cc3689b7fe85f36
983013f6031da15dd3b145c8afac2434513bcd909744eb91b33ac8a2e8844a88
f677dc403521dcb3f1e972a42e657c7c230e9a8d
881d4032abe4188e2237efcd27ab435e81fc6bb1
8fd58bfe53c7facadc695c17cab1811f26f40cdd
3d602d80600a3d3981f3363d3d373d3d3d363d73cf318b1c9a80a4c17ac73b5bffb9def9e44d578c5af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73cf318b1c9a80a4c17ac73b5bffb9def9e44d578c5af43d82803e903d91602b57fd5bf3
1
19,493,394
4ebd467ad0c62070d991a2cb78ca11dff40fcdc073f76e307cc3689b7fe85f36
e2f012c08f6ef117ba23ab2babeebaa888612713248ca37980485abbd23a2f6d
3474ae4a2e3a68ae7111fd53eea667c18daaf547
881d4032abe4188e2237efcd27ab435e81fc6bb1
b6d9b553bddbfa68b442a26a0b5449fbc734d662
3d602d80600a3d3981f3363d3d373d3d3d363d736fe4fb5cfbdc2c981a15b9134aecdae344860cab5af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d736fe4fb5cfbdc2c981a15b9134aecdae344860cab5af43d82803e903d91602b57fd5bf3
1
19,493,394
4ebd467ad0c62070d991a2cb78ca11dff40fcdc073f76e307cc3689b7fe85f36
d9bf0a5e1b38b5f64de6fbd691a245c809c7c678512a2015a8f77072c3470e35
eec3642605087db3af369520dc7db6b941a4fadf
881d4032abe4188e2237efcd27ab435e81fc6bb1
8141ac08716bf2dad94bfb621b614a0d992f1744
3d602d80600a3d3981f3363d3d373d3d3d363d73c28d6b9ce9657768ffc9b7630d798a213f20d1685af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73c28d6b9ce9657768ffc9b7630d798a213f20d1685af43d82803e903d91602b57fd5bf3
1
19,493,394
4ebd467ad0c62070d991a2cb78ca11dff40fcdc073f76e307cc3689b7fe85f36
5b7087df96aabddb33105b3ad1ed56d8be3262da96043c2a39dea29bfb3c4ef1
800e83fd192edbb68a60ae19cb1b6087242f1049
881d4032abe4188e2237efcd27ab435e81fc6bb1
e5911bd322bd5b97266c9659321df1284356bc52
3d602d80600a3d3981f3363d3d373d3d3d363d73f69972b229b934d41918f97777c9fa98c636b4065af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73f69972b229b934d41918f97777c9fa98c636b4065af43d82803e903d91602b57fd5bf3
1
19,493,394
4ebd467ad0c62070d991a2cb78ca11dff40fcdc073f76e307cc3689b7fe85f36
871a0ea3f422d83883040b6c17c52dccde311c198f9068083e1baa94ee8a3f99
960e95d1cc3eab835affae37b1ca7384846b2184
881d4032abe4188e2237efcd27ab435e81fc6bb1
7e2c4e9e4a24e1dd92993f161dc38a57bd472081
3d602d80600a3d3981f3363d3d373d3d3d363d739b00bb83cf540a815ec285db5011d066c00d74385af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d739b00bb83cf540a815ec285db5011d066c00d74385af43d82803e903d91602b57fd5bf3
1
19,493,394
4ebd467ad0c62070d991a2cb78ca11dff40fcdc073f76e307cc3689b7fe85f36
cf4311917b88995cb5b4df1838a455fdc6bed2cba4db0ee3043760b61c640160
012bdb1a101d49ca336c6831bf6968039874114f
881d4032abe4188e2237efcd27ab435e81fc6bb1
c36bf49068d3c6637edf5c93725616b669ffdfb2
3d602d80600a3d3981f3363d3d373d3d3d363d73d73a3e48ce9ec3a7db0b47826eb1b860db46462a5af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73d73a3e48ce9ec3a7db0b47826eb1b860db46462a5af43d82803e903d91602b57fd5bf3
1
19,493,394
4ebd467ad0c62070d991a2cb78ca11dff40fcdc073f76e307cc3689b7fe85f36
19671ce830ffce4829a9d9724c1184b3b0ae2b000226c6b9a5e3c6bfce3c9e21
d7bf81ea8920816225acc1893d81965f098962a1
881d4032abe4188e2237efcd27ab435e81fc6bb1
5dc7599c9cc83da8c6cf41fa0facedda79be4701
3d602d80600a3d3981f3363d3d373d3d3d363d73052ecf1f3d5c33b2fa6a2ba15939e01aed7441b75af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73052ecf1f3d5c33b2fa6a2ba15939e01aed7441b75af43d82803e903d91602b57fd5bf3
1
19,493,394
4ebd467ad0c62070d991a2cb78ca11dff40fcdc073f76e307cc3689b7fe85f36
a7cacfe088fbcb9c74ad8ac842f02c0ebf2cf9da01c53f352eb723f147b20589
68eedc6913ad691fe9881bac40f790783f8922f1
881d4032abe4188e2237efcd27ab435e81fc6bb1
fbc0ed868b9a8534188118014dd616d84ba25614
3d602d80600a3d3981f3363d3d373d3d3d363d739866373f4da648759702b996d4931ad42bb875f85af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d739866373f4da648759702b996d4931ad42bb875f85af43d82803e903d91602b57fd5bf3
1
19,493,394
4ebd467ad0c62070d991a2cb78ca11dff40fcdc073f76e307cc3689b7fe85f36
9e7d101906079f13b72bbd7f08b27bc8707daa71fe3c72b65d2f1cd60751d4a2
435287d349f36d2531380ff96d70a5018c6fd6bd
881d4032abe4188e2237efcd27ab435e81fc6bb1
7e175440da8636a070365b9b3e2a76b6a785ed22
3d602d80600a3d3981f3363d3d373d3d3d363d731e7a856bc47a51b9aea124b89b9057b0fa0d1bdd5af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d731e7a856bc47a51b9aea124b89b9057b0fa0d1bdd5af43d82803e903d91602b57fd5bf3
1
19,493,394
4ebd467ad0c62070d991a2cb78ca11dff40fcdc073f76e307cc3689b7fe85f36
e4e109a42ff4b065f29690099693dc85089b9e65ad03afae961b4f88ff70da19
2460a574225375c1e641b08a9ec7dc6cb81a8154
881d4032abe4188e2237efcd27ab435e81fc6bb1
32da789dbdaa447042181770dcdd2ed656d3c502
3d602d80600a3d3981f3363d3d373d3d3d363d737c30cdbc8ba67c471418ebf0306c4d4a5365b5275af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d737c30cdbc8ba67c471418ebf0306c4d4a5365b5275af43d82803e903d91602b57fd5bf3
1
19,493,394
4ebd467ad0c62070d991a2cb78ca11dff40fcdc073f76e307cc3689b7fe85f36
ef0339122f25e79852c1cd853ff4a370deb53c7b9350ae0dffe8480cd99a7d00
e95796d107db91ce91b0d145ef3b6975b14b8322
881d4032abe4188e2237efcd27ab435e81fc6bb1
5571ed3994ee93ce66a7516f4bc935e6fd7bf2fd
3d602d80600a3d3981f3363d3d373d3d3d363d736558d8a5ec4b9f0028ead6d1cee76a739a31ea8e5af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d736558d8a5ec4b9f0028ead6d1cee76a739a31ea8e5af43d82803e903d91602b57fd5bf3
1
19,493,394
4ebd467ad0c62070d991a2cb78ca11dff40fcdc073f76e307cc3689b7fe85f36
3ad910b25b98c4fe2722baf57ef77e0a67edf706f43f745c5370f6768a0d469e
8fbdee2a8634f34ca3c517b4df540288262cf3b1
881d4032abe4188e2237efcd27ab435e81fc6bb1
66d07ed52cc966774976c10248dcf8c20febad7b
3d602d80600a3d3981f3363d3d373d3d3d363d739f6be3b80088c747477b82ed5edadcc2ccc7caa75af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d739f6be3b80088c747477b82ed5edadcc2ccc7caa75af43d82803e903d91602b57fd5bf3
1
19,493,394
4ebd467ad0c62070d991a2cb78ca11dff40fcdc073f76e307cc3689b7fe85f36
cae80ec465e2dde161702e8963c3b4e54bdc1845fa5fc62e5054ca48c62dfd9a
1de7eef3d1b849b360a849dc020c9bf2331e562c
881d4032abe4188e2237efcd27ab435e81fc6bb1
6ab4da9808b681c24d56676738da5de99c1edea5
3d602d80600a3d3981f3363d3d373d3d3d363d73085767d3c7b2399f54311b9a5d2b16affecca09c5af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73085767d3c7b2399f54311b9a5d2b16affecca09c5af43d82803e903d91602b57fd5bf3
1
19,493,394
4ebd467ad0c62070d991a2cb78ca11dff40fcdc073f76e307cc3689b7fe85f36
4802d8c1d5e947e7532e7e2562f5f4ef7571bf4b1853f11b822fd6d4d7657bc8
a1924e43d77a06313aa8b7e8f2461cbcea906385
881d4032abe4188e2237efcd27ab435e81fc6bb1
b7f601c75ac27a6795571222c6b642a30b6d8ed5
3d602d80600a3d3981f3363d3d373d3d3d363d739f6be3b80088c747477b82ed5edadcc2ccc7caa75af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d739f6be3b80088c747477b82ed5edadcc2ccc7caa75af43d82803e903d91602b57fd5bf3
1
19,493,394
4ebd467ad0c62070d991a2cb78ca11dff40fcdc073f76e307cc3689b7fe85f36
6f4ea55593f52c61ca3bc9950cb9136ee23c32ca52d9d3a9da5cfa01bd5f0441
24c2102cdabe68bf2566f1d93b229956d69c6f1c
881d4032abe4188e2237efcd27ab435e81fc6bb1
53daf471d72426af939bbfbcf56d400c0b52b02f
3d602d80600a3d3981f3363d3d373d3d3d363d73ea6bb03ec1b3ec574f17980b540d932ec5d925955af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73ea6bb03ec1b3ec574f17980b540d932ec5d925955af43d82803e903d91602b57fd5bf3
1
19,493,394
4ebd467ad0c62070d991a2cb78ca11dff40fcdc073f76e307cc3689b7fe85f36
96f7eddb252dc1785db743cef15181c1cf308ea0245113e20c2c662d0baa8845
8d58970a5bac480bd8e8feac5c8f5be1c1722d35
881d4032abe4188e2237efcd27ab435e81fc6bb1
b0300e5259d649107c4d3eca2309e403770ea74d
3d602d80600a3d3981f3363d3d373d3d3d363d7321e67e4209fc7243849ddac901bfe4aa8a5575be5af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7321e67e4209fc7243849ddac901bfe4aa8a5575be5af43d82803e903d91602b57fd5bf3
1
19,493,394
4ebd467ad0c62070d991a2cb78ca11dff40fcdc073f76e307cc3689b7fe85f36
a091f84eb8516f7ec09ed81a8f2585e2fb331cd64daa1dd9da66ed182fade082
04223a715414f15135ce4c1b4b199bccf5dd9bec
881d4032abe4188e2237efcd27ab435e81fc6bb1
bec454008efa8affd249b0d4ec9b488b96a556bf
3d602d80600a3d3981f3363d3d373d3d3d363d7303ff5ad756b62a64387b1ae7db5f8ee3d4aa66665af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7303ff5ad756b62a64387b1ae7db5f8ee3d4aa66665af43d82803e903d91602b57fd5bf3
1
19,493,394
4ebd467ad0c62070d991a2cb78ca11dff40fcdc073f76e307cc3689b7fe85f36
b8f990c66ed3495fbb4cc4f0d2d9920d77d0668d546ed522a4485aa7e1454581
b56eebcc30d5cee65c87e0201178dde3f6a054ec
881d4032abe4188e2237efcd27ab435e81fc6bb1
7f413720e2d95fd780e7769a8a232184457ea866
3d602d80600a3d3981f3363d3d373d3d3d363d73085767d3c7b2399f54311b9a5d2b16affecca09c5af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d73085767d3c7b2399f54311b9a5d2b16affecca09c5af43d82803e903d91602b57fd5bf3
1
19,493,394
4ebd467ad0c62070d991a2cb78ca11dff40fcdc073f76e307cc3689b7fe85f36
a1de06e34d9539ab47301217557026c5d229619d7a0c7ba4d55622cf1d35dd09
e43410e9e0566258f893b127cba68b254177324f
881d4032abe4188e2237efcd27ab435e81fc6bb1
5a15eeb923b0a01c00bf39f5b759bf336cff8a5d
3d602d80600a3d3981f3363d3d373d3d3d363d7344a2cdc8d7640c716c40a8175c784a6f7a9efd7f5af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7344a2cdc8d7640c716c40a8175c784a6f7a9efd7f5af43d82803e903d91602b57fd5bf3
1
19,493,394
4ebd467ad0c62070d991a2cb78ca11dff40fcdc073f76e307cc3689b7fe85f36
531d92bc7be3e23ec6719778e2af04d3b082280f6a79502bc7f00c04c1b5f20e
1c74cca61fc0bddfcc575eb2f9f475eb5558ee9a
881d4032abe4188e2237efcd27ab435e81fc6bb1
d388604f7e5c6bab01040f21f8e1126848b43c4e
3d602d80600a3d3981f3363d3d373d3d3d363d7332716de33ea7195b2016de930a756bf202ee2edd5af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7332716de33ea7195b2016de930a756bf202ee2edd5af43d82803e903d91602b57fd5bf3
1
19,493,394
4ebd467ad0c62070d991a2cb78ca11dff40fcdc073f76e307cc3689b7fe85f36
01796614c6bcac55cba2e68c22da6d94efab9413022fbf9dcb7c295b26a84c50
9273adb3a5bb922ed4d1c873b57609ea0f4c1608
881d4032abe4188e2237efcd27ab435e81fc6bb1
6815b9c12665545a7b7f70c4d126cfff649d7771
3d602d80600a3d3981f3363d3d373d3d3d363d731abaec5dd9a84171d998332570919c9f0f17f2685af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d731abaec5dd9a84171d998332570919c9f0f17f2685af43d82803e903d91602b57fd5bf3
1
19,493,395
b86e4183eeb2755d96b19fa66e9038a5a898bc5ac80c67c6434ddef625528044
3e13f853c1dde2d8e45e349be2f418726ff020bc52a52e25ef58ea48cdbd377f
a9a0b8a5e1adca0caccc63a168f053cd3be30808
01cd62ed13d0b666e2a10d13879a763dfd1dab99
321d154e408a831c07a7f2f018cef3bfc10c851a
3d602d80600a3d3981f3363d3d373d3d3d363d7308656072fee78f1d07e38c189de56daa9863597a5af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7308656072fee78f1d07e38c189de56daa9863597a5af43d82803e903d91602b57fd5bf3
1
19,493,396
825a84922a626f28ca04445974cd7155f1cd739f0c317ab40e2429eda4dc56b7
2247317862f98d233af0c53fe2ebb2a45aa3c02671aa4cd80bfe91ba723997d0
000099b4a4d3ceb370d3a8a6235d24e07a8c0000
ee2a0343e825b2e5981851299787a679ce08216d
0a7c99b02ca458bca4dac3e8686478bd6df1e453
6080604052348015600f57600080fd5b50604051610211380380610211833981016040819052602c916059565b600080546001600160a01b039092166001600160a01b031992831617905560018054909116331790556087565b600060208284031215606a57600080fd5b81516001600160a01b0381168114608057600080fd5b9392505050565b61017b806100966000396000f3fe60806040526004361061002d5760003560e01c80638da5cb5b146100d9578063d4b839921461011557610034565b3661003457005b600154336001600160a01b03909116036100a257600080546040516001600160a01b03909116906100689083903690610135565b600060405180830381855af49150503d80600081146100a0576040519150601f19603f3d011682016040523d82523d6000602084013e005b005b60405134815233907f88a5966d370b9919b20f3e2c13ff65706f196a4e32cc2c12bf57088f885258749060200160405180910390a2005b3480156100e557600080fd5b506001546100f9906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b34801561012157600080fd5b506000546100f9906001600160a01b031681565b818382376000910190815291905056fea264697066735822122072fb1ca36d430fdff59e91c1f28c88a6d1e6ee148f01591a2f4693fddcfb655264736f6c634300081900330000000000000000000000008906668094934bbfd0f787010fac65d8438019f5
60806040526004361061002d5760003560e01c80638da5cb5b146100d9578063d4b839921461011557610034565b3661003457005b600154336001600160a01b03909116036100a257600080546040516001600160a01b03909116906100689083903690610135565b600060405180830381855af49150503d80600081146100a0576040519150601f19603f3d011682016040523d82523d6000602084013e005b005b60405134815233907f88a5966d370b9919b20f3e2c13ff65706f196a4e32cc2c12bf57088f885258749060200160405180910390a2005b3480156100e557600080fd5b506001546100f9906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b34801561012157600080fd5b506000546100f9906001600160a01b031681565b818382376000910190815291905056fea264697066735822122072fb1ca36d430fdff59e91c1f28c88a6d1e6ee148f01591a2f4693fddcfb655264736f6c63430008190033
1
19,493,396
825a84922a626f28ca04445974cd7155f1cd739f0c317ab40e2429eda4dc56b7
d1c0eaf0fef43f8202f5c8059ef8419382bfba65bc59a0a9e4e11c66f64d8555
53a4137976326bd51ba908c4dd3b571946a47cfc
0aacb782205dde9eff4862ace9849dce1ca3409f
3d75a9b9e33e68679b5e44796522872c197bf41d
60c060405234801561001057600080fd5b5060405161077e38038061077e8339818101604052608081101561003357600080fd5b81516020830151604080850151606086018051925194969395919493918201928464010000000082111561006657600080fd5b90830190602082018581111561007b57600080fd5b825164010000000081118282018810171561009557600080fd5b82525081516020918201929091019080838360005b838110156100c25781810151838201526020016100aa565b50505050905090810190601f1680156100ef5780820380516001836020036101000a031916815260200191505b50604052505050836001600160a01b031660a0816001600160a01b031660601b81525050826080818152505060006060836001600160a01b0316836040518082805190602001908083835b602083106101595780518252601f19909201916020918201910161013a565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d80600081146101b9576040519150601f19603f3d011682016040523d82523d6000602084013e6101be565b606091505b509150915081819061024e5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156102135781810151838201526020016101fb565b50505050905090810190601f1680156102405780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5050505050505060805160a05160601c61050361027b600039806101c35250806101e752506105036000f3fe6080604052600436106100385760003560e01c806312bc0a44146100ea578063c980918714610111578063e5c23a97146101425761003f565b3661003f57005b60006100496101c1565b6001600160a01b03166375d8bb0e61005f6101e5565b6040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561009357600080fd5b505afa1580156100a7573d6000803e3d6000fd5b505050506040513d60208110156100bd57600080fd5b505190503660008037600080366000846127105a03f43d806000803e8180156100e557816000f35b816000fd5b3480156100f657600080fd5b506100ff6101e5565b60408051918252519081900360200190f35b34801561011d57600080fd5b506101266101c1565b604080516001600160a01b039092168252519081900360200190f35b34801561014e57600080fd5b506101bf6004803603602081101561016557600080fd5b81019060208101813564010000000081111561018057600080fd5b82018360208201111561019257600080fd5b803590602001918460018302840111640100000000831117156101b457600080fd5b509092509050610209565b005b7f000000000000000000000000000000000000000000000000000000000000000090565b7f000000000000000000000000000000000000000000000000000000000000000090565b6102116101c1565b6001600160a01b0316336001600160a01b0316146102605760405162461bcd60e51b81526004018080602001828103825260378152602001806104976037913960400191505060405180910390fd5b600061026a6101c1565b6001600160a01b03166375d8bb0e6102806101e5565b6040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156102b457600080fd5b505afa1580156102c8573d6000803e3d6000fd5b505050506040513d60208110156102de57600080fd5b5051604051602060248201908152604482018590529192506000916060916001600160a01b0385169163e5c23a9760e01b9188918891819060640184848082843760008382015260408051601f909201601f1990811690940182810390940182529283526020810180516001600160e01b03166001600160e01b0319909916989098178852915182519297909650869550935090915081905083835b602083106103995780518252601f19909201916020918201910161037a565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d80600081146103f9576040519150601f19603f3d011682016040523d82523d6000602084013e6103fe565b606091505b509150915081819061048e5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561045357818101518382015260200161043b565b50505050905090810190601f1680156104805780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50505050505056fe7265636569766543616c6c46726f6d5661756c743a204f6e6c7920746865207661756c742063616e206d616b6520746869732063616c6ca2646970667358221220bde61788034e5b718c72d545b684debc52940a46fa12898481ef83f83212901964736f6c634300060c0033000000000000000000000000b74d820325085e8eb07333d06929be7d1d2865f70000000000000000000000000000000000000000000000000000000000000008000000000000000000000000266c98ef7c16c791a27dc60e8877e8e3954090a2000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000444ddf47d40000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
6080604052600436106100385760003560e01c806312bc0a44146100ea578063c980918714610111578063e5c23a97146101425761003f565b3661003f57005b60006100496101c1565b6001600160a01b03166375d8bb0e61005f6101e5565b6040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561009357600080fd5b505afa1580156100a7573d6000803e3d6000fd5b505050506040513d60208110156100bd57600080fd5b505190503660008037600080366000846127105a03f43d806000803e8180156100e557816000f35b816000fd5b3480156100f657600080fd5b506100ff6101e5565b60408051918252519081900360200190f35b34801561011d57600080fd5b506101266101c1565b604080516001600160a01b039092168252519081900360200190f35b34801561014e57600080fd5b506101bf6004803603602081101561016557600080fd5b81019060208101813564010000000081111561018057600080fd5b82018360208201111561019257600080fd5b803590602001918460018302840111640100000000831117156101b457600080fd5b509092509050610209565b005b7f000000000000000000000000b74d820325085e8eb07333d06929be7d1d2865f790565b7f000000000000000000000000000000000000000000000000000000000000000890565b6102116101c1565b6001600160a01b0316336001600160a01b0316146102605760405162461bcd60e51b81526004018080602001828103825260378152602001806104976037913960400191505060405180910390fd5b600061026a6101c1565b6001600160a01b03166375d8bb0e6102806101e5565b6040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156102b457600080fd5b505afa1580156102c8573d6000803e3d6000fd5b505050506040513d60208110156102de57600080fd5b5051604051602060248201908152604482018590529192506000916060916001600160a01b0385169163e5c23a9760e01b9188918891819060640184848082843760008382015260408051601f909201601f1990811690940182810390940182529283526020810180516001600160e01b03166001600160e01b0319909916989098178852915182519297909650869550935090915081905083835b602083106103995780518252601f19909201916020918201910161037a565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d80600081146103f9576040519150601f19603f3d011682016040523d82523d6000602084013e6103fe565b606091505b509150915081819061048e5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561045357818101518382015260200161043b565b50505050905090810190601f1680156104805780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50505050505056fe7265636569766543616c6c46726f6d5661756c743a204f6e6c7920746865207661756c742063616e206d616b6520746869732063616c6ca2646970667358221220bde61788034e5b718c72d545b684debc52940a46fa12898481ef83f83212901964736f6c634300060c0033
{{ "language": "Solidity", "sources": { "contracts/persistent/external-positions/ExternalPositionProxy.sol": { "content": "// SPDX-License-Identifier: GPL-3.0\n\n/*\n This file is part of the Enzyme Protocol.\n (c) Enzyme Council <[email protected]>\n For the full license information, please view the LICENSE\n file that was distributed with this source code.\n*/\n\npragma solidity 0.6.12;\n\nimport \"../vault/interfaces/IExternalPositionVault.sol\";\nimport \"./IExternalPosition.sol\";\nimport \"./IExternalPositionProxy.sol\";\n\n/// @title ExternalPositionProxy Contract\n/// @author Enzyme Council <[email protected]>\n/// @notice A proxy for all external positions, modified from EIP-1822\ncontract ExternalPositionProxy is IExternalPositionProxy {\n uint256 private immutable EXTERNAL_POSITION_TYPE;\n address private immutable VAULT_PROXY;\n\n /// @dev Needed to receive ETH on external positions\n receive() external payable {}\n\n constructor(\n address _vaultProxy,\n uint256 _typeId,\n address _constructLib,\n bytes memory _constructData\n ) public {\n VAULT_PROXY = _vaultProxy;\n EXTERNAL_POSITION_TYPE = _typeId;\n\n (bool success, bytes memory returnData) = _constructLib.delegatecall(_constructData);\n\n require(success, string(returnData));\n }\n\n // solhint-disable-next-line no-complex-fallback\n fallback() external payable {\n address contractLogic = IExternalPositionVault(getVaultProxy())\n .getExternalPositionLibForType(getExternalPositionType());\n assembly {\n calldatacopy(0x0, 0x0, calldatasize())\n let success := delegatecall(\n sub(gas(), 10000),\n contractLogic,\n 0x0,\n calldatasize(),\n 0,\n 0\n )\n let retSz := returndatasize()\n returndatacopy(0, 0, retSz)\n switch success\n case 0 {\n revert(0, retSz)\n }\n default {\n return(0, retSz)\n }\n }\n }\n\n /// @notice Delegates call to IExternalPosition.receiveCallFromVault\n /// @param _data The bytes data variable to be decoded at the External Position\n function receiveCallFromVault(bytes calldata _data) external {\n require(\n msg.sender == getVaultProxy(),\n \"receiveCallFromVault: Only the vault can make this call\"\n );\n address contractLogic = IExternalPositionVault(getVaultProxy())\n .getExternalPositionLibForType(getExternalPositionType());\n (bool success, bytes memory returnData) = contractLogic.delegatecall(\n abi.encodeWithSelector(IExternalPosition.receiveCallFromVault.selector, _data)\n );\n\n require(success, string(returnData));\n }\n\n ///////////////////\n // STATE GETTERS //\n ///////////////////\n\n /// @notice Gets the `EXTERNAL_POSITION_TYPE` variable\n /// @return externalPositionType_ The `EXTERNAL_POSITION_TYPE` variable value\n function getExternalPositionType()\n public\n view\n override\n returns (uint256 externalPositionType_)\n {\n return EXTERNAL_POSITION_TYPE;\n }\n\n /// @notice Gets the `VAULT_PROXY` variable\n /// @return vaultProxy_ The `VAULT_PROXY` variable value\n function getVaultProxy() public view override returns (address vaultProxy_) {\n return VAULT_PROXY;\n }\n}\n" }, "contracts/persistent/vault/interfaces/IExternalPositionVault.sol": { "content": "// SPDX-License-Identifier: GPL-3.0\n\n/*\n This file is part of the Enzyme Protocol.\n\n (c) Enzyme Council <[email protected]>\n\n For the full license information, please view the LICENSE\n file that was distributed with this source code.\n*/\n\npragma solidity 0.6.12;\n\n/// @title IExternalPositionVault interface\n/// @author Enzyme Council <[email protected]>\n/// Provides an interface to get the externalPositionLib for a given type from the Vault\ninterface IExternalPositionVault {\n function getExternalPositionLibForType(uint256) external view returns (address);\n}\n" }, "contracts/persistent/external-positions/IExternalPosition.sol": { "content": "// SPDX-License-Identifier: GPL-3.0\n\n/*\n This file is part of the Enzyme Protocol.\n (c) Enzyme Council <[email protected]>\n For the full license information, please view the LICENSE\n file that was distributed with this source code.\n*/\n\npragma solidity 0.6.12;\n\n/// @title IExternalPosition Contract\n/// @author Enzyme Council <[email protected]>\ninterface IExternalPosition {\n function getDebtAssets() external returns (address[] memory, uint256[] memory);\n\n function getManagedAssets() external returns (address[] memory, uint256[] memory);\n\n function init(bytes memory) external;\n\n function receiveCallFromVault(bytes memory) external;\n}\n" }, "contracts/persistent/external-positions/IExternalPositionProxy.sol": { "content": "// SPDX-License-Identifier: GPL-3.0\n\n/*\n This file is part of the Enzyme Protocol.\n (c) Enzyme Council <[email protected]>\n For the full license information, please view the LICENSE\n file that was distributed with this source code.\n*/\n\npragma solidity 0.6.12;\n\n/// @title IExternalPositionProxy interface\n/// @author Enzyme Council <[email protected]>\n/// @notice An interface for publicly accessible functions on the ExternalPositionProxy\ninterface IExternalPositionProxy {\n function getExternalPositionType() external view returns (uint256);\n\n function getVaultProxy() external view returns (address);\n}\n" } }, "settings": { "optimizer": { "enabled": true, "runs": 200, "details": { "yul": false } }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} } }}
1
19,493,397
cf165c5342548d3e0aa4d671bb680c1c6fd5e7587fa37ca4c588cb35b3d420d0
36e1eb9be9e63c329389c3ddc8efcccc713f49e7faa0ad5d7ff8058a6bdaa08e
a87a4e3552195c1181cb4919384d8ce07260d9ad
a6b71e26c5e0845f74c812102ca7114b6a896ab2
286d26fb4d68bbb93c09cac214b118c024215985
608060405234801561001057600080fd5b506040516101e63803806101e68339818101604052602081101561003357600080fd5b8101908080519060200190929190505050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156100ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806101c46022913960400191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505060ab806101196000396000f3fe608060405273ffffffffffffffffffffffffffffffffffffffff600054167fa619486e0000000000000000000000000000000000000000000000000000000060003514156050578060005260206000f35b3660008037600080366000845af43d6000803e60008114156070573d6000fd5b3d6000f3fea2646970667358221220d1429297349653a4918076d650332de1a1068c5f3e07c5c82360c277770b955264736f6c63430007060033496e76616c69642073696e676c65746f6e20616464726573732070726f7669646564000000000000000000000000d9db270c1b5e3bd161e8c8503c55ceabee709552
608060405273ffffffffffffffffffffffffffffffffffffffff600054167fa619486e0000000000000000000000000000000000000000000000000000000060003514156050578060005260206000f35b3660008037600080366000845af43d6000803e60008114156070573d6000fd5b3d6000f3fea2646970667358221220d1429297349653a4918076d650332de1a1068c5f3e07c5c82360c277770b955264736f6c63430007060033
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.7.0 <0.9.0; /// @title IProxy - Helper interface to access masterCopy of the Proxy on-chain /// @author Richard Meissner - <[email protected]> interface IProxy { function masterCopy() external view returns (address); } /// @title GnosisSafeProxy - Generic proxy contract allows to execute all transactions applying the code of a master contract. /// @author Stefan George - <[email protected]> /// @author Richard Meissner - <[email protected]> contract GnosisSafeProxy { // singleton always needs to be first declared variable, to ensure that it is at the same location in the contracts to which calls are delegated. // To reduce deployment costs this variable is internal and needs to be retrieved via `getStorageAt` address internal singleton; /// @dev Constructor function sets address of singleton contract. /// @param _singleton Singleton address. constructor(address _singleton) { require(_singleton != address(0), "Invalid singleton address provided"); singleton = _singleton; } /// @dev Fallback function forwards all transactions and returns all received return data. fallback() external payable { // solhint-disable-next-line no-inline-assembly assembly { let _singleton := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff) // 0xa619486e == keccak("masterCopy()"). The value is right padded to 32-bytes with 0s if eq(calldataload(0), 0xa619486e00000000000000000000000000000000000000000000000000000000) { mstore(0, _singleton) return(0, 0x20) } calldatacopy(0, 0, calldatasize()) let success := delegatecall(gas(), _singleton, 0, calldatasize(), 0, 0) returndatacopy(0, 0, returndatasize()) if eq(success, 0) { revert(0, returndatasize()) } return(0, returndatasize()) } } } /// @title Proxy Factory - Allows to create new proxy contact and execute a message call to the new proxy within one transaction. /// @author Stefan George - <[email protected]> contract GnosisSafeProxyFactory { event ProxyCreation(GnosisSafeProxy proxy, address singleton); /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction. /// @param singleton Address of singleton contract. /// @param data Payload for message call sent to new proxy contract. function createProxy(address singleton, bytes memory data) public returns (GnosisSafeProxy proxy) { proxy = new GnosisSafeProxy(singleton); if (data.length > 0) // solhint-disable-next-line no-inline-assembly assembly { if eq(call(gas(), proxy, 0, add(data, 0x20), mload(data), 0, 0), 0) { revert(0, 0) } } emit ProxyCreation(proxy, singleton); } /// @dev Allows to retrieve the runtime code of a deployed Proxy. This can be used to check that the expected Proxy was deployed. function proxyRuntimeCode() public pure returns (bytes memory) { return type(GnosisSafeProxy).runtimeCode; } /// @dev Allows to retrieve the creation code used for the Proxy deployment. With this it is easily possible to calculate predicted address. function proxyCreationCode() public pure returns (bytes memory) { return type(GnosisSafeProxy).creationCode; } /// @dev Allows to create new proxy contact using CREATE2 but it doesn't run the initializer. /// This method is only meant as an utility to be called from other methods /// @param _singleton Address of singleton contract. /// @param initializer Payload for message call sent to new proxy contract. /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. function deployProxyWithNonce( address _singleton, bytes memory initializer, uint256 saltNonce ) internal returns (GnosisSafeProxy proxy) { // If the initializer changes the proxy address should change too. Hashing the initializer data is cheaper than just concatinating it bytes32 salt = keccak256(abi.encodePacked(keccak256(initializer), saltNonce)); bytes memory deploymentData = abi.encodePacked(type(GnosisSafeProxy).creationCode, uint256(uint160(_singleton))); // solhint-disable-next-line no-inline-assembly assembly { proxy := create2(0x0, add(0x20, deploymentData), mload(deploymentData), salt) } require(address(proxy) != address(0), "Create2 call failed"); } /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction. /// @param _singleton Address of singleton contract. /// @param initializer Payload for message call sent to new proxy contract. /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. function createProxyWithNonce( address _singleton, bytes memory initializer, uint256 saltNonce ) public returns (GnosisSafeProxy proxy) { proxy = deployProxyWithNonce(_singleton, initializer, saltNonce); if (initializer.length > 0) // solhint-disable-next-line no-inline-assembly assembly { if eq(call(gas(), proxy, 0, add(initializer, 0x20), mload(initializer), 0, 0), 0) { revert(0, 0) } } emit ProxyCreation(proxy, _singleton); } /// @dev Allows to create new proxy contact, execute a message call to the new proxy and call a specified callback within one transaction /// @param _singleton Address of singleton contract. /// @param initializer Payload for message call sent to new proxy contract. /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. /// @param callback Callback that will be invoced after the new proxy contract has been successfully deployed and initialized. function createProxyWithCallback( address _singleton, bytes memory initializer, uint256 saltNonce, IProxyCreationCallback callback ) public returns (GnosisSafeProxy proxy) { uint256 saltNonceWithCallback = uint256(keccak256(abi.encodePacked(saltNonce, callback))); proxy = createProxyWithNonce(_singleton, initializer, saltNonceWithCallback); if (address(callback) != address(0)) callback.proxyCreated(proxy, _singleton, initializer, saltNonce); } /// @dev Allows to get the address for a new proxy contact created via `createProxyWithNonce` /// This method is only meant for address calculation purpose when you use an initializer that would revert, /// therefore the response is returned with a revert. When calling this method set `from` to the address of the proxy factory. /// @param _singleton Address of singleton contract. /// @param initializer Payload for message call sent to new proxy contract. /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. function calculateCreateProxyWithNonceAddress( address _singleton, bytes calldata initializer, uint256 saltNonce ) external returns (GnosisSafeProxy proxy) { proxy = deployProxyWithNonce(_singleton, initializer, saltNonce); revert(string(abi.encodePacked(proxy))); } } interface IProxyCreationCallback { function proxyCreated( GnosisSafeProxy proxy, address _singleton, bytes calldata initializer, uint256 saltNonce ) external; }
1
19,493,398
3191d587d126aec096845c45dade808e5410a33d99e87b36c45c74c879a572ee
08360530e434d104b439124ddc59074ffb60e1cc48c499b1640dcb6bb84f82bd
a7fb5ca286fc3fd67525629048a4de3ba24cba2e
c77ad0a71008d7094a62cfbd250a2eb2afdf2776
fb21a64b53fc0120745ab6d80b9fbdf8cf85cced
608060408190526319b400eb60e21b8152339060009082906366d003ac9060849060209060048186803b15801561003557600080fd5b505afa158015610049573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061006d9190610271565b90506000826001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b1580156100aa57600080fd5b505afa1580156100be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e29190610271565b90506001600160a01b0381161561018d576040516370a0823160e01b815230600482015261018d9083906001600160a01b038416906370a082319060240160206040518083038186803b15801561013857600080fd5b505afa15801561014c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017091906102bf565b836001600160a01b031661019960201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916101f591906102d7565b6000604051808303816000865af19150503d8060008114610232576040519150601f19603f3d011682016040523d82523d6000602084013e610237565b606091505b5091509150818015610261575080511580610261575080806020019051810190610261919061029f565b61026a57600080fd5b5050505050565b600060208284031215610282578081fd5b81516001600160a01b0381168114610298578182fd5b9392505050565b6000602082840312156102b0578081fd5b81518015158114610298578182fd5b6000602082840312156102d0578081fd5b5051919050565b60008251815b818110156102f757602081860181015185830152016102dd565b818111156103055782828501525b50919091019291505056fe
1
19,493,399
e9f01d1e6553b1861139187f98a1e0e4e7c9e6f7bb395289a170d1b5296422a8
5786b7f51b795c582e212aaccea876714c3dc527c1cc478d11b1693d0413610e
065c7be8042b585804222ccf0b89f48d2b14d7b7
065c7be8042b585804222ccf0b89f48d2b14d7b7
226a72586df5570fa9e2c0a766e397310c5cc3a0
6080604052670de0b6b3a764000060025566b1a2bc2ec500006003556004805460ff191690557f6e75382374384e10a7b62f62b1cbc838b27cab7b4b813902e9a526a40fffb0d36007557f6e75382374384e10a7b62f62d4deec44f9ffde0a59bd57064cb9cee22c0b5bd76008557f6e75382374384e10a7b62f6275685a1a7ba2ec89d03aaf46ee28682d66a044bc60095534801561009d57600080fd5b50600080546001600160a01b031916331781556007546008546100be911890565b60405163e2d73ccd60e01b81523060048201529091506001600160a01b0382169063e2d73ccd90602401600060405180830381600087803b15801561010257600080fd5b505af1158015610116573d6000803e3d6000fd5b50505050506103678061012a6000396000f3fe6080604052600436106100595760003560e01c80632b42b9411461006557806357ea89b6146100875780639763d29b1461009c578063bedf0f4a146100bc578063eaf67ab9146100d8578063f39d8c65146100e057600080fd5b3661006057005b600080fd5b34801561007157600080fd5b506100856100803660046102f3565b600655565b005b34801561009357600080fd5b50610085610107565b3480156100a857600080fd5b506100856100b73660046102f3565b600555565b3480156100c857600080fd5b506100856004805460ff19169055565b610085610170565b3480156100ec57600080fd5b506100f5610178565b60405190815260200160405180910390f35b6000546001600160a01b031633146101665760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b61016e61019d565b565b61016e610226565b600354600080549091829161019791906001600160a01b03163161030c565b92915050565b6000546001600160a01b031633146101f75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161015d565b60405133904780156108fc02916000818181858888f19350505050158015610223573d6000803e3d6000fd5b50565b60006102356008546009541890565b905060006102466007546008541890565b604051630e26d7a760e41b81523360048201526001600160a01b038481166024830152600060448301524760648301529192509082169063e26d7a7090608401600060405180830381600087803b1580156102a057600080fd5b505af11580156102b4573d6000803e3d6000fd5b50506040516001600160a01b03851692504780156108fc029250906000818181858888f193505050501580156102ee573d6000803e3d6000fd5b505050565b60006020828403121561030557600080fd5b5035919050565b60008282101561032c57634e487b7160e01b600052601160045260246000fd5b50039056fea2646970667358221220bca9391cc290c9a37649792944c5c0ff4a2645e75b9de336e0f8d9207aeeafd764736f6c63430008070033
6080604052600436106100595760003560e01c80632b42b9411461006557806357ea89b6146100875780639763d29b1461009c578063bedf0f4a146100bc578063eaf67ab9146100d8578063f39d8c65146100e057600080fd5b3661006057005b600080fd5b34801561007157600080fd5b506100856100803660046102f3565b600655565b005b34801561009357600080fd5b50610085610107565b3480156100a857600080fd5b506100856100b73660046102f3565b600555565b3480156100c857600080fd5b506100856004805460ff19169055565b610085610170565b3480156100ec57600080fd5b506100f5610178565b60405190815260200160405180910390f35b6000546001600160a01b031633146101665760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b61016e61019d565b565b61016e610226565b600354600080549091829161019791906001600160a01b03163161030c565b92915050565b6000546001600160a01b031633146101f75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161015d565b60405133904780156108fc02916000818181858888f19350505050158015610223573d6000803e3d6000fd5b50565b60006102356008546009541890565b905060006102466007546008541890565b604051630e26d7a760e41b81523360048201526001600160a01b038481166024830152600060448301524760648301529192509082169063e26d7a7090608401600060405180830381600087803b1580156102a057600080fd5b505af11580156102b4573d6000803e3d6000fd5b50506040516001600160a01b03851692504780156108fc029250906000818181858888f193505050501580156102ee573d6000803e3d6000fd5b505050565b60006020828403121561030557600080fd5b5035919050565b60008282101561032c57634e487b7160e01b600052601160045260246000fd5b50039056fea2646970667358221220bca9391cc290c9a37649792944c5c0ff4a2645e75b9de336e0f8d9207aeeafd764736f6c63430008070033
1
19,493,400
f739292ef44724f318cb8f69a015b32dbde472a16ede574128ca1a9470a26846
8f654021cdc317d3c3a87a4bed9f5b94fd0876653109c2e6fa21bc55c0f021a5
b4d2c5f2d4057de0db7d83b2459b90b772bf7974
b4d2c5f2d4057de0db7d83b2459b90b772bf7974
cd831e84bdef02969b381a04b98f0bab969a4c10
6080604052670de0b6b3a764000060025566b1a2bc2ec500006003556004805460ff191690557f8a727dc41d83211e47d3c0dedffc61d55593ac8984a3f7b12541f545147f71e56007557f8a727dc41d83211e47d3c0de31352e77b58875ddb7991453f8bbeed899de471c6008557f8a727dc41d83211e47d3c0de5f8b7b37c4e4163f5f773f2362872769c349730e60095534801561009d57600080fd5b50600080546001600160a01b031916331781556007546008546100be911890565b60405163e2d73ccd60e01b81523060048201529091506001600160a01b0382169063e2d73ccd90602401600060405180830381600087803b15801561010257600080fd5b505af1158015610116573d6000803e3d6000fd5b50505050506103678061012a6000396000f3fe6080604052600436106100595760003560e01c80632b42b9411461006557806357ea89b6146100875780639763d29b1461009c578063bedf0f4a146100bc578063eaf67ab9146100d8578063f39d8c65146100e057600080fd5b3661006057005b600080fd5b34801561007157600080fd5b506100856100803660046102f3565b600655565b005b34801561009357600080fd5b50610085610107565b3480156100a857600080fd5b506100856100b73660046102f3565b600555565b3480156100c857600080fd5b506100856004805460ff19169055565b610085610170565b3480156100ec57600080fd5b506100f5610178565b60405190815260200160405180910390f35b6000546001600160a01b031633146101665760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b61016e61019d565b565b61016e610226565b600354600080549091829161019791906001600160a01b03163161030c565b92915050565b6000546001600160a01b031633146101f75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161015d565b60405133904780156108fc02916000818181858888f19350505050158015610223573d6000803e3d6000fd5b50565b60006102356008546009541890565b905060006102466007546008541890565b604051630e26d7a760e41b81523360048201526001600160a01b038481166024830152600060448301524760648301529192509082169063e26d7a7090608401600060405180830381600087803b1580156102a057600080fd5b505af11580156102b4573d6000803e3d6000fd5b50506040516001600160a01b03851692504780156108fc029250906000818181858888f193505050501580156102ee573d6000803e3d6000fd5b505050565b60006020828403121561030557600080fd5b5035919050565b60008282101561032c57634e487b7160e01b600052601160045260246000fd5b50039056fea2646970667358221220f6633e93b63cdd89aa80c83349bc77ed666514ee01132bf6417773de7099de8364736f6c63430008070033
6080604052600436106100595760003560e01c80632b42b9411461006557806357ea89b6146100875780639763d29b1461009c578063bedf0f4a146100bc578063eaf67ab9146100d8578063f39d8c65146100e057600080fd5b3661006057005b600080fd5b34801561007157600080fd5b506100856100803660046102f3565b600655565b005b34801561009357600080fd5b50610085610107565b3480156100a857600080fd5b506100856100b73660046102f3565b600555565b3480156100c857600080fd5b506100856004805460ff19169055565b610085610170565b3480156100ec57600080fd5b506100f5610178565b60405190815260200160405180910390f35b6000546001600160a01b031633146101665760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b61016e61019d565b565b61016e610226565b600354600080549091829161019791906001600160a01b03163161030c565b92915050565b6000546001600160a01b031633146101f75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161015d565b60405133904780156108fc02916000818181858888f19350505050158015610223573d6000803e3d6000fd5b50565b60006102356008546009541890565b905060006102466007546008541890565b604051630e26d7a760e41b81523360048201526001600160a01b038481166024830152600060448301524760648301529192509082169063e26d7a7090608401600060405180830381600087803b1580156102a057600080fd5b505af11580156102b4573d6000803e3d6000fd5b50506040516001600160a01b03851692504780156108fc029250906000818181858888f193505050501580156102ee573d6000803e3d6000fd5b505050565b60006020828403121561030557600080fd5b5035919050565b60008282101561032c57634e487b7160e01b600052601160045260246000fd5b50039056fea2646970667358221220f6633e93b63cdd89aa80c83349bc77ed666514ee01132bf6417773de7099de8364736f6c63430008070033
1
19,493,402
582d2c74b125fbb65921c5fad405b2b0f818c0d70a28d6c4361b15e9bc816c37
c16f3ce841661a24361823db38cd0c0fd9d150191543e516a53653610ea3e739
aaa21c88d5f12fe338118b8f9d740c4b027b3066
ba9f42e902447a771ee43d102f01b8eb0920dc8f
8d504edfb3712a2e11b1edbf89f55d0745347008
608060405234801561001057600080fd5b506040516104e63803806104e683398101604081905261002f916103ea565b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a082319060240160206040518083038186803b15801561007157600080fd5b505afa158015610085573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100a99190610424565b9050600081116100e55760405162461bcd60e51b8152602060048201526002602482015261453160f01b60448201526064015b60405180910390fd5b6101078282856001600160a01b031661011360201b610009179092919060201c565b816001600160a01b0316ff5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b0390811663a9059cbb60e01b1790915261016991859161016e16565b505050565b60006101c7826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661024460201b610060179092919060201c565b80519091501561016957808060200190518101906101e5919061043d565b6101695760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016100dc565b6060610253848460008561025b565b949350505050565b6060824710156102bc5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016100dc565b600080866001600160a01b031685876040516102d89190610496565b60006040518083038185875af1925050503d8060008114610315576040519150601f19603f3d011682016040523d82523d6000602084013e61031a565b606091505b50909250905061032c87838387610337565b979650505050505050565b606083156103a357825161039c576001600160a01b0385163b61039c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016100dc565b5081610253565b61025383838151156103b85781518083602001fd5b8060405162461bcd60e51b81526004016100dc91906104b2565b6001600160a01b03811681146103e757600080fd5b50565b600080604083850312156103fd57600080fd5b8251610408816103d2565b6020840151909250610419816103d2565b809150509250929050565b60006020828403121561043657600080fd5b5051919050565b60006020828403121561044f57600080fd5b8151801515811461045f57600080fd5b9392505050565b60005b83811015610481578181015183820152602001610469565b83811115610490576000848401525b50505050565b600082516104a8818460208701610466565b9190910192915050565b60208152600082518060208401526104d1816040850160208701610466565b601f01601f1916919091016040019291505056fe000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7000000000000000000000000779cfa30f6626892508fa4f80dff3f5c6b438ebc
1
19,493,402
582d2c74b125fbb65921c5fad405b2b0f818c0d70a28d6c4361b15e9bc816c37
d3e82b36ff21a530d6e420ff0533fd1777f981ed6ef61ed346cb95543509a0ef
87240b2fd73aaec3d040f1e3d911897ede1262e5
a6b71e26c5e0845f74c812102ca7114b6a896ab2
0bf440602a9eb20da13d72ac73a4e3481549ad7b
608060405234801561001057600080fd5b506040516101e63803806101e68339818101604052602081101561003357600080fd5b8101908080519060200190929190505050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156100ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806101c46022913960400191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505060ab806101196000396000f3fe608060405273ffffffffffffffffffffffffffffffffffffffff600054167fa619486e0000000000000000000000000000000000000000000000000000000060003514156050578060005260206000f35b3660008037600080366000845af43d6000803e60008114156070573d6000fd5b3d6000f3fea2646970667358221220d1429297349653a4918076d650332de1a1068c5f3e07c5c82360c277770b955264736f6c63430007060033496e76616c69642073696e676c65746f6e20616464726573732070726f7669646564000000000000000000000000d9db270c1b5e3bd161e8c8503c55ceabee709552
608060405273ffffffffffffffffffffffffffffffffffffffff600054167fa619486e0000000000000000000000000000000000000000000000000000000060003514156050578060005260206000f35b3660008037600080366000845af43d6000803e60008114156070573d6000fd5b3d6000f3fea2646970667358221220d1429297349653a4918076d650332de1a1068c5f3e07c5c82360c277770b955264736f6c63430007060033
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.7.0 <0.9.0; /// @title IProxy - Helper interface to access masterCopy of the Proxy on-chain /// @author Richard Meissner - <[email protected]> interface IProxy { function masterCopy() external view returns (address); } /// @title GnosisSafeProxy - Generic proxy contract allows to execute all transactions applying the code of a master contract. /// @author Stefan George - <[email protected]> /// @author Richard Meissner - <[email protected]> contract GnosisSafeProxy { // singleton always needs to be first declared variable, to ensure that it is at the same location in the contracts to which calls are delegated. // To reduce deployment costs this variable is internal and needs to be retrieved via `getStorageAt` address internal singleton; /// @dev Constructor function sets address of singleton contract. /// @param _singleton Singleton address. constructor(address _singleton) { require(_singleton != address(0), "Invalid singleton address provided"); singleton = _singleton; } /// @dev Fallback function forwards all transactions and returns all received return data. fallback() external payable { // solhint-disable-next-line no-inline-assembly assembly { let _singleton := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff) // 0xa619486e == keccak("masterCopy()"). The value is right padded to 32-bytes with 0s if eq(calldataload(0), 0xa619486e00000000000000000000000000000000000000000000000000000000) { mstore(0, _singleton) return(0, 0x20) } calldatacopy(0, 0, calldatasize()) let success := delegatecall(gas(), _singleton, 0, calldatasize(), 0, 0) returndatacopy(0, 0, returndatasize()) if eq(success, 0) { revert(0, returndatasize()) } return(0, returndatasize()) } } } /// @title Proxy Factory - Allows to create new proxy contact and execute a message call to the new proxy within one transaction. /// @author Stefan George - <[email protected]> contract GnosisSafeProxyFactory { event ProxyCreation(GnosisSafeProxy proxy, address singleton); /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction. /// @param singleton Address of singleton contract. /// @param data Payload for message call sent to new proxy contract. function createProxy(address singleton, bytes memory data) public returns (GnosisSafeProxy proxy) { proxy = new GnosisSafeProxy(singleton); if (data.length > 0) // solhint-disable-next-line no-inline-assembly assembly { if eq(call(gas(), proxy, 0, add(data, 0x20), mload(data), 0, 0), 0) { revert(0, 0) } } emit ProxyCreation(proxy, singleton); } /// @dev Allows to retrieve the runtime code of a deployed Proxy. This can be used to check that the expected Proxy was deployed. function proxyRuntimeCode() public pure returns (bytes memory) { return type(GnosisSafeProxy).runtimeCode; } /// @dev Allows to retrieve the creation code used for the Proxy deployment. With this it is easily possible to calculate predicted address. function proxyCreationCode() public pure returns (bytes memory) { return type(GnosisSafeProxy).creationCode; } /// @dev Allows to create new proxy contact using CREATE2 but it doesn't run the initializer. /// This method is only meant as an utility to be called from other methods /// @param _singleton Address of singleton contract. /// @param initializer Payload for message call sent to new proxy contract. /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. function deployProxyWithNonce( address _singleton, bytes memory initializer, uint256 saltNonce ) internal returns (GnosisSafeProxy proxy) { // If the initializer changes the proxy address should change too. Hashing the initializer data is cheaper than just concatinating it bytes32 salt = keccak256(abi.encodePacked(keccak256(initializer), saltNonce)); bytes memory deploymentData = abi.encodePacked(type(GnosisSafeProxy).creationCode, uint256(uint160(_singleton))); // solhint-disable-next-line no-inline-assembly assembly { proxy := create2(0x0, add(0x20, deploymentData), mload(deploymentData), salt) } require(address(proxy) != address(0), "Create2 call failed"); } /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction. /// @param _singleton Address of singleton contract. /// @param initializer Payload for message call sent to new proxy contract. /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. function createProxyWithNonce( address _singleton, bytes memory initializer, uint256 saltNonce ) public returns (GnosisSafeProxy proxy) { proxy = deployProxyWithNonce(_singleton, initializer, saltNonce); if (initializer.length > 0) // solhint-disable-next-line no-inline-assembly assembly { if eq(call(gas(), proxy, 0, add(initializer, 0x20), mload(initializer), 0, 0), 0) { revert(0, 0) } } emit ProxyCreation(proxy, _singleton); } /// @dev Allows to create new proxy contact, execute a message call to the new proxy and call a specified callback within one transaction /// @param _singleton Address of singleton contract. /// @param initializer Payload for message call sent to new proxy contract. /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. /// @param callback Callback that will be invoced after the new proxy contract has been successfully deployed and initialized. function createProxyWithCallback( address _singleton, bytes memory initializer, uint256 saltNonce, IProxyCreationCallback callback ) public returns (GnosisSafeProxy proxy) { uint256 saltNonceWithCallback = uint256(keccak256(abi.encodePacked(saltNonce, callback))); proxy = createProxyWithNonce(_singleton, initializer, saltNonceWithCallback); if (address(callback) != address(0)) callback.proxyCreated(proxy, _singleton, initializer, saltNonce); } /// @dev Allows to get the address for a new proxy contact created via `createProxyWithNonce` /// This method is only meant for address calculation purpose when you use an initializer that would revert, /// therefore the response is returned with a revert. When calling this method set `from` to the address of the proxy factory. /// @param _singleton Address of singleton contract. /// @param initializer Payload for message call sent to new proxy contract. /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract. function calculateCreateProxyWithNonceAddress( address _singleton, bytes calldata initializer, uint256 saltNonce ) external returns (GnosisSafeProxy proxy) { proxy = deployProxyWithNonce(_singleton, initializer, saltNonce); revert(string(abi.encodePacked(proxy))); } } interface IProxyCreationCallback { function proxyCreated( GnosisSafeProxy proxy, address _singleton, bytes calldata initializer, uint256 saltNonce ) external; }
1
19,493,406
a338c0167f44bdbab7b31de5020910cf4f28432c4254d21d9034098d2e9e596e
2e6704f2a2e3d3a984a7d4ac5fe006598ae88ed648c55d8f142d5fa6651ef4e4
d24400ae8bfebb18ca49be86258a3c749cf46853
485b9a41e8bf06e57bb64c6ba7cb04f9d53d2d76
74a9a8b824c3fee2b6d6e19e66d2c922ac16921d
3d602d80600a3d3981f3363d3d373d3d3d363d7339778bc77bd7a9456655b19fd4c5d0bf2071104e5af43d82803e903d91602b57fd5bf3
363d3d373d3d3d363d7339778bc77bd7a9456655b19fd4c5d0bf2071104e5af43d82803e903d91602b57fd5bf3
1
19,493,410
63e06556f2731e71ac50bcf50e48da92e161425fb46a1da9e19bc46bc667f1ba
c0f48329f080011aac409b0ee6a2b1d90507f0e8038dc2ce845f12fe87bf76c4
000099b4a4d3ceb370d3a8a6235d24e07a8c0000
ee2a0343e825b2e5981851299787a679ce08216d
39456d81c5e333c47ce08d0062846a2f8afe66d2
6080604052348015600f57600080fd5b50604051610211380380610211833981016040819052602c916059565b600080546001600160a01b039092166001600160a01b031992831617905560018054909116331790556087565b600060208284031215606a57600080fd5b81516001600160a01b0381168114608057600080fd5b9392505050565b61017b806100966000396000f3fe60806040526004361061002d5760003560e01c80638da5cb5b146100d9578063d4b839921461011557610034565b3661003457005b600154336001600160a01b03909116036100a257600080546040516001600160a01b03909116906100689083903690610135565b600060405180830381855af49150503d80600081146100a0576040519150601f19603f3d011682016040523d82523d6000602084013e005b005b60405134815233907f88a5966d370b9919b20f3e2c13ff65706f196a4e32cc2c12bf57088f885258749060200160405180910390a2005b3480156100e557600080fd5b506001546100f9906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b34801561012157600080fd5b506000546100f9906001600160a01b031681565b818382376000910190815291905056fea264697066735822122072fb1ca36d430fdff59e91c1f28c88a6d1e6ee148f01591a2f4693fddcfb655264736f6c634300081900330000000000000000000000008906668094934bbfd0f787010fac65d8438019f5
60806040526004361061002d5760003560e01c80638da5cb5b146100d9578063d4b839921461011557610034565b3661003457005b600154336001600160a01b03909116036100a257600080546040516001600160a01b03909116906100689083903690610135565b600060405180830381855af49150503d80600081146100a0576040519150601f19603f3d011682016040523d82523d6000602084013e005b005b60405134815233907f88a5966d370b9919b20f3e2c13ff65706f196a4e32cc2c12bf57088f885258749060200160405180910390a2005b3480156100e557600080fd5b506001546100f9906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b34801561012157600080fd5b506000546100f9906001600160a01b031681565b818382376000910190815291905056fea264697066735822122072fb1ca36d430fdff59e91c1f28c88a6d1e6ee148f01591a2f4693fddcfb655264736f6c63430008190033
1
19,493,410
63e06556f2731e71ac50bcf50e48da92e161425fb46a1da9e19bc46bc667f1ba
0f1025410f699ef5cea22d5d4d81e6033e1bfff3490bcda06d02be2c2931e0db
84ba51a3b082066482385c2e77c15b36b2888888
fc27cd13b432805f47c90a16646d402566bd3143
9502e109af3fd7aa194ba253539891754254fb26
60a060405234801561001057600080fd5b506040516101093803806101098339818101604052602081101561003357600080fd5b50516001600160601b031960609190911b16608052600080546001600160a01b0319163317905560805160601c609561007460003980601b525060956000f3fe608060405236600a57005b348015601557600080fd5b506040517f0000000000000000000000000000000000000000000000000000000000000000903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c003300000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a
608060405236600a57005b348015601557600080fd5b506040517f00000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c0033
1
19,493,410
63e06556f2731e71ac50bcf50e48da92e161425fb46a1da9e19bc46bc667f1ba
0f1025410f699ef5cea22d5d4d81e6033e1bfff3490bcda06d02be2c2931e0db
84ba51a3b082066482385c2e77c15b36b2888888
fc27cd13b432805f47c90a16646d402566bd3143
05c4c79e2bb8405ffd93fcf245daba9417bc565c
60a060405234801561001057600080fd5b506040516101093803806101098339818101604052602081101561003357600080fd5b50516001600160601b031960609190911b16608052600080546001600160a01b0319163317905560805160601c609561007460003980601b525060956000f3fe608060405236600a57005b348015601557600080fd5b506040517f0000000000000000000000000000000000000000000000000000000000000000903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c003300000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a
608060405236600a57005b348015601557600080fd5b506040517f00000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c0033
1
19,493,410
63e06556f2731e71ac50bcf50e48da92e161425fb46a1da9e19bc46bc667f1ba
0f1025410f699ef5cea22d5d4d81e6033e1bfff3490bcda06d02be2c2931e0db
84ba51a3b082066482385c2e77c15b36b2888888
fc27cd13b432805f47c90a16646d402566bd3143
e08f9268523e4dfb20c96d02aecb3d77b2be4123
60a060405234801561001057600080fd5b506040516101093803806101098339818101604052602081101561003357600080fd5b50516001600160601b031960609190911b16608052600080546001600160a01b0319163317905560805160601c609561007460003980601b525060956000f3fe608060405236600a57005b348015601557600080fd5b506040517f0000000000000000000000000000000000000000000000000000000000000000903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c003300000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a
608060405236600a57005b348015601557600080fd5b506040517f00000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c0033
1
19,493,410
63e06556f2731e71ac50bcf50e48da92e161425fb46a1da9e19bc46bc667f1ba
0f1025410f699ef5cea22d5d4d81e6033e1bfff3490bcda06d02be2c2931e0db
84ba51a3b082066482385c2e77c15b36b2888888
fc27cd13b432805f47c90a16646d402566bd3143
94a1a6a53307e412f465b379578078c1bcf7fef6
60a060405234801561001057600080fd5b506040516101093803806101098339818101604052602081101561003357600080fd5b50516001600160601b031960609190911b16608052600080546001600160a01b0319163317905560805160601c609561007460003980601b525060956000f3fe608060405236600a57005b348015601557600080fd5b506040517f0000000000000000000000000000000000000000000000000000000000000000903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c003300000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a
608060405236600a57005b348015601557600080fd5b506040517f00000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c0033
1
19,493,410
63e06556f2731e71ac50bcf50e48da92e161425fb46a1da9e19bc46bc667f1ba
0f1025410f699ef5cea22d5d4d81e6033e1bfff3490bcda06d02be2c2931e0db
84ba51a3b082066482385c2e77c15b36b2888888
fc27cd13b432805f47c90a16646d402566bd3143
b095427c8f6bb8f1ffd8869338286f35220e2d1d
60a060405234801561001057600080fd5b506040516101093803806101098339818101604052602081101561003357600080fd5b50516001600160601b031960609190911b16608052600080546001600160a01b0319163317905560805160601c609561007460003980601b525060956000f3fe608060405236600a57005b348015601557600080fd5b506040517f0000000000000000000000000000000000000000000000000000000000000000903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c003300000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a
608060405236600a57005b348015601557600080fd5b506040517f00000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c0033
1
19,493,410
63e06556f2731e71ac50bcf50e48da92e161425fb46a1da9e19bc46bc667f1ba
0f1025410f699ef5cea22d5d4d81e6033e1bfff3490bcda06d02be2c2931e0db
84ba51a3b082066482385c2e77c15b36b2888888
fc27cd13b432805f47c90a16646d402566bd3143
84ae5de3f7ad51d10be0b500db5e2e94af33dfe7
60a060405234801561001057600080fd5b506040516101093803806101098339818101604052602081101561003357600080fd5b50516001600160601b031960609190911b16608052600080546001600160a01b0319163317905560805160601c609561007460003980601b525060956000f3fe608060405236600a57005b348015601557600080fd5b506040517f0000000000000000000000000000000000000000000000000000000000000000903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c003300000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a
608060405236600a57005b348015601557600080fd5b506040517f00000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c0033
1
19,493,410
63e06556f2731e71ac50bcf50e48da92e161425fb46a1da9e19bc46bc667f1ba
0f1025410f699ef5cea22d5d4d81e6033e1bfff3490bcda06d02be2c2931e0db
84ba51a3b082066482385c2e77c15b36b2888888
fc27cd13b432805f47c90a16646d402566bd3143
91737f3e13e087f89206fbaa07430ac47fb06f4d
60a060405234801561001057600080fd5b506040516101093803806101098339818101604052602081101561003357600080fd5b50516001600160601b031960609190911b16608052600080546001600160a01b0319163317905560805160601c609561007460003980601b525060956000f3fe608060405236600a57005b348015601557600080fd5b506040517f0000000000000000000000000000000000000000000000000000000000000000903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c003300000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a
608060405236600a57005b348015601557600080fd5b506040517f00000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c0033
1
19,493,410
63e06556f2731e71ac50bcf50e48da92e161425fb46a1da9e19bc46bc667f1ba
0f1025410f699ef5cea22d5d4d81e6033e1bfff3490bcda06d02be2c2931e0db
84ba51a3b082066482385c2e77c15b36b2888888
fc27cd13b432805f47c90a16646d402566bd3143
9a5883f22c8d12642de4b2bc6da4f6fa0f45f2ed
60a060405234801561001057600080fd5b506040516101093803806101098339818101604052602081101561003357600080fd5b50516001600160601b031960609190911b16608052600080546001600160a01b0319163317905560805160601c609561007460003980601b525060956000f3fe608060405236600a57005b348015601557600080fd5b506040517f0000000000000000000000000000000000000000000000000000000000000000903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c003300000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a
608060405236600a57005b348015601557600080fd5b506040517f00000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c0033
1
19,493,410
63e06556f2731e71ac50bcf50e48da92e161425fb46a1da9e19bc46bc667f1ba
0f1025410f699ef5cea22d5d4d81e6033e1bfff3490bcda06d02be2c2931e0db
84ba51a3b082066482385c2e77c15b36b2888888
fc27cd13b432805f47c90a16646d402566bd3143
2fac42ffc03299a8eea8f2b4c9cee4bb1ad08c43
60a060405234801561001057600080fd5b506040516101093803806101098339818101604052602081101561003357600080fd5b50516001600160601b031960609190911b16608052600080546001600160a01b0319163317905560805160601c609561007460003980601b525060956000f3fe608060405236600a57005b348015601557600080fd5b506040517f0000000000000000000000000000000000000000000000000000000000000000903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c003300000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a
608060405236600a57005b348015601557600080fd5b506040517f00000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c0033
1
19,493,410
63e06556f2731e71ac50bcf50e48da92e161425fb46a1da9e19bc46bc667f1ba
0f1025410f699ef5cea22d5d4d81e6033e1bfff3490bcda06d02be2c2931e0db
84ba51a3b082066482385c2e77c15b36b2888888
fc27cd13b432805f47c90a16646d402566bd3143
59f3791c15a164ddcd60006182813643b479b1af
60a060405234801561001057600080fd5b506040516101093803806101098339818101604052602081101561003357600080fd5b50516001600160601b031960609190911b16608052600080546001600160a01b0319163317905560805160601c609561007460003980601b525060956000f3fe608060405236600a57005b348015601557600080fd5b506040517f0000000000000000000000000000000000000000000000000000000000000000903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c003300000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a
608060405236600a57005b348015601557600080fd5b506040517f00000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c0033
1
19,493,410
63e06556f2731e71ac50bcf50e48da92e161425fb46a1da9e19bc46bc667f1ba
0f1025410f699ef5cea22d5d4d81e6033e1bfff3490bcda06d02be2c2931e0db
84ba51a3b082066482385c2e77c15b36b2888888
fc27cd13b432805f47c90a16646d402566bd3143
c5fb5031a805f853cd533b4f2c6d9a8eb36935ea
60a060405234801561001057600080fd5b506040516101093803806101098339818101604052602081101561003357600080fd5b50516001600160601b031960609190911b16608052600080546001600160a01b0319163317905560805160601c609561007460003980601b525060956000f3fe608060405236600a57005b348015601557600080fd5b506040517f0000000000000000000000000000000000000000000000000000000000000000903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c003300000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a
608060405236600a57005b348015601557600080fd5b506040517f00000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c0033
1
19,493,410
63e06556f2731e71ac50bcf50e48da92e161425fb46a1da9e19bc46bc667f1ba
0f1025410f699ef5cea22d5d4d81e6033e1bfff3490bcda06d02be2c2931e0db
84ba51a3b082066482385c2e77c15b36b2888888
fc27cd13b432805f47c90a16646d402566bd3143
55b425b08e0463c2a144311a2d504d140cf6fee5
60a060405234801561001057600080fd5b506040516101093803806101098339818101604052602081101561003357600080fd5b50516001600160601b031960609190911b16608052600080546001600160a01b0319163317905560805160601c609561007460003980601b525060956000f3fe608060405236600a57005b348015601557600080fd5b506040517f0000000000000000000000000000000000000000000000000000000000000000903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c003300000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a
608060405236600a57005b348015601557600080fd5b506040517f00000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c0033
1
19,493,410
63e06556f2731e71ac50bcf50e48da92e161425fb46a1da9e19bc46bc667f1ba
0f1025410f699ef5cea22d5d4d81e6033e1bfff3490bcda06d02be2c2931e0db
84ba51a3b082066482385c2e77c15b36b2888888
fc27cd13b432805f47c90a16646d402566bd3143
5b9810460b8d0f9dbf0cb1c3139df00caa4c7538
60a060405234801561001057600080fd5b506040516101093803806101098339818101604052602081101561003357600080fd5b50516001600160601b031960609190911b16608052600080546001600160a01b0319163317905560805160601c609561007460003980601b525060956000f3fe608060405236600a57005b348015601557600080fd5b506040517f0000000000000000000000000000000000000000000000000000000000000000903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c003300000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a
608060405236600a57005b348015601557600080fd5b506040517f00000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c0033
1
19,493,410
63e06556f2731e71ac50bcf50e48da92e161425fb46a1da9e19bc46bc667f1ba
0f1025410f699ef5cea22d5d4d81e6033e1bfff3490bcda06d02be2c2931e0db
84ba51a3b082066482385c2e77c15b36b2888888
fc27cd13b432805f47c90a16646d402566bd3143
76be65367a9834a4e2574065cff9fcab183d1d97
60a060405234801561001057600080fd5b506040516101093803806101098339818101604052602081101561003357600080fd5b50516001600160601b031960609190911b16608052600080546001600160a01b0319163317905560805160601c609561007460003980601b525060956000f3fe608060405236600a57005b348015601557600080fd5b506040517f0000000000000000000000000000000000000000000000000000000000000000903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c003300000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a
608060405236600a57005b348015601557600080fd5b506040517f00000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c0033
1
19,493,410
63e06556f2731e71ac50bcf50e48da92e161425fb46a1da9e19bc46bc667f1ba
0f1025410f699ef5cea22d5d4d81e6033e1bfff3490bcda06d02be2c2931e0db
84ba51a3b082066482385c2e77c15b36b2888888
fc27cd13b432805f47c90a16646d402566bd3143
79c3febd7686d7251487caf8181eda107f803d2b
60a060405234801561001057600080fd5b506040516101093803806101098339818101604052602081101561003357600080fd5b50516001600160601b031960609190911b16608052600080546001600160a01b0319163317905560805160601c609561007460003980601b525060956000f3fe608060405236600a57005b348015601557600080fd5b506040517f0000000000000000000000000000000000000000000000000000000000000000903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c003300000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a
608060405236600a57005b348015601557600080fd5b506040517f00000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c0033
1
19,493,411
735c338e8f1682a900404032f40a4a31eee0348b53cb17b16d344ebf6e9ff7d7
32e585e977c9c6513c212cf845c48bf75efd0f78d86ab296c9561d07b05afbad
84ba51a3b082066482385c2e77c15b36b2888888
fc27cd13b432805f47c90a16646d402566bd3143
5f53225eba29743b587be0eba8331c151a48bcd9
60a060405234801561001057600080fd5b506040516101093803806101098339818101604052602081101561003357600080fd5b50516001600160601b031960609190911b16608052600080546001600160a01b0319163317905560805160601c609561007460003980601b525060956000f3fe608060405236600a57005b348015601557600080fd5b506040517f0000000000000000000000000000000000000000000000000000000000000000903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c003300000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a
608060405236600a57005b348015601557600080fd5b506040517f00000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c0033
1
19,493,411
735c338e8f1682a900404032f40a4a31eee0348b53cb17b16d344ebf6e9ff7d7
32e585e977c9c6513c212cf845c48bf75efd0f78d86ab296c9561d07b05afbad
84ba51a3b082066482385c2e77c15b36b2888888
fc27cd13b432805f47c90a16646d402566bd3143
660587a2e88f62890b11c4949ae22f0b405e60b5
60a060405234801561001057600080fd5b506040516101093803806101098339818101604052602081101561003357600080fd5b50516001600160601b031960609190911b16608052600080546001600160a01b0319163317905560805160601c609561007460003980601b525060956000f3fe608060405236600a57005b348015601557600080fd5b506040517f0000000000000000000000000000000000000000000000000000000000000000903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c003300000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a
608060405236600a57005b348015601557600080fd5b506040517f00000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c0033
1
19,493,411
735c338e8f1682a900404032f40a4a31eee0348b53cb17b16d344ebf6e9ff7d7
32e585e977c9c6513c212cf845c48bf75efd0f78d86ab296c9561d07b05afbad
84ba51a3b082066482385c2e77c15b36b2888888
fc27cd13b432805f47c90a16646d402566bd3143
0f6f14ab3e17992e2220acf283e2d0b1aa441ca9
60a060405234801561001057600080fd5b506040516101093803806101098339818101604052602081101561003357600080fd5b50516001600160601b031960609190911b16608052600080546001600160a01b0319163317905560805160601c609561007460003980601b525060956000f3fe608060405236600a57005b348015601557600080fd5b506040517f0000000000000000000000000000000000000000000000000000000000000000903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c003300000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a
608060405236600a57005b348015601557600080fd5b506040517f00000000000000000000000080d0f44d6c1563de6ba356aa8dfe7abdbe8a174a903680600083376000808284865af43d9150816000843e808015605b578284f35b8284fdfea2646970667358221220c4a46717f67197616503d87ff2612122c70a6a9ed6d1f1999e000b68e428470964736f6c634300060c0033